Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Lou-Ka iOS9// File : LouKa/Design/Theme.swift10// Description : jetons du Lou-Ka Design System V3 (« chaleur11// architecturale ») : ivoire, charbon, forêt, terracotta,12// sauge, blanc chaleureux ; verdicts pétrole, pierre, ocre.13// Deux thèmes : clair chaleureux (par défaut) et sombre14// charbon. Aucun dégradé décoratif.15// Module : LouKa16// Repository : https://git.spboucher.ai/lou-ka-ios-v317// Project Website : https://www.lou-ka.com18// Created : 2026-11-2519// Last Modified : 2026-11-2820//21// =============================================================================22// AUTHOR & PROFESSIONAL AFFILIATION23// =============================================================================24//25// Author : Simon-Pierre Boucher26// Position : Professor of Finance27// Institution : Université du Québec en Outaouais (UQO)28// Department : Département des sciences administratives29// Organization : SP Boucher30//31// Website : https://spboucher.ai32// Git : https://git.spboucher.ai33//34// =============================================================================35// OFFICIAL CONTACT DIRECTORY36// =============================================================================37//38// General : info@spboucher.ai39// Professional : contact@spboucher.ai40// Direct : simon@spboucher.ai41// Research : research@spboucher.ai42// Development : dev@spboucher.ai43// Support : support@spboucher.ai44// Security/Admin : admin@spboucher.ai45// Notifications : notifications@spboucher.ai46//47// Preferred Contact: support@spboucher.ai48//49// =============================================================================50// COPYRIGHT & INTELLECTUAL PROPERTY51// =============================================================================52//53// Copyright (c) 202654// Simon-Pierre Boucher55//56// All rights reserved where applicable.57//58// This file is governed by the applicable project license,59// copyright notices, institutional agreements and relevant law.60//61// Unless expressly authorized by the applicable license or62// rights holder, copying, redistribution, sublicensing,63// publication and commercial exploitation are not permitted.64//65// Existing third-party rights and notices remain unaffected.66//67// =============================================================================68// CONFIDENTIALITY & SECURITY69// =============================================================================70//71// Classification : Public72// Distribution : Public repository; use is governed by the project license73// Security Contact : admin@spboucher.ai74//75// Access to this source does not independently grant permission76// to redistribute or disclose confidential materials.77//78// Do not embed credentials, private keys, access tokens,79// certificates or confidential personal information.80//81// =============================================================================82// LICENSE & MAINTENANCE83// =============================================================================84//85// License : None specified (no license file in this repository)86// Maintainer : Simon-Pierre Boucher87// Technical Contact: dev@spboucher.ai88//89// =============================================================================90// END OF SP BOUCHER SOURCE HEADER91// =============================================================================9293import SwiftUI94import UIKit9596extension Color {97 /// Couleur adaptative à partir de deux valeurs hexadécimales (clair, sombre).98 init(light: UInt32, dark: UInt32, lightAlpha: Double = 1, darkAlpha: Double = 1) {99 self.init(uiColor: UIColor { trait in100 let (hex, a) = trait.userInterfaceStyle == .dark ? (dark, darkAlpha) : (light, lightAlpha)101 return UIColor(red: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255,102 blue: CGFloat(hex & 0xFF) / 255, alpha: a)103 })104 }105106 init(hex: UInt32, alpha: Double = 1) {107 self.init(.sRGB, red: Double((hex >> 16) & 0xFF) / 255, green: Double((hex >> 8) & 0xFF) / 255,108 blue: Double(hex & 0xFF) / 255, opacity: alpha)109 }110}111112enum Theme {113 // --- Palette de marque (valeurs fixes) ---------------------------------------114 static let forest = Color(hex: 0x245B48) // accent principal115 static let deepForest = Color(hex: 0x183D32) // états actifs116 static let ivory = Color(hex: 0xF7F6F0) // fond clair117 static let paper = Color(hex: 0xFFFFFF) // surfaces118 static let charcoal = Color(hex: 0x181C1A) // texte119 static let stone = Color(hex: 0x737B75) // texte secondaire120 static let sage = Color(hex: 0xDDEAE2) // surfaces secondaires121 static let heritageOrange = Color(hex: 0xE96B32) // accent historique : cadre de la porte, sélection122 static let border = Color(hex: 0xE3E6E1)123 static let nightBase = Color(hex: 0x111815) // fond sombre124125 // --- Jetons sémantiques (clair / sombre), miroir de `frontend/src/styles/tokens.css` du Design System V3 ---126 static let bg = Color(light: 0xF7F6F0, dark: 0x111815) // --bg : ivoire architectural127 static let bg2 = Color(light: 0xF0EFE7, dark: 0x0C120F) // --bg-2 : fond en retrait128 static let surface = Color(light: 0xFFFEFB, dark: 0x18201C) // --surface : blanc chaleureux129 static let surface2 = Color(light: 0xF1F0E8, dark: 0x1F2924) // --surface-2 : aplat neutre130 static let surface3 = Color(light: 0xE6E5DB, dark: 0x29342F) // --surface-3 : aplat appuyé131 static let ink = Color(light: 0x181C1A, dark: 0xF1F3EE)132 static let ink2 = Color(light: 0x454D48, dark: 0xB9C1BA)133 static let ink3 = Color(light: 0x5C645E, dark: 0x97A199) // AA sur toutes les surfaces134 static let line = Color(light: 0xE3E4DC, dark: 0x262F2A)135 static let line2 = Color(light: 0xC9CDC3, dark: 0x3A4640)136 static let lineControl = Color(light: 0x7C837C, dark: 0x76827A) // contour d'un contrôle : 3:1137138 /// Action principale : vert forêt ; éclairci en thème sombre pour rester lisible sur le charbon.139 static let brand = Color(light: 0x245B48, dark: 0x86C2A4)140 static let brandStrong = Color(light: 0x183D32, dark: 0xA3D3BA)141 static let brandInk = Color(light: 0xFFFFFF, dark: 0x0E1813)142 static let brandSoft = Color(light: 0xDDEAE2, dark: 0x1D3229) // sauge : sélection douce143144 /// Terracotta du chambranle (aplats et traits seulement) ; `accentUI` porte du blanc, `accentText` s'écrit.145 static let accent = Color(light: 0xE96B32, dark: 0xEE7C48)146 static let accentUI = Color(light: 0xC4501B, dark: 0xC24E19)147 static let accentText = Color(light: 0xA8410F, dark: 0xF39468)148 static let accentSoft = Color(light: 0xFBE7DB, dark: 0x3A2418)149 /// Battant de la porte : charbon en thème clair, ivoire en thème sombre (le chambranle reste terracotta).150 static let doorPanel = Color(light: 0x181C1A, dark: 0xF1F3EE)151 /// Intérieur de la porte quand aucune photographie n'existe : plâtre chaud.152 static let doorInterior = Color(light: 0xF3E3D2, dark: 0x2A2219)153154 // --- Verdicts de prix : toujours doublés d'un glyphe et d'un libellé. « Sous » ne partage plus la couleur155 // de l'action principale (pétrole), « dans » est pierre, « au-dessus » ocre.156 static let good = Color(light: 0x17686B, dark: 0x7CC4C2)157 static let goodSoft = Color(light: 0xD9EBEA, dark: 0x17302F)158 static let fair = Color(light: 0x565E59, dark: 0xA9B2AB)159 static let fairSoft = Color(light: 0xECEDE7, dark: 0x232C27)160 static let high = Color(light: 0x8A570C, dark: 0xD9A85C)161 static let highSoft = Color(light: 0xF3E7CF, dark: 0x33291A)162 static let bad = Color(light: 0xA8362B, dark: 0xE58A7C)163 static let badSoft = Color(light: 0xF6DFDB, dark: 0x3A211D)164 static let info = Color(light: 0x2F5F8F, dark: 0x8FB6DC)165166 // --- Données : catégorielle aux luminances étagées, séquentielle forêt167 static let data1 = brand168 static let data2 = accentUI169 static let data3 = info170 static let dataGrid = Color(light: 0xDCDED5, dark: 0x2A342E)171 static let dataEstimate = high172173 /// Cœur des favoris : orange historique (la sélection).174 static let heart = accentUI175176 // rayons du Design System V3 : étiquette 4 · contrôle 8 · surface 10 ; grands panneaux natifs 14177 static let radius: CGFloat = 10178 static let radiusSmall: CGFloat = 8179 static let radiusTag: CGFloat = 4180 static let radiusPanel: CGFloat = 14181182 // durées du Motion System V3, en secondes183 static let durTap = 0.10, durMicro = 0.15, durStd = 0.24, durEnter = 0.26, durSlow = 0.42, durDraw = 0.70184185 static func color(for verdict: Verdict?) -> Color {186 switch verdict {187 case .sous: good188 case .marche: fair189 case .sur: high190 case nil: ink3191 }192 }193194 static func softColor(for verdict: Verdict?) -> Color {195 switch verdict {196 case .sous: goodSoft197 case .marche: fairSoft198 case .sur: highSoft199 case nil: surface2200 }201 }202203 /// Couleur d'un score de quartier : du vert forêt (excellent) à la brique (faible), sans arc-en-ciel.204 static func scoreColor(_ s: Double?) -> Color {205 guard let s else { return ink3 }206 if s >= 70 { return brand }207 if s >= 50 { return Color(light: 0x5E8F7A, dark: 0x5E9A82) }208 if s >= 35 { return high }209 return bad210 }211}212213extension Font {214 /// Chiffres et libellés d'interface en grand : SF Pro.215 static func display(_ size: CGFloat, weight: Font.Weight = .semibold) -> Font {216 .system(size: size, weight: weight, design: .default)217 }218219 /// Titres éditoriaux : New York (serif système), romain, graisse 500.220 static func editorial(_ size: CGFloat, weight: Font.Weight = .medium) -> Font {221 .system(size: size, weight: weight, design: .serif)222 }223}224225extension View {226 /// Carte : surface, filet, coins mesurés.227 func cardStyle(padding: CGFloat = 18, radius: CGFloat = Theme.radius) -> some View {228 self.padding(padding)229 .background(Theme.surface, in: RoundedRectangle(cornerRadius: radius, style: .continuous))230 .overlay(RoundedRectangle(cornerRadius: radius, style: .continuous).strokeBorder(Theme.line, lineWidth: 1))231 }232233 /// Sur-titre en petites capitales espacées.234 func eyebrowStyle() -> some View {235 self.font(.caption2.weight(.semibold)).tracking(1.2).textCase(.uppercase).foregroundStyle(Theme.ink3)236 }237238 /// Chiffres tabulaires.239 func num() -> some View { self.monospacedDigit() }240241 /// Fond opaque d'un contrôle posé sur la carte ou sur une photo (pas de verre décoratif).242 func solidControl<S: InsettableShape>(_ shape: S) -> some View {243 self.background(Theme.surface, in: shape)244 .overlay(shape.strokeBorder(Theme.line2, lineWidth: 1))245 .shadow(color: .black.opacity(0.10), radius: 5, y: 2)246 }247}248