fix statusbar color when changing theme

This commit is contained in:
greenart7c3
2023-07-07 06:09:18 -03:00
parent 3e615bb152
commit 38bb9f457d

View File

@@ -323,10 +323,14 @@ fun AmethystTheme(themeViewModel: ThemeViewModel, content: @Composable () -> Uni
)
val view = LocalView.current
if (!view.isInEditMode && darkTheme) {
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colors.background.toArgb()
if (darkTheme) {
window.statusBarColor = colors.background.toArgb()
} else {
window.statusBarColor = colors.primary.toArgb()
}
}
}
}