SPB Git

Repository Public License

LunarTint.swift 2.5 KB 60 lines swift

1import SwiftUI23/// The ten workspace colours. The cases mirror the app's workspace tint one-to-one (same names, same raw values),4/// so the app maps with `LunarTint(rawValue: tint.rawValue)`.5public enum LunarTint: String, Sendable, Codable, CaseIterable, Identifiable {6    case lunarBlue, spectralViolet, auroraMint, silver, solar, rose, ocean, forest, ember, nebula78    public var id: String { rawValue }910    /// Human-readable name (English; the app localises its own labels).11    public var displayName: String {12        switch self {13        case .lunarBlue: "Lunar Blue"14        case .spectralViolet: "Spectral Violet"15        case .auroraMint: "Aurora Mint"16        case .silver: "Silver"17        case .solar: "Solar"18        case .rose: "Rose"19        case .ocean: "Ocean"20        case .forest: "Forest"21        case .ember: "Ember"22        case .nebula: "Nebula"23        }24    }25}2627/// One colour per `LunarTint`, tuned for a given appearance.28public struct LunarTintPalette: Hashable, Sendable, Codable {29    public var lunarBlue, spectralViolet, auroraMint, silver, solar, rose, ocean, forest, ember, nebula: LunarRGBA3031    public subscript(tint: LunarTint) -> LunarRGBA {32        switch tint {33        case .lunarBlue: lunarBlue34        case .spectralViolet: spectralViolet35        case .auroraMint: auroraMint36        case .silver: silver37        case .solar: solar38        case .rose: rose39        case .ocean: ocean40        case .forest: forest41        case .ember: ember42        case .nebula: nebula43        }44    }4546    /// Luminous tints for dark surfaces. The first three are the core palette colours.47    public static let dark = LunarTintPalette(48        lunarBlue: LunarPalette.lunarBlue, spectralViolet: LunarPalette.spectralViolet,49        auroraMint: LunarPalette.auroraMint, silver: LunarRGBA(hex: 0xC9D0E6), solar: LunarRGBA(hex: 0xF4C56A),50        rose: LunarRGBA(hex: 0xF28DB2), ocean: LunarRGBA(hex: 0x5CB8F0), forest: LunarRGBA(hex: 0x6CC48A),51        ember: LunarRGBA(hex: 0xF0875A), nebula: LunarRGBA(hex: 0xC58BEF))5253    /// Deeper tints for light surfaces (each keeps at least 3:1 on lunar white).54    public static let light = LunarTintPalette(55        lunarBlue: LunarRGBA(hex: 0x3D54C8), spectralViolet: LunarRGBA(hex: 0x6A4FC4),56        auroraMint: LunarRGBA(hex: 0x0E8C76), silver: LunarRGBA(hex: 0x667089), solar: LunarRGBA(hex: 0x9A6A00),57        rose: LunarRGBA(hex: 0xC23F78), ocean: LunarRGBA(hex: 0x0F6FB5), forest: LunarRGBA(hex: 0x2B7A45),58        ember: LunarRGBA(hex: 0xBF4A1C), nebula: LunarRGBA(hex: 0x8A3FC2))59}60
Files main
Menu

Theme