Working with syntax rendering
This commit is contained in:
parent
2ac6090a3d
commit
f7d58bccc8
@ -74,6 +74,7 @@ public class MarkdownRenderer {
|
||||
.syntaxHighlight(Prism4jSyntaxHighlight.create(prism4j, prism4jTheme))
|
||||
.theme(SpannableTheme.builderWithDefaults(context)
|
||||
.codeBackgroundColor(prism4jTheme.background())
|
||||
.codeTextColor(prism4jTheme.textColor())
|
||||
.build())
|
||||
.build();
|
||||
|
||||
|
@ -25,9 +25,9 @@ public class Themes {
|
||||
// we have only 2 themes and Light one is default
|
||||
final int theme;
|
||||
if (dark) {
|
||||
theme = R.style.AppThemeBaseDark;
|
||||
theme = R.style.AppThemeDark;
|
||||
} else {
|
||||
theme = R.style.AppThemeBaseLight;
|
||||
theme = R.style.AppThemeLight;
|
||||
}
|
||||
|
||||
final Context appContext = context.getApplicationContext();
|
||||
|
@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="colorPrimary">#424242</color>
|
||||
<color name="colorPrimaryDark">#212121</color>
|
||||
<color name="colorAccent">#4caf50</color>
|
||||
|
||||
<color name="white">#FFF</color>
|
||||
<color name="black">#dd000000</color>
|
||||
|
||||
<color name="theme_light_window_background">#FFF</color>
|
||||
<color name="theme_light_text_color">#dd000000</color>
|
||||
|
||||
<color name="theme_dark_window_background">#303030</color>
|
||||
<color name="theme_dark_text_color">#ddffffff</color>
|
||||
|
||||
</resources>
|
||||
|
@ -10,7 +10,14 @@
|
||||
<item name="ic_app_bar_theme">@drawable/ic_app_bar_theme_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppThemeLight" parent="AppThemeBaseLight" />
|
||||
<style name="AppThemeDark" parent="AppThemeBaseDark" />
|
||||
<style name="AppThemeLight" parent="AppThemeBaseLight">
|
||||
<item name="android:windowBackground">@color/theme_light_window_background</item>
|
||||
<item name="android:textColor">@color/theme_light_text_color</item>
|
||||
</style>
|
||||
|
||||
<style name="AppThemeDark" parent="AppThemeBaseDark">
|
||||
<item name="android:windowBackground">@color/theme_dark_window_background</item>
|
||||
<item name="android:textColor">@color/theme_dark_text_color</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -51,5 +51,5 @@ ext {
|
||||
OK_HTTP = 'com.squareup.okhttp3:okhttp:3.9.0'
|
||||
|
||||
PRISM_4J = 'ru.noties:prism4j:1.0.0'
|
||||
PRISM_4J_BUNDLER = 'ru.noties:prism4j-bundler:1.0.0'
|
||||
PRISM_4J_BUNDLER = 'ru.noties:prism4j-bundler:1.0.1'
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ public interface Prism4jTheme {
|
||||
@ColorInt
|
||||
int background();
|
||||
|
||||
@ColorInt
|
||||
int textColor();
|
||||
|
||||
void apply(
|
||||
@NonNull String language,
|
||||
@NonNull Prism4j.Syntax syntax,
|
||||
|
@ -67,4 +67,9 @@ public class Prism4jThemeDefault extends Prism4jThemeBase {
|
||||
public int background() {
|
||||
return 0xFFf5f2f0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int textColor() {
|
||||
return 0xFF000000;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user