Repository Public License
1import SwiftUI23/// The seven core colours of the Lunar Glass identity.4public enum LunarPalette {5 public static let obsidian = LunarRGBA(hex: 0x080B15)6 public static let midnight = LunarRGBA(hex: 0x101522)7 public static let lunarSlate = LunarRGBA(hex: 0x171F35)8 public static let silver = LunarRGBA(hex: 0xE6EAFA)9 public static let spectralViolet = LunarRGBA(hex: 0x927ADB)10 public static let lunarBlue = LunarRGBA(hex: 0x9BAEFF)11 public static let auroraMint = LunarRGBA(hex: 0x75DFC9)1213 /// Name → colour, in specification order (used by the gallery and the token export).14 public static let all: [(name: String, color: LunarRGBA)] = [15 ("Obsidian", obsidian), ("Midnight", midnight), ("Lunar Slate", lunarSlate), ("Silver", silver),16 ("Spectral Violet", spectralViolet), ("Lunar Blue", lunarBlue), ("Aurora Mint", auroraMint),17 ]18}1920/// Spacing scale on a 4-point grid.21public enum LunarSpacing {22 /// The grid unit. Every dimension in the system is a multiple of it.23 public static let unit: CGFloat = 424 public static let xs: CGFloat = 825 public static let sm: CGFloat = 1226 public static let md: CGFloat = 1627 public static let lg: CGFloat = 2428 public static let xl: CGFloat = 3229 public static let scale: [CGFloat] = [xs, sm, md, lg, xl]30}3132/// Corner radii. Corners are always continuous ("squircle"); capsules are fully rounded.33public enum LunarRadius {34 public static let xs: CGFloat = 1035 public static let sm: CGFloat = 1636 public static let md: CGFloat = 2237 public static let lg: CGFloat = 2838 public static let xl: CGFloat = 3639 public static let scale: [CGFloat] = [xs, sm, md, lg, xl]40}4142/// Stroke widths. Borders are hairlines; nothing in the system is outlined thicker than `focus`.43public enum LunarStroke {44 public static let hairline: CGFloat = 145 /// Hairline under Increase Contrast.46 public static let hairlineStrong: CGFloat = 1.547 public static let focus: CGFloat = 248 /// Orbital rings.49 public static let ring: CGFloat = 150}5152/// Control metrics.53public enum LunarMetrics {54 /// Minimum touch target on iOS / iPadOS.55 public static let touchTarget: CGFloat = 4456 /// Minimum pointer target on macOS.57 public static let pointerTarget: CGFloat = 2858 /// The platform minimum hit target.59 public static var hitTarget: CGFloat {60 #if os(macOS)61 pointerTarget62 #else63 touchTarget64 #endif65 }66 public static let iconSmall: CGFloat = 1667 public static let icon: CGFloat = 2068 public static let iconLarge: CGFloat = 2869 public static let controlHeight: CGFloat = 3670 public static let controlHeightCompact: CGFloat = 2871 public static let barHeight: CGFloat = 4472 public static let tabChipHeight: CGFloat = 3673}7475/// Depth of a surface above the window. Shadows stay soft and low-opacity: depth is mostly told by layering,76/// highlights and hairlines.77public enum LunarElevation: String, Sendable, CaseIterable {78 /// Flush with its parent: no shadow.79 case flat80 /// Controls and cards.81 case raised82 /// Floating chrome: capsule bar, dock, popovers.83 case floating8485 public var shadowRadius: CGFloat {86 switch self {87 case .flat: 088 case .raised: 1089 case .floating: 2490 }91 }92 public var shadowYOffset: CGFloat {93 switch self {94 case .flat: 095 case .raised: 396 case .floating: 1097 }98 }99 /// Multiplier applied to the theme shadow colour's alpha.100 public var shadowStrength: Double {101 switch self {102 case .flat: 0103 case .raised: 0.55104 case .floating: 1105 }106 }107}108