From 514c0e8fb1d44d9abfb95822f0284b3992ea4b0d Mon Sep 17 00:00:00 2001 From: another-simple-pixel Date: Tue, 7 Jul 2026 16:19:12 -0700 Subject: [PATCH] Update settings card background right away on theme switch The section-card background (and its row dividers) were computed from a one-time read of the current theme, so after switching theme the card kept the old color until the screen was reopened, while the rows inside it updated correctly. Make the two color helpers observe the theme as state so the card recomposes on theme change like everything else. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../commonMain/kotlin/chat/simplex/common/ui/theme/Theme.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/ui/theme/Theme.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/ui/theme/Theme.kt index 20e0280acd..1df7f6919b 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/ui/theme/Theme.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/ui/theme/Theme.kt @@ -603,8 +603,9 @@ data class ThemeModeOverride ( // cards above. DARK/BLACK: palette bg (cards already raised via founder's // formula in Section.kt). SIMPLEX: gradient bottom stop (darker), since the // canvas itself is a gradient drawn by themedBackgroundBrush. +@Composable fun canvasColorForCurrentTheme(): Color { - val theme = CurrentColors.value + val theme = CurrentColors.collectAsState().value val c = theme.colors return when (theme.base) { DefaultTheme.LIGHT -> c.background.mixWith(c.onBackground, 0.94f) @@ -616,8 +617,9 @@ fun canvasColorForCurrentTheme(): Color { // Card background color for SectionView. LIGHT: pure white (raised above the // off-white canvas). DARK/BLACK/SIMPLEX: founder's mixWith formula (lifts cards // above palette bg using onBackground tint). +@Composable fun sectionCardColor(): Color { - val theme = CurrentColors.value + val theme = CurrentColors.collectAsState().value return if (theme.base == DefaultTheme.LIGHT) Color.White else theme.colors.background.mixWith(theme.colors.onBackground, 0.95f) }