Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Sources/SPGlassTokens/GlassMaterialTokens.swift8// Module : SPGlassTokens9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation4243/// The glass variants exposed by the system API (`Glass.regular`, `Glass.clear`).44public enum GlassVariant: String, Codable, CaseIterable, Sendable {45 case regular, clear46}4748/// What a theme may say about Liquid Glass.49///50/// The system owns blur, refraction, lensing and opacity; none of them is a token. A theme can only choose51/// the variant and whether custom glass surfaces are tinted with one of its colour roles.52public struct GlassMaterialTokens: Hashable, Codable, Sendable {53 public var variant: GlassVariant54 /// Colour role used to tint custom glass surfaces, or `nil` for untinted glass.55 public var tint: GlassColorToken?5657 public init(variant: GlassVariant = .regular, tint: GlassColorToken? = nil) {58 self.variant = variant59 self.tint = tint60 }6162 public init(from decoder: any Decoder) throws {63 let c = try decoder.container(keyedBy: CodingKeys.self)64 variant = try c.decodeIfPresent(GlassVariant.self, forKey: .variant) ?? .regular65 tint = try c.decodeIfPresent(GlassColorToken.self, forKey: .tint)66 }6768 public static let standard = GlassMaterialTokens()69}70