mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add the option to select the user interface color palette. Issue #1900
This commit is contained in:
@@ -21,10 +21,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
|
||||
window = UIWindow(windowScene: scene as! UIWindowScene)
|
||||
window!.tintColor = AppAssets.primaryAccentColor
|
||||
updateUserInterfaceStyle()
|
||||
window!.rootViewController = coordinator.start(for: window!.frame.size)
|
||||
|
||||
coordinator.restoreWindowState(session.stateRestorationActivity)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange), name: UserDefaults.didChangeNotification, object: nil)
|
||||
|
||||
if let shortcutItem = connectionOptions.shortcutItem {
|
||||
window!.makeKeyAndVisible()
|
||||
handleShortcutItem(shortcutItem)
|
||||
@@ -102,4 +105,19 @@ private extension SceneDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func userDefaultsDidChange() {
|
||||
updateUserInterfaceStyle()
|
||||
}
|
||||
|
||||
func updateUserInterfaceStyle() {
|
||||
switch AppDefaults.userInterfaceColorPalette {
|
||||
case .automatic:
|
||||
window!.overrideUserInterfaceStyle = .unspecified
|
||||
case .light:
|
||||
window!.overrideUserInterfaceStyle = .light
|
||||
case .dark:
|
||||
window!.overrideUserInterfaceStyle = .dark
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user