Skip to content

Commit

Permalink
Merge pull request #134 from mikepenz/feature/130
Browse files Browse the repository at this point in the history
Offer new color option for `inlineCodeText`
  • Loading branch information
mikepenz committed Apr 25, 2024
2 parents 1595eb3 + 167e415 commit 0d14813
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import com.mikepenz.markdown.model.MarkdownColors
fun markdownColor(
text: Color = MaterialTheme.colors.onBackground,
codeText: Color = MaterialTheme.colors.onBackground,
inlineCodeText: Color = codeText,
linkText: Color = text,
codeBackground: Color = MaterialTheme.colors.onBackground.copy(alpha = 0.1f),
inlineCodeBackground: Color = codeBackground,
dividerColor: Color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f),
): MarkdownColors = DefaultMarkdownColors(
text = text,
codeText = codeText,
inlineCodeText = inlineCodeText,
linkText = linkText,
codeBackground = codeBackground,
inlineCodeBackground = inlineCodeBackground,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import com.mikepenz.markdown.model.MarkdownColors
fun markdownColor(
text: Color = MaterialTheme.colorScheme.onBackground,
codeText: Color = MaterialTheme.colorScheme.onBackground,
inlineCodeText: Color = codeText,
linkText: Color = text,
codeBackground: Color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.1f),
inlineCodeBackground: Color = codeBackground,
dividerColor: Color = MaterialTheme.colorScheme.outlineVariant,
): MarkdownColors = DefaultMarkdownColors(
text = text,
codeText = codeText,
inlineCodeText = inlineCodeText,
linkText = linkText,
codeBackground = codeBackground,
inlineCodeBackground = inlineCodeBackground,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ interface MarkdownColors {
/** Represents the color used for the text of code. */
val codeText: Color

/** Represents the color used for the text of code. */
val inlineCodeText: Color

/** Represents the color used for the text of links. */
val linkText: Color

Expand All @@ -29,6 +32,7 @@ interface MarkdownColors {
class DefaultMarkdownColors(
override val text: Color,
override val codeText: Color,
override val inlineCodeText: Color,
override val linkText: Color,
override val codeBackground: Color,
override val inlineCodeBackground: Color,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fun AnnotatedString.Builder.buildMarkdownAnnotatedString(content: String, childr
}

MarkdownElementTypes.CODE_SPAN -> {
pushStyle(SpanStyle(fontFamily = FontFamily.Monospace, background = LocalMarkdownColors.current.inlineCodeBackground))
pushStyle(SpanStyle(fontFamily = FontFamily.Monospace, color = LocalMarkdownColors.current.inlineCodeText, background = LocalMarkdownColors.current.inlineCodeBackground))
append(' ')
buildMarkdownAnnotatedString(content, child.children.innerList())
append(' ')
Expand Down

0 comments on commit 0d14813

Please sign in to comment.