Skip to content

Commit 7fd8ee0

Browse files
Fix link color for dark mode
1 parent 58cb8b5 commit 7fd8ee0

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

app/src/main/java/com/github/gotify/MarkwonFactory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
import android.text.style.StyleSpan;
1111
import android.text.style.TypefaceSpan;
1212
import androidx.annotation.NonNull;
13+
import androidx.core.content.ContextCompat;
1314
import com.squareup.picasso.Picasso;
1415
import io.noties.markwon.AbstractMarkwonPlugin;
1516
import io.noties.markwon.Markwon;
1617
import io.noties.markwon.MarkwonSpansFactory;
1718
import io.noties.markwon.MarkwonVisitor;
1819
import io.noties.markwon.core.CorePlugin;
1920
import io.noties.markwon.core.CoreProps;
21+
import io.noties.markwon.core.MarkwonTheme;
2022
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
2123
import io.noties.markwon.ext.tables.TableAwareMovementMethod;
2224
import io.noties.markwon.ext.tables.TablePlugin;
@@ -42,6 +44,15 @@ public static Markwon createForMessage(Context context, Picasso picasso) {
4244
.usePlugin(PicassoImagesPlugin.create(picasso))
4345
.usePlugin(StrikethroughPlugin.create())
4446
.usePlugin(TablePlugin.create(context))
47+
.usePlugin(
48+
new AbstractMarkwonPlugin() {
49+
@Override
50+
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
51+
builder.linkColor(
52+
ContextCompat.getColor(context, R.color.hyperLink))
53+
.isLinkUnderlined(true);
54+
}
55+
})
4556
.build();
4657
}
4758

app/src/main/res/values-notnight/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
<color name="icons">#434343</color>
88
<color name="swipeBackground">#E74C3C</color>
99
<color name="swipeIcon">#FFFFFF</color>
10+
<color name="hyperLink">#FF7F50</color>
1011
</resources>

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
<color name="icons">#797979</color>
88
<color name="swipeBackground">#E74C3C</color>
99
<color name="swipeIcon">#FFFFFF</color>
10+
<color name="hyperLink">#FF7F50</color>
1011
</resources>

0 commit comments

Comments
 (0)