From 6ade5369ca8bf0361e46754e01755395a4dd908c Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Mon, 19 Aug 2024 17:11:20 +0200 Subject: [PATCH] Improve OverrideDarkMode kdocs (#552) Now it makes it clear that OverrideDarkMode does not change the theme, and provides an example on how to do that. --- .../jewel/foundation/theme/JewelTheme.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt index 9d995d5b8..5435675e0 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt @@ -142,7 +142,22 @@ public val LocalConsoleTextStyle: ProvidableCompositionLocal = error("No ConsoleTextStyle provided. Have you forgotten the theme?") } -/** Overrides the dark mode for the current composition scope. */ +/** + * Overrides the [isDark] value for the [content]. It is used to inject a + * different dark mode style in a sub-tree. + * + * Note: this does _not_ change the theme. If you want to change the theme, + * you need to do it by yourself. For example, in standalone: + * ```kotlin + * IntUiTheme(isDark = false) { + * Text("I am light") + * + * IntUiTheme(isDark = true) { + * Text("I am dark") + * } + * } + * ``` + */ @Composable public fun OverrideDarkMode( isDark: Boolean,