SPB Git

Repository Public

Theme.swift 7.7 KB 196 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : Valo-Plex iOS9// File             : ValoPlex/Design/Theme.swift10// Description      : identité « l'Élévation » : papier à dessin, encre, brique11//                    ; filets d'un point, angles droits, aucune ombre, aucun12//                    dégradé. Couleurs et polices IBM Plex du site.13// Module           : ValoPlex14// Repository       : https://git.spboucher.ai/valo-plex-ios15// Project Website  : https://www.valo-plex.com16// Created          : 2026-12-0117// Last Modified    : 2026-12-0118//19// =============================================================================20// AUTHOR & PROFESSIONAL AFFILIATION21// =============================================================================22//23// Author           : Simon-Pierre Boucher24// Position         : Professor of Finance25// Institution      : Université du Québec en Outaouais (UQO)26// Department       : Département des sciences administratives27// Organization     : SP Boucher28//29// Website          : https://spboucher.ai30// Git              : https://git.spboucher.ai31//32// =============================================================================33// OFFICIAL CONTACT DIRECTORY34// =============================================================================35//36// General          : info@spboucher.ai37// Professional     : contact@spboucher.ai38// Direct           : simon@spboucher.ai39// Research         : research@spboucher.ai40// Development      : dev@spboucher.ai41// Support          : support@spboucher.ai42// Security/Admin   : admin@spboucher.ai43// Notifications    : notifications@spboucher.ai44//45// Preferred Contact: support@spboucher.ai46//47// =============================================================================48// COPYRIGHT & INTELLECTUAL PROPERTY49// =============================================================================50//51// Copyright (c) 202652// Simon-Pierre Boucher53//54// All rights reserved where applicable.55//56// This file is governed by the applicable project license,57// copyright notices, institutional agreements and relevant law.58//59// Unless expressly authorized by the applicable license or60// rights holder, copying, redistribution, sublicensing,61// publication and commercial exploitation are not permitted.62//63// Existing third-party rights and notices remain unaffected.64//65// =============================================================================66// CONFIDENTIALITY & SECURITY67// =============================================================================68//69// Classification   : Public70// Distribution     : Public repository; use is governed by the project license71// Security Contact : admin@spboucher.ai72//73// Access to this source does not independently grant permission74// to redistribute or disclose confidential materials.75//76// Do not embed credentials, private keys, access tokens,77// certificates or confidential personal information.78//79// =============================================================================80// LICENSE & MAINTENANCE81// =============================================================================82//83// License          : None specified (no license file in this repository)84// Maintainer       : Simon-Pierre Boucher85// Technical Contact: dev@spboucher.ai86//87// =============================================================================88// END OF SP BOUCHER SOURCE HEADER89// =============================================================================9091import SwiftUI9293extension Color {94    init(hex: UInt32) {95        self.init(.sRGB, red: Double((hex >> 16) & 0xFF) / 255, green: Double((hex >> 8) & 0xFF) / 255, blue: Double(hex & 0xFF) / 255, opacity: 1)96    }97}9899/// Palette du site (src/app/globals.css). L'application est figée en clair : le papier ne s'inverse pas.100enum VX {101    static let papier = Color(hex: 0xF3EEE4)102    static let papier2 = Color(hex: 0xEAE3D5)103    static let papier3 = Color(hex: 0xDFD6C4)104    static let carton = Color(hex: 0xFBF8F2)105    static let encre = Color(hex: 0x1C1B18)106    static let encre2 = Color(hex: 0x55514A)107    static let encre3 = Color(hex: 0x857F73)108    static let trait = Color(hex: 0xC9BFAE)109    static let brique = Color(hex: 0xA23B2A)110    static let briqueFonce = Color(hex: 0x7A2A1E)111    static let cuivre = Color(hex: 0x2E5E52)112    static let ocre = Color(hex: 0x9A6B12)113    static let avisFond = Color(hex: 0xF6ECD2)114    static let avisTexte = Color(hex: 0x5D4208)115116    // Échelle séquentielle du prix par porte (src/lib/couleurs.ts) : six classes, bornes fixes, comme sur la carte du site.117    static let bornesPorte: [Double] = [150_000, 200_000, 250_000, 325_000, 425_000]118    static let teintesPorte: [UInt32] = [0xE9DCBB, 0xDFB983, 0xD08F55, 0xB85C34, 0x8D3122, 0x4D1811]119    static let libellesPorte = ["moins de 150 k$", "150 à 200 k$", "200 à 250 k$", "250 à 325 k$", "325 à 425 k$", "425 k$ et plus"]120    static let teinteInconnue: UInt32 = 0xB9B2A4121122    static func classePorte(_ pp: Double?) -> Int? {123        guard let pp, pp.isFinite else { return nil }124        return bornesPorte.filter { pp >= $0 }.count125    }126127    static func teintePorte(_ pp: Double?) -> Color {128        Color(hex: classePorte(pp).map { teintesPorte[$0] } ?? teinteInconnue)129    }130131    /// Marge latérale des écrans et largeur de lecture maximale (iPad).132    static let marge: CGFloat = 20133    static let largeur: CGFloat = 760134135    static func confiance(_ c: String?) -> Color {136        switch c {137        case "haute": cuivre138        case "moyenne": ocre139        default: encre2140        }141    }142143    static func position(_ p: String?) -> Color {144        switch p {145        case "sous": cuivre146        case "au-dessus": brique147        default: encre2148        }149    }150151    static func signe(_ v: Double?) -> Color { (v ?? 0) < 0 ? brique : cuivre }152}153154enum Poids {155    case normal, moyen, demiGras156}157158extension Font {159    /// Titres : IBM Plex Serif.160    static func serif(_ taille: CGFloat, _ poids: Poids = .moyen, style: Font.TextStyle = .title2) -> Font {161        let nom = switch poids {162        case .normal: "IBMPlexSerif-Regular"163        case .moyen: "IBMPlexSerif-Medium"164        case .demiGras: "IBMPlexSerif-SemiBold"165        }166        return .custom(nom, size: taille, relativeTo: style)167    }168169    static func serifItalique(_ taille: CGFloat, style: Font.TextStyle = .title2) -> Font {170        .custom("IBMPlexSerif-MediumItalic", size: taille, relativeTo: style)171    }172173    /// Texte courant : IBM Plex Sans.174    static func sans(_ taille: CGFloat = 16, _ poids: Poids = .normal, style: Font.TextStyle = .body) -> Font {175        let nom = switch poids {176        case .normal: "IBMPlexSans"177        case .moyen: "IBMPlexSans-Medm"178        case .demiGras: "IBMPlexSans-SmBld"179        }180        return .custom(nom, size: taille, relativeTo: style)181    }182183    /// Chiffres et étiquettes : IBM Plex Mono, chasse fixe.184    static func mono(_ taille: CGFloat = 14, _ poids: Poids = .normal, style: Font.TextStyle = .callout) -> Font {185        .custom(poids == .normal ? "IBMPlexMono-Regular" : "IBMPlexMono-Medium", size: taille, relativeTo: style)186    }187}188189/// Noms PostScript des polices embarquées (vérifiés par un test : une faute de nom retomberait en silence sur la police du système).190enum Polices {191    static let noms = [192        "IBMPlexSerif-Regular", "IBMPlexSerif-Medium", "IBMPlexSerif-SemiBold", "IBMPlexSerif-MediumItalic",193        "IBMPlexSans", "IBMPlexSans-Medm", "IBMPlexSans-SmBld", "IBMPlexMono-Regular", "IBMPlexMono-Medium",194    ]195}196
Files main
Menu

Theme