Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Immo-Ka iOS9// File : ImmoKa/Design/Theme.swift10// Description : jetons de design — identité « la maison et sa porte » :11// ardoise, chaux, charbon, rouge de la porte. Deux thèmes :12// clair (chaux, par défaut) et sombre (nuit). Aucun dégradé13// décoratif.14// Module : ImmoKa15// Repository : https://git.spboucher.ai/immo-ka-ios-v316// Project Website : https://www.immo-ka.com17// Created : 2026-11-2518// Last Modified : 2026-11-3019//20// =============================================================================21// AUTHOR & PROFESSIONAL AFFILIATION22// =============================================================================23//24// Author : Simon-Pierre Boucher25// Position : Professor of Finance26// Institution : Université du Québec en Outaouais (UQO)27// Department : Département des sciences administratives28// Organization : SP Boucher29//30// Website : https://spboucher.ai31// Git : https://git.spboucher.ai32//33// =============================================================================34// OFFICIAL CONTACT DIRECTORY35// =============================================================================36//37// General : info@spboucher.ai38// Professional : contact@spboucher.ai39// Direct : simon@spboucher.ai40// Research : research@spboucher.ai41// Development : dev@spboucher.ai42// Support : support@spboucher.ai43// Security/Admin : admin@spboucher.ai44// Notifications : notifications@spboucher.ai45//46// Preferred Contact: support@spboucher.ai47//48// =============================================================================49// COPYRIGHT & INTELLECTUAL PROPERTY50// =============================================================================51//52// Copyright (c) 202653// Simon-Pierre Boucher54//55// All rights reserved where applicable.56//57// This file is governed by the applicable project license,58// copyright notices, institutional agreements and relevant law.59//60// Unless expressly authorized by the applicable license or61// rights holder, copying, redistribution, sublicensing,62// publication and commercial exploitation are not permitted.63//64// Existing third-party rights and notices remain unaffected.65//66// =============================================================================67// CONFIDENTIALITY & SECURITY68// =============================================================================69//70// Classification : Public71// Distribution : Public repository; use is governed by the project license72// Security Contact : admin@spboucher.ai73//74// Access to this source does not independently grant permission75// to redistribute or disclose confidential materials.76//77// Do not embed credentials, private keys, access tokens,78// certificates or confidential personal information.79//80// =============================================================================81// LICENSE & MAINTENANCE82// =============================================================================83//84// License : None specified (no license file in this repository)85// Maintainer : Simon-Pierre Boucher86// Technical Contact: dev@spboucher.ai87//88// =============================================================================89// END OF SP BOUCHER SOURCE HEADER90// =============================================================================9192import SwiftUI93import UIKit9495extension Color {96 /// Couleur adaptative à partir de deux valeurs hexadécimales (clair, sombre).97 init(light: UInt32, dark: UInt32, lightAlpha: Double = 1, darkAlpha: Double = 1) {98 self.init(uiColor: UIColor { trait in99 let (hex, a) = trait.userInterfaceStyle == .dark ? (dark, darkAlpha) : (light, lightAlpha)100 return UIColor(red: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255,101 blue: CGFloat(hex & 0xFF) / 255, alpha: a)102 })103 }104105 init(hex: UInt32, alpha: Double = 1) {106 self.init(.sRGB, red: Double((hex >> 16) & 0xFF) / 255, green: Double((hex >> 8) & 0xFF) / 255,107 blue: Double(hex & 0xFF) / 255, opacity: alpha)108 }109}110111enum Theme {112 // --- Palette de marque (valeurs fixes) : « la maison et sa porte » ---------------113 static let slate = Color(hex: 0x2B4A63) // ardoise : action principale114 static let deepSlate = Color(hex: 0x1D3549) // ardoise profonde : états actifs115 static let chalk = Color(hex: 0xF6F3EC) // chaux : fond clair116 static let paper = Color(hex: 0xFFFFFF) // surfaces117 static let charcoal = Color(hex: 0x1B1D22) // charbon : texte, silhouette de la maison118 static let stone = Color(hex: 0x686B73) // pierre : texte secondaire119 static let doorRed = Color(hex: 0xD12C37) // rouge de la porte : l'héritage d'Immo-Ka120 static let brass = Color(hex: 0xD2AC62) // laiton : béquille de la porte121 static let nightBase = Color(hex: 0x14161A) // nuit : fond sombre122123 // --- Jetons sémantiques (clair / sombre) ---------------------------------------124 static let bg = Color(light: 0xF6F3EC, dark: 0x14161A)125 static let bg2 = Color(light: 0xEFEBE2, dark: 0x0F1114)126 static let surface = Color(light: 0xFFFEFC, dark: 0x1B1E23)127 static let surface2 = Color(light: 0xF1EEE6, dark: 0x23272D)128 static let surface3 = Color(light: 0xE6E2D8, dark: 0x2D3239)129 static let ink = Color(light: 0x1B1D22, dark: 0xF2EFE8)130 static let ink2 = Color(light: 0x474A52, dark: 0xBDBBB4)131 static let ink3 = Color(light: 0x5D6068, dark: 0x9DA0A8)132 static let line = Color(light: 0xE4E0D6, dark: 0x282C32)133 static let line2 = Color(light: 0xCFCABE, dark: 0x3A3F47)134 /// contour d'un champ ou d'une case : 3:1 sur les surfaces135 static let lineControl = Color(light: 0x827E74, dark: 0x7C818B)136 /// laiton en texte (estimations)137 static let brassStrong = Color(light: 0x7D5A14, dark: 0xD9B56A)138 /// Action principale : ardoise ; éclaircie en thème sombre pour rester lisible sur la nuit.139 static let brand = Color(light: 0x2B4A63, dark: 0x9DBEDA)140 static let brandStrong = Color(light: 0x1D3549, dark: 0xB9D2E6)141 static let brandInk = Color(light: 0xFFFFFF, dark: 0x10161C)142 static let brandSoft = Color(light: 0xDEE6EC, dark: 0x1D2A36)143 /// Rouge de la porte : avec parcimonie (battant, sélection, cœur des favoris, « Ka » du logotype).144 static let accent = Color(light: 0xD12C37, dark: 0xD8363F)145 static let accentStrong = Color(light: 0xB5252F, dark: 0xF0777B)146 static let accentSoft = Color(light: 0xFAE1DF, dark: 0x3A1C1E)147 /// Silhouette de la maison : charbon en thème clair, chaux en thème sombre.148 static let house = Color(light: 0x1B1D22, dark: 0xF2EFE8)149 /// Battant de la porte.150 static let door = Color(light: 0xD12C37, dark: 0xE04A52)151 static let doorInterior = Color(light: 0xECE4D3, dark: 0x2C2823)152153 // --- Positions du prix demandé (v3 : sous, dans, au-dessus de l'intervalle) --------------------------------------------------------154 static let good = Color(light: 0x2C6A4C, dark: 0x8FC7A8)155 static let goodSoft = Color(light: 0xDCEBE2, dark: 0x1C3127)156 static let fair = Color(light: 0x585B63, dark: 0xA9ABB2)157 static let fairSoft = Color(light: 0xECEBE5, dark: 0x25282D)158 static let high = Color(light: 0x855608, dark: 0xD9A85C)159 static let highSoft = Color(light: 0xF3E7CF, dark: 0x33291A)160 static let bad = Color(light: 0xA3312A, dark: 0xEC8F84)161 static let badSoft = Color(light: 0xF6DFDB, dark: 0x3A211D)162 /// Cœur des favoris : le rouge de la porte (la sélection).163 static let heart = accent164165 // rayons du système v3, plus nets : étiquettes 4 · boutons et champs 8 · cartes et photos 10 · grands panneaux 12166 static let radius: CGFloat = 10167 static let radiusSmall: CGFloat = 8168 static let radiusTag: CGFloat = 4169 static let radiusPanel: CGFloat = 12170171 static func color(for verdict: Verdict?) -> Color {172 switch verdict {173 case .sous: good174 case .marche: fair175 case .sur: high176 case nil: ink3177 }178 }179180 static func softColor(for verdict: Verdict?) -> Color {181 switch verdict {182 case .sous: goodSoft183 case .marche: fairSoft184 case .sur: highSoft185 case nil: surface2186 }187 }188}189190extension Font {191 /// Chiffres et libellés d'interface en grand : SF Pro. La taille suit Dynamic Type.192 static func display(_ size: CGFloat, weight: Font.Weight = .semibold) -> Font {193 .system(size: scaled(size), weight: weight, design: .default)194 }195196 /// Titres éditoriaux : New York (serif système), romain, graisse 500. La taille suit Dynamic Type.197 static func editorial(_ size: CGFloat, weight: Font.Weight = .medium) -> Font {198 .system(size: scaled(size), weight: weight, design: .serif)199 }200201 /// Taille mise à l'échelle du réglage « Taille du texte », selon la courbe du style système le plus proche :202 /// un grand titre grandit moins vite qu'un corps de texte, comme les styles d'Apple.203 static func scaled(_ size: CGFloat) -> CGFloat {204 let style: UIFont.TextStyle = switch size {205 case 30...: .largeTitle206 case 25..<30: .title1207 case 21..<25: .title2208 case 18..<21: .title3209 default: .body210 }211 return UIFontMetrics(forTextStyle: style).scaledValue(for: size).rounded()212 }213}214215extension View {216 /// Carte : surface, filet, coins mesurés.217 func cardStyle(padding: CGFloat = 18, radius: CGFloat = Theme.radius) -> some View {218 self.padding(padding)219 .background(Theme.surface, in: RoundedRectangle(cornerRadius: radius, style: .continuous))220 .overlay(RoundedRectangle(cornerRadius: radius, style: .continuous).strokeBorder(Theme.line, lineWidth: 1))221 }222223 /// Sur-titre en petites capitales espacées.224 func eyebrowStyle() -> some View {225 self.font(.caption2.weight(.semibold)).tracking(1.2).textCase(.uppercase).foregroundStyle(Theme.ink3)226 }227228 /// Chiffres tabulaires.229 func num() -> some View { self.monospacedDigit() }230231 /// Fond opaque d'un contrôle posé sur la carte ou sur une photo (pas de verre décoratif).232 func solidControl<S: InsettableShape>(_ shape: S) -> some View {233 self.background(Theme.surface, in: shape)234 .overlay(shape.strokeBorder(Theme.line2, lineWidth: 1))235 .shadow(color: .black.opacity(0.12), radius: 6, y: 2)236 }237}238