Files
andros 6a2a69825d Use reference app themes and apply colorScheme on selection
Replaces custom accent-only themes with the seven themes from org-social-ios-lib (Default, Emacs, Dracula, One Dark, Monokai, Material, Thankful Eyes). Swatches now show background/secondaryBackground/accent. Selecting a theme applies tint and preferredColorScheme app-wide immediately.
2026-05-26 11:08:39 +02:00

21 lines
528 B
Swift

import Foundation
import Observation
@Observable @MainActor
final class ThemeManager {
static let shared = ThemeManager()
private(set) var current: AppTheme = .default
private static let key = "appThemeID"
private init() {
let saved = UserDefaults.standard.string(forKey: Self.key) ?? "default"
current = AppTheme.all.first { $0.id == saved } ?? .default
}
func select(_ theme: AppTheme) {
current = theme
UserDefaults.standard.set(theme.id, forKey: Self.key)
}
}