Verein-Doktrin (THEMING.md 2026-05-31): jede App unterstützt alle Variants + Light/Dark/System. Visuelle Galerie aus Live-Vorschau-Karten (LazyVGrid) je Variant + segmentierter Appearance-Picker, im iOS-Konto-Tab und in den macOS-Settings. - PagetaTheme löst gegen ManaTheme.current (@AppStorage, Default paper) statt hartkodiert; alle ~40 Call-Sites unverändert. - PagetaBrand.config(for:) macht auch die Auth-Reise variant-bewusst. - Variant × Light/Dark orthogonal (Variant-Farben sind schon adaptiv, .preferredColorScheme steuert weiter Hell/Dunkel). - CLAUDE.md Invariante 6 von "fixe paper-Brand" auf "paper als Default, alle Themes wählbar" korrigiert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
73 lines
2.1 KiB
Swift
73 lines
2.1 KiB
Swift
import ManaTokens
|
|
import SwiftUI
|
|
|
|
#if canImport(UIKit)
|
|
import UIKit
|
|
#endif
|
|
|
|
#if canImport(AppKit)
|
|
import AppKit
|
|
#endif
|
|
|
|
/// Farb-Zugriffspunkt der App — löst gegen die **aktuell gewählte
|
|
/// Theme-Variant** auf (``ManaTheme/current``), nicht mehr gegen ein
|
|
/// hartkodiertes paper-Theme.
|
|
///
|
|
/// Damit folgt die ganze App der User-Wahl im Konto-Tab. Jede Variant
|
|
/// bringt ihre eigenen light/dark-adaptiven Werte mit (`Color.manaToken`
|
|
/// in `ManaTokens`), `.preferredColorScheme` (siehe ``AppearanceMode``)
|
|
/// entscheidet orthogonal über Hell/Dunkel.
|
|
///
|
|
/// **Reaktivität:** Die `Color`-Accessoren sind computed — sie lesen
|
|
/// `ManaTheme.current` bei jeder Body-Auswertung neu. Ändert der User
|
|
/// die Variant, re-rendert der `@AppStorage(ManaTheme.storageKey)` am
|
|
/// App-Root den Baum und alle Reads liefern die neuen Farben (gleicher
|
|
/// Mechanismus wie bei `AppearanceMode`).
|
|
enum PagetaTheme {
|
|
/// Brand-Primary der aktiven Variant (`--color-primary`).
|
|
static var primary: Color {
|
|
ManaTheme.current.primary
|
|
}
|
|
|
|
/// Seiten-Hintergrund der aktiven Variant (`--color-background`).
|
|
static var background: Color {
|
|
ManaTheme.current.background
|
|
}
|
|
|
|
/// Standard-Text der aktiven Variant (`--color-foreground`).
|
|
static var foreground: Color {
|
|
ManaTheme.current.foreground
|
|
}
|
|
|
|
/// Erhöhte Surface der aktiven Variant (`--color-surface-hover`).
|
|
static var surfaceHover: Color {
|
|
ManaTheme.current.surfaceHover
|
|
}
|
|
|
|
// MARK: - Reader-Farben (imperativ, außerhalb SwiftUI)
|
|
|
|
// Der Artikel-Reader baut NSAttributedString-Attribute und braucht
|
|
// daher Plattform-Farben (UIColor/NSColor). `UIColor(_:Color)` /
|
|
// `NSColor(_:Color)` erhalten den dynamischen light/dark-Provider
|
|
// der `manaToken`-Farbe — die Variant wird beim Bau ausgewertet.
|
|
|
|
#if canImport(UIKit)
|
|
static var foregroundUIColor: UIColor {
|
|
UIColor(ManaTheme.current.foreground)
|
|
}
|
|
|
|
static var backgroundUIColor: UIColor {
|
|
UIColor(ManaTheme.current.background)
|
|
}
|
|
#endif
|
|
|
|
#if canImport(AppKit)
|
|
static var foregroundNSColor: NSColor {
|
|
NSColor(ManaTheme.current.foreground)
|
|
}
|
|
|
|
static var backgroundNSColor: NSColor {
|
|
NSColor(ManaTheme.current.background)
|
|
}
|
|
#endif
|
|
}
|