import SwiftUI enum HexTheme { // OpenCode dark palette — single cool-neutral temperature, tints via opacity. static let bgDeep = Color(red: 0x0A / 255.0, green: 0x0B / 255.0, blue: 0x0D / 255.0) static let bgBase = Color(red: 0x11 / 255.0, green: 0x13 / 255.0, blue: 0x16 / 255.0) static let layer01 = Color(red: 0x17 / 255.0, green: 0x19 / 255.0, blue: 0x1D / 255.0) static let layer02 = Color(red: 0x20 / 255.0, green: 0x23 / 255.0, blue: 0x29 / 255.0) static let textBase = Color.white.opacity(0.94) static let textMuted = Color.white.opacity(0.56) static let textFaint = Color.white.opacity(0.36) static let borderWeak = Color.white.opacity(0.06) static let borderStrong = Color.white.opacity(0.11) static let bgContrast = Color.white.opacity(0.96) static let textContrast = Color(red: 0x0A / 255.0, green: 0x0B / 255.0, blue: 0x0D / 255.0) static let danger = Color(red: 0xE5 / 255.0, green: 0x4D / 255.0, blue: 0x42 / 255.0) static let dangerSurface = Color(red: 0xE5 / 255.0, green: 0x4D / 255.0, blue: 0x42 / 255.0).opacity(0.14) static let warmMic = Color(red: 0xFF / 255.0, green: 0x95 / 255.0, blue: 0x00 / 255.0) static let success = Color(red: 0x34 / 255.0, green: 0xC7 / 255.0, blue: 0x59 / 255.0) static let warmPearl = Color(red: 0.96, green: 0.94, blue: 0.89) static let agentBlue = Color(red: 0.78, green: 0.86, blue: 0.97) static let cardRadius: CGFloat = 16 static let controlRadius: CGFloat = 10 static func formatClock(_ seconds: TimeInterval) -> String { let clamped = max(0, Int(seconds)) return String(format: "%d:%02d", clamped / 60, clamped % 60) } static func formatRemaining(_ seconds: TimeInterval) -> String { let clamped = max(0, Int(ceil(seconds))) if clamped >= 3600 { let mins = (clamped % 3600) / 60 return mins == 0 ? "\(clamped / 3600)h" : "\(clamped / 3600)h \(mins)m" } if clamped >= 90 { return "\((clamped + 59) / 60)m" } return formatClock(TimeInterval(clamped)) } } struct HexStatusDot: View { var color: Color var size: CGFloat = 7 var body: some View { Circle() .fill(color) .frame(width: size, height: size) } } /// Hex's concentric-hexagon brand mark (`site/src/App.tsx`). struct HexMarkView: View { var size: CGFloat = 20 var color: Color = HexTheme.textBase var coreColor: Color? = nil var body: some View { Canvas { context, canvasSize in let side = min(canvasSize.width, canvasSize.height) let s = side / 64.0 let lineWidth = max(1.15, 4.5 * s) let stroke = StrokeStyle(lineWidth: lineWidth, lineCap: .round, lineJoin: .round) func hexPath(_ points: [(CGFloat, CGFloat)]) -> Path { var path = Path() guard let first = points.first else { return path } path.move(to: CGPoint(x: first.0 * s, y: first.1 * s)) for pt in points.dropFirst() { path.addLine(to: CGPoint(x: pt.0 * s, y: pt.1 * s)) } path.closeSubpath() return path } let outer = hexPath([ (32, 4), (57, 18.5), (57, 45.5), (32, 60), (7, 45.5), (7, 18.5), ]) let middle = hexPath([ (32, 15), (48, 24.25), (48, 39.75), (32, 49), (16, 39.75), (16, 24.25), ]) let core = hexPath([ (32, 24), (39.5, 28.25), (39.5, 36.75), (32, 41), (24.5, 36.75), (24.5, 28.25), ]) context.stroke(outer, with: .color(color), style: stroke) context.stroke(middle, with: .color(color), style: stroke) context.fill(core, with: .color(coreColor ?? color)) } .frame(width: size, height: size) .accessibilityHidden(true) } } /// Static braided dot-matrix glyph for WidgetKit / Live Activity surfaces /// where SpringBoard renders archived display lists rather than Metal drawables. struct HexDotMatrixBadge: View { var columns: Int = 21 var rows: Int = 7 var pitch: CGFloat = 2.6 var cooling: Bool = false var body: some View { Canvas { context, size in let midX = size.width * 0.5 let midY = size.height * 0.5 let halfRows = CGFloat(rows - 1) * 0.5 let halfCols = CGFloat(columns - 1) * 0.5 let tint = cooling ? SIMD3(0.76, 0.85, 0.98) : SIMD3(0.96, 0.93, 0.87) for i in 0..