mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Try conditional modifier for preferredColorScheme
This commit is contained in:
@@ -146,7 +146,9 @@ struct MainApp: App {
|
||||
SceneNavigationView()
|
||||
.environmentObject(sceneModel)
|
||||
.environmentObject(defaults)
|
||||
}.commands {
|
||||
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
||||
}
|
||||
.commands {
|
||||
CommandGroup(after: .newItem, addition: {
|
||||
Button("New Feed", action: {})
|
||||
.keyboardShortcut("N")
|
||||
@@ -193,3 +195,20 @@ struct MainApp: App {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
struct PreferredColorSchemeModifier: ViewModifier {
|
||||
|
||||
var preferredColorScheme: UserInterfaceColorPalette
|
||||
|
||||
@ViewBuilder
|
||||
func body(content: Content) -> some View {
|
||||
switch preferredColorScheme {
|
||||
case .automatic:
|
||||
content
|
||||
case .dark:
|
||||
content.preferredColorScheme(.dark)
|
||||
case .light:
|
||||
content.preferredColorScheme(.light)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user