Theme: Refresh theme on launch if following color scheme

This commit is contained in:
Thomas Ricouard 2023-01-21 15:54:15 +01:00
parent 9f7eb4361a
commit 691b3f2667

View file

@ -31,6 +31,10 @@ struct ThemeApplier: ViewModifier {
if !theme.isThemePreviouslySet {
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
theme.isThemePreviouslySet = true
} else if theme.followSystemColorScheme && theme.isThemePreviouslySet,
let sets = availableColorsSets
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet }) {
theme.selectedSet = colorScheme == .dark ? sets.dark.name : sets.light.name
}
setWindowTint(theme.tintColor)
setBarsColor(theme.primaryBackgroundColor)