Cotton code
56 lines · 2.5 KB · SwiftRaw
// The colours of the todos' things, where they are not painted.//// A todo's index card and its tray are painted (`todo-card`, `todo-tray`, its// front wall `todo-tray-front` and its shadow `todo-tray-shadow`, the tabs// `todo-tab` and `todo-tab-late`, cut by `scripts/import-todos-materials.py` from the layers painted after the// index-card picture the owner chose, `objects-2/todos/3-punched-card`, 29 Oct// 2026). What is drawn live over the paint takes its colour from here: the// typewriter's ribbon black the words are typed in, the grey the DONE ring is// printed in and the pencil a finished todo is ticked and struck through in;// and where a build carries no pictures, the card's stand-in — its cream, its// pale blue rules and red head rule — the tabs' salmon and red, the tray's// green-grey enamel (it stands on the todos' baize, `GroundMaterial`). A// material is NOT a palette role: it is the colour of// a thing, read off the reference the way a paper's dye is read off its// photograph (`PaperDye`), and it does not flip with the theme.// `PaletteGuardTests` exempts this file from the CHANNELS sweep for that// sentence and no other; it writes no hex and names nothing.import SwiftUI/// The todos' materials.public enum TodosMaterial: String, CaseIterable, Sendable {    /// The ribbon black the title, the description, the date and the day it    /// was made are typed in.    case ink    /// The dark grey the DONE ring and its word are printed in.    case print    /// The graphite a finished todo is ticked and struck through in.    case pencil    /// The card's cream, the chosen picture's between its rules.    case card    /// A rule's pale blue.    case rule    /// The head rule's red.    case head    /// The salmon tab a due date is typed on.    case tab    /// The red tab of a todo past its day.    case tabLate    /// The tray's worn green-grey enamel.    case enamel    public var colour: Color {        switch self {        case .ink: Color(red: 0.10, green: 0.085, blue: 0.075)        case .print: Color(red: 0.20, green: 0.17, blue: 0.15)        case .pencil: Color(red: 0.36, green: 0.35, blue: 0.36)        case .card: Color(red: 0.894, green: 0.802, blue: 0.706)        case .rule: Color(red: 0.51, green: 0.62, blue: 0.67)        case .head: Color(red: 0.85, green: 0.39, blue: 0.36)        case .tab: Color(red: 0.878, green: 0.506, blue: 0.380)        case .tabLate: Color(red: 0.722, green: 0.227, blue: 0.180)        case .enamel: Color(red: 0.30, green: 0.29, blue: 0.21)        }    }}