Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Sources/SPGlassThemes/GlassBuiltInThemes.swift8// Module : SPGlassThemes9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation42import SPGlassTokens4344extension GlassTheme {45 /// Follows the system: every colour role resolves to the matching system colour.46 public static let system = GlassTheme(47 id: "system", name: "System",48 summary: "System colours and accent. The safest choice inside an existing app."49 )5051 public static let crystal = GlassTheme(52 id: "crystal", name: "Crystal", summary: "Minimal, neutral and quiet.",53 light: palette(primary: 0x18181B, secondary: 0x64748B, accent: 0x475569, destructive: 0xB91C1C, success: 0x15803D, warning: 0xB45309,54 background: 0xFFFFFF, surface: 0xF3F4F6, textPrimary: 0x18181B, textSecondary: 0x52525B, separator: 0xE5E7EB, focusRing: 0x64748B),55 dark: palette(primary: 0xE5E7EB, secondary: 0xAAB9CC, accent: 0xAAB9CC, destructive: 0xF87171, success: 0x4ADE80, warning: 0xFBBF24,56 background: 0x0F1115, surface: 0x1B1E24, textPrimary: 0xF4F4F5, textSecondary: 0xAAB9CC, separator: 0x2E333B, focusRing: 0xAAB9CC)57 )5859 public static let obsidian = GlassTheme(60 id: "obsidian", name: "Obsidian", summary: "Deep neutral blacks with a restrained highlight.",61 light: palette(primary: 0x18181B, secondary: 0x52525B, accent: 0x27272A, destructive: 0xB91C1C, success: 0x166534, warning: 0x92400E,62 background: 0xFAFAFA, surface: 0xEFEFF1, textPrimary: 0x09090B, textSecondary: 0x52525B, separator: 0xD4D4D8, focusRing: 0x52525B),63 dark: palette(primary: 0xD4D4D8, secondary: 0xA1A1AA, accent: 0xD4D4D8, destructive: 0xF87171, success: 0x4ADE80, warning: 0xFBBF24,64 background: 0x09090B, surface: 0x18181B, textPrimary: 0xFAFAFA, textSecondary: 0xA1A1AA, separator: 0x27272A, focusRing: 0xD4D4D8),65 radii: GlassRadii(small: 6, medium: 12, large: 18, extraLarge: 26)66 )6768 public static let aurora = GlassTheme(69 id: "aurora", name: "Aurora", summary: "Indigo, violet and cyan for forward-looking interfaces.",70 light: palette(primary: 0x4F46E5, secondary: 0x7C3AED, accent: 0xDB2777, destructive: 0xDC2626, success: 0x047857, warning: 0xB45309,71 background: 0xFAFAFF, surface: 0xF0EFFE, textPrimary: 0x1E1B4B, textSecondary: 0x4C4A73, separator: 0xDDD9FB, focusRing: 0x6366F1),72 dark: palette(primary: 0x818CF8, secondary: 0xA78BFA, accent: 0x22D3EE, destructive: 0xFB7185, success: 0x34D399, warning: 0xFBBF24,73 background: 0x0E0B1F, surface: 0x1A1633, textPrimary: 0xF5F3FF, textSecondary: 0xC4B5FD, separator: 0x2E2A52, focusRing: 0x22D3EE),74 typography: GlassTypography(design: .rounded),75 motion: GlassMotion(style: .snappy),76 glass: GlassMaterialTokens(variant: .regular, tint: .primary)77 )7879 public static let emerald = GlassTheme(80 id: "emerald", name: "Emerald", summary: "Greens drawn from foliage, calm and legible.",81 light: palette(primary: 0x065F46, secondary: 0x047857, accent: 0x059669, destructive: 0xB91C1C, success: 0x047857, warning: 0x92400E,82 background: 0xECFDF5, surface: 0xD5F5E6, textPrimary: 0x064E3B, textSecondary: 0x065F46, separator: 0xA7E8CB, focusRing: 0x059669),83 dark: palette(primary: 0x10B981, secondary: 0x6EE7B7, accent: 0x6EE7B7, destructive: 0xFCA5A5, success: 0x6EE7B7, warning: 0xFCD34D,84 background: 0x03261D, surface: 0x064E3B, textPrimary: 0xECFDF5, textSecondary: 0xA7F3D0, separator: 0x065F46, focusRing: 0x6EE7B7),85 density: .comfortable86 )8788 public static let solar = GlassTheme(89 id: "solar", name: "Solar", summary: "Warm ambers and burnt orange.",90 light: palette(primary: 0xC2410C, secondary: 0xB45309, accent: 0xD97706, destructive: 0xB91C1C, success: 0x3F6212, warning: 0xB45309,91 background: 0xFFFBEB, surface: 0xFEF3C7, textPrimary: 0x7C2D12, textSecondary: 0x9A3412, separator: 0xFDE68A, focusRing: 0xEA580C),92 dark: palette(primary: 0xF59E0B, secondary: 0xFCD34D, accent: 0xFB923C, destructive: 0xFCA5A5, success: 0xBEF264, warning: 0xFCD34D,93 background: 0x1C0F07, surface: 0x2E1709, textPrimary: 0xFFFBEB, textSecondary: 0xFCD34D, separator: 0x7C2D12, focusRing: 0xFCD34D),94 typography: GlassTypography(design: .serif)95 )9697 public static let ocean = GlassTheme(98 id: "ocean", name: "Ocean", summary: "Maritime blues from shallow to deep water.",99 light: palette(primary: 0x0369A1, secondary: 0x0284C7, accent: 0x0284C7, destructive: 0xB91C1C, success: 0x047857, warning: 0xB45309,100 background: 0xF0F9FF, surface: 0xE0F2FE, textPrimary: 0x082F49, textSecondary: 0x075985, separator: 0xBAE6FD, focusRing: 0x0369A1),101 dark: palette(primary: 0x0EA5E9, secondary: 0x7DD3FC, accent: 0x7DD3FC, destructive: 0xFCA5A5, success: 0x6EE7B7, warning: 0xFCD34D,102 background: 0x051D2E, surface: 0x082F49, textPrimary: 0xF0F9FF, textSecondary: 0x7DD3FC, separator: 0x0C4A6E, focusRing: 0x7DD3FC),103 glass: GlassMaterialTokens(variant: .regular, tint: .accent)104 )105106 public static let neon = GlassTheme(107 id: "neon", name: "Neon", summary: "High-energy violet, magenta and cyan for games.",108 light: palette(primary: 0x9333EA, secondary: 0xA21CAF, accent: 0xDB0070, destructive: 0xBE123C, success: 0x4D7C0F, warning: 0xA16207,109 background: 0xFAF5FF, surface: 0xF3E8FF, textPrimary: 0x090014, textSecondary: 0x581C87, separator: 0xE9D5FF, focusRing: 0x9333EA),110 dark: palette(primary: 0xA855F7, secondary: 0x00FFFF, accent: 0xFF0080, destructive: 0xFF6B8B, success: 0xBEF264, warning: 0xFDE047,111 background: 0x090014, surface: 0x170B2B, textPrimary: 0xFAF5FF, textSecondary: 0xD8B4FE, separator: 0x3B1D63, focusRing: 0x00FFFF),112 typography: GlassTypography(design: .rounded, headingWeight: .bold),113 motion: GlassMotion(style: .bouncy),114 glass: GlassMaterialTokens(variant: .regular, tint: .primary)115 )116117 /// The System theme followed by the seven designed themes.118 public static let builtIn: [GlassTheme] = [.system, .crystal, .obsidian, .aurora, .emerald, .solar, .ocean, .neon]119120 /// Illustrative themes named after SP Boucher products.121 ///122 /// They show how a product theme is declared: only the brand roles are set and every other role follows123 /// the system. The colours are examples chosen for this package; they are not the palettes of those124 /// products and nothing here is used by them.125 public static let examples: [GlassTheme] = [126 example(id: "example-lou-ka", name: "Lou-Ka (example)", light: (0x0F766E, 0xB45309), dark: (0x2DD4BF, 0xFBBF24)),127 example(id: "example-immoka", name: "IMMOKA (example)", light: (0x1E3A8A, 0xB91C1C), dark: (0x93C5FD, 0xFCA5A5)),128 example(id: "example-vrai-prix", name: "Vrai Prix (example)", light: (0x15803D, 0xC2410C), dark: (0x4ADE80, 0xFB923C)),129 example(id: "example-maclustr", name: "MacLustr (example)", light: (0x334155, 0x0369A1), dark: (0xCBD5E1, 0x38BDF8)),130 example(id: "example-orix", name: "ORIX (example)", light: (0x6D28D9, 0x0E7490), dark: (0xC4B5FD, 0x67E8F9)),131 ]132133 /// Looks a theme up among the built-in and example themes.134 public static func named(_ id: GlassThemeID) -> GlassTheme? {135 (builtIn + examples).first { $0.id == id }136 }137138 private static func example(id: GlassThemeID, name: String, light: (UInt32, UInt32), dark: (UInt32, UInt32)) -> GlassTheme {139 func brand(_ pair: (UInt32, UInt32)) -> GlassPalette {140 GlassPalette([141 .primary: GlassRGBA(rgb: pair.0), .accent: GlassRGBA(rgb: pair.1), .focusRing: GlassRGBA(rgb: pair.0),142 ])143 }144 return GlassTheme(145 id: id, name: name,146 summary: "Illustrative palette for documentation. Not the product's actual brand colours.",147 light: brand(light), dark: brand(dark)148 )149 }150151 private static func palette(152 primary: UInt32, secondary: UInt32, accent: UInt32, destructive: UInt32, success: UInt32, warning: UInt32,153 background: UInt32, surface: UInt32, textPrimary: UInt32, textSecondary: UInt32, separator: UInt32, focusRing: UInt32154 ) -> GlassPalette {155 GlassPalette([156 .primary: GlassRGBA(rgb: primary), .secondary: GlassRGBA(rgb: secondary), .accent: GlassRGBA(rgb: accent),157 .destructive: GlassRGBA(rgb: destructive), .success: GlassRGBA(rgb: success), .warning: GlassRGBA(rgb: warning),158 .background: GlassRGBA(rgb: background), .surface: GlassRGBA(rgb: surface),159 .textPrimary: GlassRGBA(rgb: textPrimary), .textSecondary: GlassRGBA(rgb: textSecondary),160 .separator: GlassRGBA(rgb: separator), .focusRing: GlassRGBA(rgb: focusRing),161 ])162 }163}164