This commit is contained in:
Thomas Ricouard 2023-09-20 07:28:04 +02:00
parent 75a00907ea
commit 46df3bb7f9
4 changed files with 6 additions and 5 deletions

View file

@ -233,6 +233,7 @@ struct DisplaySettingsView: View {
Button {
theme.followSystemColorScheme = true
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
theme.setColor(withName: theme.selectedSet)
theme.avatarShape = .rounded
theme.avatarPosition = .top
theme.statusActionsDisplay = .full

View file

@ -245,11 +245,7 @@ import SwiftUI
}
}
public var selectedSet: ColorSetName = .iceCubeDark {
didSet {
setColor(withName: selectedSet)
}
}
public var selectedSet: ColorSetName = .iceCubeDark
public static let shared = Theme()

View file

@ -31,12 +31,14 @@ struct ThemeApplier: ViewModifier {
// If theme is never set before set the default store. This should only execute once after install.
if !theme.isThemePreviouslySet {
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
theme.setColor(withName: theme.selectedSet)
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
theme.setColor(withName: theme.selectedSet)
}
setWindowTint(theme.tintColor)
setWindowUserInterfaceStyle(from: theme.selectedScheme)
@ -57,6 +59,7 @@ struct ThemeApplier: ViewModifier {
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet })
{
theme.selectedSet = newColorScheme == .dark ? sets.dark.name : sets.light.name
theme.setColor(withName: theme.selectedSet)
}
}
#endif

View file

@ -90,6 +90,7 @@ struct ThemeBoxView: View {
theme.followSystemColorScheme = false
}
theme.selectedSet = color.name
theme.setColor(withName: theme.selectedSet)
}
}
}