mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-28 08:05:45 +00:00
37 lines
849 B
Swift
37 lines
849 B
Swift
import SwiftUI
|
|
|
|
/// The user's light/dark choice, stored on the device and applied at the root.
|
|
enum AppearancePreference: String, CaseIterable, Identifiable {
|
|
case system, light, dark
|
|
|
|
static let storageKey = "appearance"
|
|
/// What a fresh install shows until someone picks.
|
|
static let standard = AppearancePreference.light
|
|
|
|
var id: String { rawValue }
|
|
|
|
var title: String {
|
|
switch self {
|
|
case .system: "System"
|
|
case .light: "Light"
|
|
case .dark: "Dark"
|
|
}
|
|
}
|
|
|
|
var symbol: String {
|
|
switch self {
|
|
case .system: "circle.lefthalf.filled"
|
|
case .light: "sun.max"
|
|
case .dark: "moon"
|
|
}
|
|
}
|
|
|
|
var colorScheme: ColorScheme? {
|
|
switch self {
|
|
case .system: nil
|
|
case .light: .light
|
|
case .dark: .dark
|
|
}
|
|
}
|
|
}
|