Workaround selection background color of fenced code blocks

This commit is contained in:
Stefan Niedermann 2021-01-04 21:41:27 +01:00
parent 1cb2aeec88
commit e5daa14a0f
3 changed files with 9 additions and 4 deletions

View file

@ -3,6 +3,7 @@ package it.niedermann.android.markdown.markwon.plugins;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.MarkwonPlugin;
@ -11,7 +12,8 @@ import it.niedermann.android.markdown.R;
public class ThemePlugin extends AbstractMarkwonPlugin {
@NonNull Context context;
@NonNull
Context context;
private ThemePlugin(@NonNull Context context) {
this.context = context;
@ -25,8 +27,9 @@ public class ThemePlugin extends AbstractMarkwonPlugin {
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
super.configureTheme(builder);
builder
.bulletWidth(context.getResources().getDimensionPixelSize(R.dimen.bullet_point_width))
.headingBreakHeight(0)
.headingTextSizeMultipliers(new float[]{1.45f, 1.35f, 1.25f, 1.15f, 1.1f, 1.05f});
.codeBlockBackgroundColor(ContextCompat.getColor(context, R.color.bg_code))
.headingTextSizeMultipliers(new float[]{1.45f, 1.35f, 1.25f, 1.15f, 1.1f, 1.05f})
.bulletWidth(context.getResources().getDimensionPixelSize(R.dimen.bullet_point_width));
}
}

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bg_highlighted">#2a2a2a</color>
<color name="bg_code">#11ffffff</color>
</resources>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bg_highlighted">#eee</color>
<color name="search_color">#0082C9</color>
<color name="bg_highlighted">#eee</color>
<color name="bg_code">#0e000000</color>
</resources>