-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
DarkBackgroundColorScheme.kt
46 lines (42 loc) · 1.71 KB
/
DarkBackgroundColorScheme.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package de.markusressel.kodehighlighter.language.markdown.colorscheme
import android.graphics.Color
import android.graphics.Typeface
import android.text.style.CharacterStyle
import android.text.style.ForegroundColorSpan
import android.text.style.StyleSpan
import de.markusressel.kodehighlighter.core.StyleFactory
import de.markusressel.kodehighlighter.core.colorscheme.ColorScheme
import de.markusressel.kodehighlighter.core.rule.LanguageRule
import de.markusressel.kodehighlighter.language.markdown.rule.*
/**
* A dark color scheme for markdown
*/
class DarkBackgroundColorScheme : ColorScheme<CharacterStyle> {
override fun getStyles(type: LanguageRule): Set<StyleFactory<CharacterStyle>> {
return when (type) {
is BoldRule -> {
setOf({ ForegroundColorSpan(Color.parseColor("#0091EA")) },
{ StyleSpan(Typeface.BOLD) })
}
is ItalicRule -> {
setOf({ ForegroundColorSpan(Color.parseColor("#0091EA")) }, { StyleSpan(Typeface.ITALIC) })
}
is CodeInlineRule, is CodeLineRule -> {
setOf { ForegroundColorSpan(Color.parseColor("#00C853")) }
}
is HeadingRule -> {
setOf { ForegroundColorSpan(Color.parseColor("#FF6D00")) }
}
is ImageLinkRule, is TextLinkRule -> {
setOf { ForegroundColorSpan(Color.parseColor("#7C4DFF")) }
}
is StrikeRule -> {
setOf { ForegroundColorSpan(Color.parseColor("#5D4037")) }
}
is ListRule -> {
setOf { ForegroundColorSpan(Color.parseColor("#5f84d4")) }
}
else -> emptySet()
}
}
}