Cotton code
49 lines · 2.3 KB · SwiftRaw
// The colours of the journal's things where they are not painted.//// A diary is painted (`diary-book`, its ribbon `diary-ribbon-in` and// `diary-ribbon-out`, its seals `diary-seal-*`, by `scripts/paint-diary.py`,// 12 Nov 2026). What is drawn live over the paint takes its colour from// here: the blue-black a page is written in, the brown its printed date is// set in and the weather glyph is stamped in; and where a build carries no// pictures, the stand-ins: the page's cream and rules, the cloth's navy and// each mood's wax (it lies on the journal's bedside table, `GroundMaterial`).// A material is NOT a palette role: it is the colour of a thing, read off// its painting 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 journal's materials.public enum JournalMaterial: String, CaseIterable, Sendable {    /// The page's cream, its painting's mean between the rules.    case paper    /// A rule's faint blue-grey.    case rule    /// The navy book cloth.    case cloth    /// The fountain pen's blue-black the title, the place and the words are    /// written in.    case ink    /// The warm brown the diary's date is printed in and the weather stamped.    case print    /// The wax a page is sealed with, by its mood, and the bare disc.    case great, good, okay, low, awful, bare    public var colour: Color {        switch self {        case .paper: Color(red: 0.925, green: 0.894, blue: 0.82)        case .rule: Color(red: 0.616, green: 0.686, blue: 0.753)        case .cloth: Color(red: 0.118, green: 0.165, blue: 0.278)        case .ink: Color(red: 0.11, green: 0.14, blue: 0.27)        case .print: Color(red: 0.36, green: 0.27, blue: 0.2)        case .great: Color(red: 0.725, green: 0.541, blue: 0.173)        case .good: Color(red: 0.184, green: 0.388, blue: 0.196)        case .okay: Color(red: 0.365, green: 0.439, blue: 0.502)        case .low: Color(red: 0.184, green: 0.192, blue: 0.408)        case .awful: Color(red: 0.337, green: 0.078, blue: 0.098)        case .bare: Color(red: 0.812, green: 0.78, blue: 0.71)        }    }}