Skip to content

Commit

Permalink
- fetch dark theme prior to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Sep 6, 2024
1 parent 68c4a07 commit 6caf007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ Markdown(
)

// ADVANCED: Customize Highlights library by defining different theme
val highlightsBuilder = remember {
Highlights.Builder().theme(SyntaxThemes.atom(darkMode = isSystemInDarkTheme()))
val isDarkTheme = isSystemInDarkTheme()
val highlightsBuilder = remember(isDarkTheme) {
Highlights.Builder().theme(SyntaxThemes.atom(darkMode = isDarkTheme))
}
Markdown(
MARKDOWN,
Expand Down
5 changes: 3 additions & 2 deletions app-desktop/src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ fun main() = application {
}
) {
val scrollState = rememberScrollState()
val highlightsBuilder = remember {
Highlights.Builder().theme(SyntaxThemes.atom(darkMode = isSystemInDarkTheme()))
val isDarkTheme = isSystemInDarkTheme()
val highlightsBuilder = remember(isDarkTheme) {
Highlights.Builder().theme(SyntaxThemes.atom(darkMode = isDarkTheme))
}

Markdown(
Expand Down

0 comments on commit 6caf007

Please sign in to comment.