feat: generate Swift design tokens from tokens.json and add SstUI base

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 15:19:06 +02:00
co-authored by Claude Sonnet 5.5
parent bf731dab37
commit bd6bc3b890
10 changed files with 659 additions and 21 deletions
+26
View File
@@ -0,0 +1,26 @@
import AppKit
import SwiftUI
extension NSColor {
convenience init(hex: UInt32) {
self.init(
srgbRed: CGFloat((hex >> 16) & 0xFF) / 255,
green: CGFloat((hex >> 8) & 0xFF) / 255,
blue: CGFloat(hex & 0xFF) / 255,
alpha: 1)
}
}
extension Color {
/// A colour that switches between the Aluminium (light) and Graphite (dark) value with the appearance.
static func dynamic(light: UInt32, dark: UInt32) -> Color {
Color(nsColor: NSColor(name: nil) { appearance in
appearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua ? NSColor(hex: dark) : NSColor(hex: light)
})
}
/// The same colour in both finishes (shadow bases).
static func fixed(hex: UInt32) -> Color {
Color(nsColor: NSColor(hex: hex))
}
}