SPB Git

Repository Public

BuiltInThemes.swift 18.0 KB 305 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : SP Keyboard9// File             : Shared/Sources/ThemeEngine/BuiltInThemes.swift10// Description      : The twelve themes shipped with SP Keyboard ("Chromatic11//                    Intelligence"). Aurora SP is the default.12// Module           : ThemeEngine13// Repository       : https://git.spboucher.ai/sp-keyboard14// Created          : 2026-12-0115// Last Modified    : 2026-12-0116//17// =============================================================================18// AUTHOR & PROFESSIONAL AFFILIATION19// =============================================================================20//21// Author           : Simon-Pierre Boucher22// Position         : Professor of Finance23// Institution      : Université du Québec en Outaouais (UQO)24// Department       : Département des sciences administratives25// Organization     : SP Boucher26//27// Website          : https://spboucher.ai28// Git              : https://git.spboucher.ai29//30// =============================================================================31// OFFICIAL CONTACT DIRECTORY32// =============================================================================33//34// General          : info@spboucher.ai35// Professional     : contact@spboucher.ai36// Direct           : simon@spboucher.ai37// Research         : research@spboucher.ai38// Development      : dev@spboucher.ai39// Support          : support@spboucher.ai40// Security/Admin   : admin@spboucher.ai41// Notifications    : notifications@spboucher.ai42//43// Preferred Contact: support@spboucher.ai44//45// =============================================================================46// COPYRIGHT & INTELLECTUAL PROPERTY47// =============================================================================48//49// Copyright (c) 202650// Simon-Pierre Boucher51//52// All rights reserved where applicable.53//54// This file is governed by the applicable project license,55// copyright notices, institutional agreements and relevant law.56//57// Unless expressly authorized by the applicable license or58// rights holder, copying, redistribution, sublicensing,59// publication and commercial exploitation are not permitted.60//61// Existing third-party rights and notices remain unaffected.62//63// =============================================================================64// CONFIDENTIALITY & SECURITY65// =============================================================================66//67// Classification   : Public68// Distribution     : Public repository; use is governed by the project license69// Security Contact : admin@spboucher.ai70//71// Access to this source does not independently grant permission72// to redistribute or disclose confidential materials.73//74// Do not embed credentials, private keys, access tokens,75// certificates or confidential personal information.76//77// =============================================================================78// LICENSE & MAINTENANCE79// =============================================================================80//81// License          : None specified (no license file in this repository)82// Maintainer       : Simon-Pierre Boucher83// Technical Contact: dev@spboucher.ai84//85// =============================================================================86// END OF SP BOUCHER SOURCE HEADER87// =============================================================================8889import Foundation9091public enum BuiltInThemes {92    public static let defaultID = "atelier-clair"9394    /// The 2.0 signature set: flat, opaque key caps with a hard edge, one accent, no animated backdrop.95    public static let signature: [Theme] = [atelierClair, atelierNuit, craie, ardoise, sable, sapin, monochrome]9697    /// The vivid themes of 1.0.98    public static let expressive: [Theme] = [99        aurora, cyberpunk, solarFlare, oceanPulse, galaxy, rainbowPrism,100        candyGlass, toxicLime, arcticIce, midnightLuxe, lava,101    ]102103    public static let all: [Theme] = signature + expressive104105    /// Light theme of the default pair; `defaultDark` is drawn when the system or the field asks for dark.106    public static var `default`: Theme { atelierClair }107    public static var defaultDark: Theme { atelierNuit }108109    /// Flat key caps: solid fills, no border, no glow, a hard edge underneath.110    private static func flat(id: String, name: String, isDark: Bool, backdrop: [String], letter: String, function: String,111                             text: String, functionText: String? = nil, accent: String, accentText: String,112                             corner: Double = 6, typeface: KeyTypeface = .system) -> Theme {113        let edge = RGBA(isDark ? "#000000" : "#000000")114        func style(_ fill: String, _ label: String) -> KeyStyle {115            KeyStyle(fill: .solid(RGBA(fill)), text: RGBA(label), border: edge.opacity(0), glow: .clear)116        }117        return Theme(118            id: id, name: name, isDark: isDark,119            background: GradientSpec(backdrop.map { RGBA($0) }, angle: 90), effect: .none, effectColors: [],120            letterKey: style(letter, text), functionKey: style(function, functionText ?? text), accentKey: style(accent, accentText),121            pressedTint: RGBA(isDark ? "#FFFFFF2B" : "#00000024"), suggestionText: RGBA(text),122            metrics: ThemeMetrics(cornerRadius: corner, spacing: 6, glowIntensity: 0, borderWidth: 0, depth: isDark ? 0.75 : 0.55),123            motion: .off, haptic: .light, typeface: typeface)124    }125126    public static let atelierClair = flat(127        id: "atelier-clair", name: "Atelier Clair", isDark: false, backdrop: ["#DDDAD3", "#D5D2CA"],128        letter: "#FCFBF8", function: "#BEBAB1", text: "#1B1A17", accent: "#1D2B3A", accentText: "#F6F3EC")129130    public static let atelierNuit = flat(131        id: "atelier-nuit", name: "Atelier Nuit", isDark: true, backdrop: ["#1B1A18", "#161513"],132        letter: "#3B3935", function: "#272623", text: "#F4F1EA", accent: "#ECE7DB", accentText: "#171614")133134    public static let craie = flat(135        id: "craie", name: "Craie", isDark: false, backdrop: ["#DFE3E6", "#D6DBDF"],136        letter: "#FFFFFF", function: "#B5BDC4", text: "#151A1F", accent: "#1B4F9E", accentText: "#FFFFFF")137138    public static let ardoise = flat(139        id: "ardoise", name: "Ardoise", isDark: true, backdrop: ["#1D2227", "#181C21"],140        letter: "#343D47", function: "#252C33", text: "#EEF2F5", accent: "#9DBFE0", accentText: "#10161C")141142    public static let sable = flat(143        id: "sable", name: "Sable", isDark: false, backdrop: ["#E8DFCF", "#E0D5C2"],144        letter: "#FCF8EF", function: "#CEC0A8", text: "#2B2218", accent: "#8A3A17", accentText: "#FFF6EC",145        corner: 8, typeface: .serif)146147    public static let sapin = flat(148        id: "sapin", name: "Sapin", isDark: true, backdrop: ["#121C18", "#0E1613"],149        letter: "#25352D", function: "#18241F", text: "#EDF1EA", accent: "#D9C48C", accentText: "#131A16",150        corner: 7)151152    public static func theme(id: String) -> Theme? { all.first { $0.id == id } }153154    /// Translucent "glass" key over a dark backdrop.155    private static func glass(_ top: String, _ bottom: String, text: String = "#FFFFFF", border: String, glow: String) -> KeyStyle {156        KeyStyle(fill: GradientSpec([RGBA(top), RGBA(bottom)]), text: RGBA(text), border: RGBA(border), glow: RGBA(glow))157    }158159    public static let aurora = Theme(160        id: "aurora-sp", name: "Aurora SP", isDark: true,161        background: GradientSpec([RGBA("#041019"), RGBA("#0B1E3A"), RGBA("#1A1040"), RGBA("#06231F")], angle: 115),162        effect: .aurora,163        effectColors: [RGBA("#22E6F0"), RGBA("#8B5CF6"), RGBA("#F472B6"), RGBA("#34D399")],164        letterKey: glass("#FFFFFF2E", "#FFFFFF14", border: "#9BE8FF8C", glow: "#22E6F0"),165        functionKey: glass("#8B5CF63D", "#22E6F01F", border: "#C4B5FD80", glow: "#8B5CF6"),166        accentKey: KeyStyle(fill: GradientSpec([RGBA("#22E6F0"), RGBA("#8B5CF6"), RGBA("#F472B6")], angle: 20),167                            text: RGBA("#04121C"), border: RGBA("#FFFFFFB3"), glow: RGBA("#F472B6")),168        pressedTint: RGBA("#FFFFFF59"), suggestionText: RGBA("#EAFBFF"),169        rowTints: [RGBA("#22E6F0"), RGBA("#8B5CF6"), RGBA("#F472B6"), RGBA("#34D399")],170        metrics: ThemeMetrics(cornerRadius: 10, glowIntensity: 0.7), motion: .full)171172    public static let cyberpunk = Theme(173        id: "cyberpunk", name: "Cyberpunk", isDark: true,174        background: GradientSpec([RGBA("#05020C"), RGBA("#12021F"), RGBA("#020A1F")], angle: 100),175        effect: .neon,176        effectColors: [RGBA("#FF2BD6"), RGBA("#00B3FF"), RGBA("#7A00FF")],177        letterKey: glass("#14081FE6", "#0A0414E6", text: "#F6E9FF", border: "#FF2BD6", glow: "#FF2BD6"),178        functionKey: glass("#06122BE6", "#040A1CE6", text: "#BFE9FF", border: "#00B3FF", glow: "#00B3FF"),179        accentKey: KeyStyle(fill: GradientSpec([RGBA("#FF2BD6"), RGBA("#00B3FF")], angle: 0),180                            text: RGBA("#05020C"), border: RGBA("#FFFFFF"), glow: RGBA("#00B3FF")),181        pressedTint: RGBA("#FF2BD666"), suggestionText: RGBA("#F6E9FF"),182        rowTints: [RGBA("#FF2BD6"), RGBA("#B455FF"), RGBA("#00B3FF")],183        metrics: ThemeMetrics(cornerRadius: 5, glowIntensity: 0.9, borderWidth: 1.4))184185    public static let solarFlare = Theme(186        id: "solar-flare", name: "Solar Flare", isDark: true,187        background: GradientSpec([RGBA("#2A0703"), RGBA("#7A1705"), RGBA("#C2410C"), RGBA("#F59E0B")], angle: 70),188        effect: .plasma,189        effectColors: [RGBA("#FF6A00"), RGBA("#FF1E00"), RGBA("#FFD166")],190        letterKey: glass("#2A0A04C7", "#1A0502C7", text: "#FFF4DC", border: "#FFB347A6", glow: "#FF8A00"),191        functionKey: glass("#5A1206C7", "#3A0A03C7", text: "#FFE2B0", border: "#FF6A00A6", glow: "#FF3D00"),192        accentKey: KeyStyle(fill: GradientSpec([RGBA("#FFD166"), RGBA("#FF8A00"), RGBA("#FF3D00")], angle: 60),193                            text: RGBA("#2A0703"), border: RGBA("#FFF4DC"), glow: RGBA("#FFD166")),194        pressedTint: RGBA("#FFD16666"), suggestionText: RGBA("#FFF4DC"),195        metrics: ThemeMetrics(cornerRadius: 11, glowIntensity: 0.75), motion: .full)196197    public static let oceanPulse = Theme(198        id: "ocean-pulse", name: "Ocean Pulse", isDark: true,199        background: GradientSpec([RGBA("#021B2E"), RGBA("#053B5C"), RGBA("#0A6C7F"), RGBA("#0FB5A6")], angle: 95),200        effect: .waves,201        effectColors: [RGBA("#2DD4BF"), RGBA("#38BDF8"), RGBA("#0E7490")],202        letterKey: glass("#FFFFFF2B", "#FFFFFF12", text: "#F0FDFF", border: "#7DE3F299", glow: "#2DD4BF"),203        functionKey: glass("#03283FB8", "#021B2EB8", text: "#C8F4FF", border: "#38BDF880", glow: "#38BDF8"),204        accentKey: KeyStyle(fill: GradientSpec([RGBA("#2DD4BF"), RGBA("#38BDF8")], angle: 30),205                            text: RGBA("#021B2E"), border: RGBA("#E0FBFF"), glow: RGBA("#2DD4BF")),206        pressedTint: RGBA("#7DE3F266"), suggestionText: RGBA("#F0FDFF"),207        metrics: ThemeMetrics(cornerRadius: 13, glowIntensity: 0.5), motion: .full)208209    public static let galaxy = Theme(210        id: "galaxy", name: "Galaxy", isDark: true,211        background: GradientSpec([RGBA("#05040F"), RGBA("#12103A"), RGBA("#2A1658"), RGBA("#0A0820")], angle: 125),212        effect: .stars,213        effectColors: [RGBA("#E5E7EB"), RGBA("#A78BFA"), RGBA("#6366F1")],214        letterKey: glass("#FFFFFF24", "#FFFFFF0F", text: "#F3F1FF", border: "#C7C9D980", glow: "#A78BFA"),215        functionKey: glass("#6366F138", "#4338CA24", text: "#DCD8FF", border: "#A78BFA73", glow: "#6366F1"),216        accentKey: KeyStyle(fill: GradientSpec([RGBA("#E5E7EB"), RGBA("#A78BFA"), RGBA("#6366F1")], angle: 40),217                            text: RGBA("#0A0820"), border: RGBA("#FFFFFF"), glow: RGBA("#A78BFA")),218        pressedTint: RGBA("#E5E7EB4D"), suggestionText: RGBA("#F3F1FF"),219        metrics: ThemeMetrics(cornerRadius: 9, glowIntensity: 0.45))220221    public static let rainbowPrism = Theme(222        id: "rainbow-prism", name: "Rainbow Prism", isDark: true,223        background: GradientSpec([RGBA("#3B0A45"), RGBA("#1E1B6B"), RGBA("#0B4F6C"), RGBA("#14532D"), RGBA("#7C2D12")], angle: 0),224        effect: .iridescence,225        effectColors: [RGBA("#FF3B6B"), RGBA("#FF9F1C"), RGBA("#FFE066"), RGBA("#2EE59D"), RGBA("#3B9BFF"), RGBA("#A259FF")],226        letterKey: glass("#0B0B14B3", "#0B0B1499", text: "#FFFFFF", border: "#FFFFFF8C", glow: "#FFFFFF"),227        functionKey: glass("#0B0B14D1", "#0B0B14B8", text: "#F2F2F7", border: "#FFFFFF59", glow: "#A259FF"),228        accentKey: KeyStyle(fill: GradientSpec([RGBA("#FF3B6B"), RGBA("#FF9F1C"), RGBA("#FFE066"), RGBA("#2EE59D"), RGBA("#3B9BFF"), RGBA("#A259FF")], angle: 0),229                            text: RGBA("#0B0B14"), border: RGBA("#FFFFFF"), glow: RGBA("#FFE066")),230        pressedTint: RGBA("#FFFFFF59"), suggestionText: RGBA("#FFFFFF"),231        rowTints: [RGBA("#FF3B6B"), RGBA("#FFE066"), RGBA("#2EE59D"), RGBA("#3B9BFF")],232        metrics: ThemeMetrics(cornerRadius: 10, glowIntensity: 0.65, borderWidth: 1.2), motion: .full)233234    public static let candyGlass = Theme(235        id: "candy-glass", name: "Candy Glass", isDark: false,236        background: GradientSpec([RGBA("#FFD6E8"), RGBA("#E3D5FF"), RGBA("#C9F5E4")], angle: 120),237        effect: .glass,238        effectColors: [RGBA("#FF9CC8"), RGBA("#B9A5FF"), RGBA("#9BEBCB")],239        letterKey: glass("#FFFFFFD1", "#FFFFFF9E", text: "#3A2A4D", border: "#FFFFFFE6", glow: "#FF9CC8"),240        functionKey: glass("#F3E8FFC7", "#E3D5FFA6", text: "#4A3566", border: "#FFFFFFCC", glow: "#B9A5FF"),241        accentKey: KeyStyle(fill: GradientSpec([RGBA("#FF8FC0"), RGBA("#B9A5FF")], angle: 25),242                            text: RGBA("#2B1740"), border: RGBA("#FFFFFF"), glow: RGBA("#FF8FC0")),243        pressedTint: RGBA("#FF9CC866"), suggestionText: RGBA("#3A2A4D"),244        metrics: ThemeMetrics(cornerRadius: 14, glowIntensity: 0.35))245246    public static let toxicLime = Theme(247        id: "toxic-lime", name: "Toxic Lime", isDark: true,248        background: GradientSpec([RGBA("#0E1110"), RGBA("#171C19"), RGBA("#10140F")], angle: 90),249        effect: .energy,250        effectColors: [RGBA("#B6FF00"), RGBA("#5CFF3B"), RGBA("#E9FF70")],251        letterKey: glass("#222824F2", "#191E1BF2", text: "#E9FF70", border: "#B6FF0099", glow: "#B6FF00"),252        functionKey: glass("#2D352FF2", "#222824F2", text: "#C9F56A", border: "#5CFF3B73", glow: "#5CFF3B"),253        accentKey: KeyStyle(fill: GradientSpec([RGBA("#E9FF70"), RGBA("#B6FF00")], angle: 90),254                            text: RGBA("#10140F"), border: RGBA("#F6FFC2"), glow: RGBA("#B6FF00")),255        pressedTint: RGBA("#B6FF0066"), suggestionText: RGBA("#E9FF70"),256        metrics: ThemeMetrics(cornerRadius: 6, glowIntensity: 0.8, borderWidth: 1.2))257258    public static let arcticIce = Theme(259        id: "arctic-ice", name: "Arctic Ice", isDark: false,260        background: GradientSpec([RGBA("#F4FBFF"), RGBA("#D9F2FB"), RGBA("#B8E6F5")], angle: 100),261        effect: .crystal,262        effectColors: [RGBA("#FFFFFF"), RGBA("#7DD3FC"), RGBA("#22D3EE")],263        letterKey: glass("#FFFFFFF0", "#F0FAFFD9", text: "#0B3A4D", border: "#7DD3FCB3", glow: "#22D3EE"),264        functionKey: glass("#CDEEFAE6", "#B8E6F5CC", text: "#0B3A4D", border: "#FFFFFFD9", glow: "#7DD3FC"),265        accentKey: KeyStyle(fill: GradientSpec([RGBA("#22D3EE"), RGBA("#7DD3FC")], angle: 45),266                            text: RGBA("#052B3A"), border: RGBA("#FFFFFF"), glow: RGBA("#22D3EE")),267        pressedTint: RGBA("#22D3EE59"), suggestionText: RGBA("#0B3A4D"),268        metrics: ThemeMetrics(cornerRadius: 8, glowIntensity: 0.4))269270    public static let midnightLuxe = Theme(271        id: "midnight-luxe", name: "Midnight Luxe", isDark: true,272        background: GradientSpec([RGBA("#050507"), RGBA("#0E0A18"), RGBA("#050507")], angle: 90),273        effect: .luxe,274        effectColors: [RGBA("#D4AF37"), RGBA("#6D28D9"), RGBA("#F5E6A8")],275        letterKey: glass("#16131FF5", "#0D0B14F5", text: "#F5E6A8", border: "#D4AF3780", glow: "#D4AF37"),276        functionKey: glass("#1D1630F5", "#120E20F5", text: "#D9C8FF", border: "#6D28D999", glow: "#6D28D9"),277        accentKey: KeyStyle(fill: GradientSpec([RGBA("#F5E6A8"), RGBA("#D4AF37"), RGBA("#A8842A")], angle: 70),278                            text: RGBA("#0D0B14"), border: RGBA("#FFF7D6"), glow: RGBA("#D4AF37")),279        pressedTint: RGBA("#D4AF3759"), suggestionText: RGBA("#F5E6A8"),280        metrics: ThemeMetrics(cornerRadius: 8, glowIntensity: 0.4, borderWidth: 0.8))281282    public static let lava = Theme(283        id: "lava", name: "Lava", isDark: true,284        background: GradientSpec([RGBA("#0B0606"), RGBA("#2B0A06"), RGBA("#0B0606")], angle: 90),285        effect: .heat,286        effectColors: [RGBA("#FF2D00"), RGBA("#FFB000"), RGBA("#7A0C00")],287        letterKey: glass("#1A1010F2", "#0F0909F2", text: "#FFD9A0", border: "#FF4A1A99", glow: "#FF2D00"),288        functionKey: glass("#2A1210F2", "#1A0C0AF2", text: "#FFC27A", border: "#FFB00073", glow: "#FFB000"),289        accentKey: KeyStyle(fill: GradientSpec([RGBA("#FFB000"), RGBA("#FF2D00")], angle: 90),290                            text: RGBA("#160606"), border: RGBA("#FFE3B3"), glow: RGBA("#FF2D00")),291        pressedTint: RGBA("#FF2D0066"), suggestionText: RGBA("#FFD9A0"),292        metrics: ThemeMetrics(cornerRadius: 10, glowIntensity: 0.7), motion: .full)293294    public static let monochrome = Theme(295        id: "monochrome", name: "Monochrome", isDark: true,296        background: .solid(RGBA("#000000")),297        effect: .none,298        effectColors: [],299        letterKey: KeyStyle(fill: .solid(RGBA("#1C1C1E")), text: RGBA("#FFFFFF"), border: RGBA("#3A3A3C"), glow: .clear),300        functionKey: KeyStyle(fill: .solid(RGBA("#2C2C2E")), text: RGBA("#FFFFFF"), border: RGBA("#48484A"), glow: .clear),301        accentKey: KeyStyle(fill: .solid(RGBA("#FFFFFF")), text: RGBA("#000000"), border: RGBA("#FFFFFF"), glow: .clear),302        pressedTint: RGBA("#FFFFFF40"), suggestionText: RGBA("#FFFFFF"),303        metrics: ThemeMetrics(cornerRadius: 6, glowIntensity: 0, borderWidth: 0.5, depth: 0), motion: .off)304}305
Files main
Menu

Theme