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
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,10 @@ struct ThemeApplier: ViewModifier {
if !theme.isThemePreviouslySet { if !theme.isThemePreviouslySet {
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
theme.isThemePreviouslySet = true 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) setWindowTint(theme.tintColor)
setBarsColor(theme.primaryBackgroundColor) setBarsColor(theme.primaryBackgroundColor)