diff --git a/markwon-core/src/main/java/io/noties/markwon/core/MarkwonTheme.java b/markwon-core/src/main/java/io/noties/markwon/core/MarkwonTheme.java index 53504310..3a99828b 100644 --- a/markwon-core/src/main/java/io/noties/markwon/core/MarkwonTheme.java +++ b/markwon-core/src/main/java/io/noties/markwon/core/MarkwonTheme.java @@ -139,6 +139,9 @@ public static Builder builderWithDefaults(@NonNull Context context) { // width of bullet, by default min(blockMargin, height) / 2 protected final int bulletWidth; + // whether ordered lists show the number part in bold + protected final boolean boldListItemNumber; + // by default - main text color protected final int codeTextColor; @@ -196,6 +199,7 @@ protected MarkwonTheme(@NonNull Builder builder) { this.listItemColor = builder.listItemColor; this.bulletListItemStrokeWidth = builder.bulletListItemStrokeWidth; this.bulletWidth = builder.bulletWidth; + this.boldListItemNumber = builder.boldListItemNumber; this.codeTextColor = builder.codeTextColor; this.codeBlockTextColor = builder.codeBlockTextColor; this.codeBackgroundColor = builder.codeBackgroundColor; @@ -278,6 +282,10 @@ public void applyListItemStyle(@NonNull Paint paint) { if (bulletListItemStrokeWidth != 0) { paint.setStrokeWidth(bulletListItemStrokeWidth); } + + if (boldListItemNumber) { + paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); + } } public int getBulletWidth(int height) { @@ -469,6 +477,7 @@ public static class Builder { private int listItemColor; private int bulletListItemStrokeWidth; private int bulletWidth; + private boolean boldListItemNumber; private int codeTextColor; private int codeBlockTextColor; // @since 1.0.5 private int codeBackgroundColor; @@ -497,6 +506,7 @@ public static class Builder { this.listItemColor = theme.listItemColor; this.bulletListItemStrokeWidth = theme.bulletListItemStrokeWidth; this.bulletWidth = theme.bulletWidth; + this.boldListItemNumber = theme.boldListItemNumber; this.codeTextColor = theme.codeTextColor; this.codeBlockTextColor = theme.codeBlockTextColor; this.codeBackgroundColor = theme.codeBackgroundColor; @@ -561,6 +571,12 @@ public Builder bulletWidth(@Px int bulletWidth) { return this; } + @NonNull + public Builder boldListItemNumber(boolean boldListItemNumber) { + this.boldListItemNumber = boldListItemNumber; + return this; + } + @NonNull public Builder codeTextColor(@ColorInt int codeTextColor) { this.codeTextColor = codeTextColor;