Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : SP Search iOS9// File : Components/Theme.swift10// Description : Colours and type of the SPSearch identity (the web11// engine's palette), light and dark.12// Module : Components13// Repository : https://git.spboucher.ai/sp-search-ios14// Project Website : https://search.spboucher.ai15// Created : 2026-12-0116// Last Modified : 2026-12-0117//18// =============================================================================19// AUTHOR & PROFESSIONAL AFFILIATION20// =============================================================================21//22// Author : Simon-Pierre Boucher23// Position : Professor of Finance24// Institution : Université du Québec en Outaouais (UQO)25// Department : Département des sciences administratives26// Organization : SP Boucher27//28// Website : https://spboucher.ai29// Git : https://git.spboucher.ai30//31// =============================================================================32// OFFICIAL CONTACT DIRECTORY33// =============================================================================34//35// General : info@spboucher.ai36// Professional : contact@spboucher.ai37// Direct : simon@spboucher.ai38// Research : research@spboucher.ai39// Development : dev@spboucher.ai40// Support : support@spboucher.ai41// Security/Admin : admin@spboucher.ai42// Notifications : notifications@spboucher.ai43//44// Preferred Contact: support@spboucher.ai45//46// =============================================================================47// COPYRIGHT & INTELLECTUAL PROPERTY48// =============================================================================49//50// Copyright (c) 202651// Simon-Pierre Boucher52//53// All rights reserved where applicable.54//55// This file is governed by the applicable project license,56// copyright notices, institutional agreements and relevant law.57//58// Unless expressly authorized by the applicable license or59// rights holder, copying, redistribution, sublicensing,60// publication and commercial exploitation are not permitted.61//62// Existing third-party rights and notices remain unaffected.63//64// =============================================================================65// CONFIDENTIALITY & SECURITY66// =============================================================================67//68// Classification : Public69// Distribution : Public repository; use is governed by the project license70// Security Contact : admin@spboucher.ai71//72// Access to this source does not independently grant permission73// to redistribute or disclose confidential materials.74//75// Do not embed credentials, private keys, access tokens,76// certificates or confidential personal information.77//78// =============================================================================79// LICENSE & MAINTENANCE80// =============================================================================81//82// License : None specified (no license file in this repository)83// Maintainer : Simon-Pierre Boucher84// Technical Contact: dev@spboucher.ai85//86// =============================================================================87// END OF SP BOUCHER SOURCE HEADER88// =============================================================================8990import SwiftUI91import UIKit9293extension UIColor {94 convenience init(hex: UInt32) {95 self.init(red: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255, blue: CGFloat(hex & 0xFF) / 255, alpha: 1)96 }97}9899extension Color {100 init(light: UInt32, dark: UInt32) {101 self.init(uiColor: UIColor { $0.userInterfaceStyle == .dark ? UIColor(hex: dark) : UIColor(hex: light) })102 }103}104105/// Same values as the search site (web/shared-ui/css/base.css and web/search/src/app.css).106enum Theme {107 static let paper = Color(light: 0xF5F3ED, dark: 0x10110F)108 static let raised = Color(light: 0xFFFEFA, dark: 0x1A1B18)109 static let sunk = Color(light: 0xEBE8DF, dark: 0x090A08)110 static let ink = Color(light: 0x16150F, dark: 0xEFEDE6)111 static let muted = Color(light: 0x56544B, dark: 0xA9A79D)112 static let rule = Color(light: 0xD8D4C8, dark: 0x2F302B)113 static let ruleStrong = Color(light: 0x85827A, dark: 0x7C7B71)114 static let accent = Color(light: 0xC0401C, dark: 0xFF8254)115 static let accentSoft = Color(light: 0xFBE5DA, dark: 0x3A1F15)116 static let ok = Color(light: 0x1C6B45, dark: 0x6FC49B)117 static let warn = Color(light: 0x855600, dark: 0xE0B050)118 static let danger = Color(light: 0xA62424, dark: 0xF08A8A)119120 static let corner: CGFloat = 6121 /// Reading column of the results.122 static let column: CGFloat = 760123}124125extension Font {126 /// Display face of the brand: a serif, as the titles of the search site (the system's New York follows Dynamic Type).127 static func display(_ style: Font.TextStyle, weight: Font.Weight = .medium) -> Font { .system(style, design: .serif, weight: weight) }128 /// Small capitals-like label above a group of figures or rows.129 static var eyebrow: Font { .system(.caption2, design: .monospaced, weight: .medium) }130 /// Figures and addresses.131 static func data(_ style: Font.TextStyle = .footnote, weight: Font.Weight = .regular) -> Font { .system(style, design: .monospaced, weight: weight) }132}133134struct Eyebrow: View {135 let text: LocalizedStringKey136 init(_ text: LocalizedStringKey) { self.text = text }137 var body: some View {138 Text(text).font(.eyebrow).textCase(.uppercase).tracking(1).foregroundStyle(Theme.muted)139 .accessibilityAddTraits(.isHeader)140 }141}142143/// Thin horizontal rule.144struct Rule: View {145 var color: Color = Theme.rule146 var body: some View { Rectangle().fill(color).frame(height: 1).accessibilityHidden(true) }147}148