Cotton code
81 lines · 3.8 KB · SwiftRaw
// The colours of the books' and the films' things, where they are not painted.//// A standing hardback (its boards and page block, its blank jacket, its// gold ribbon, its belly band and slip) is painted, with its shadow and the// navy felt it stands on (`books-felt`), imported by// `scripts/import-books-materials.py`; a video's sleeve and cassette (the// sleeve's wear, the cassette, its round sticker and its spine label) are// painted, with their shadows and the claret baize they lie on// (`films-baize`), by `scripts/import-film-materials.py`. What is drawn live// over the paint takes its colour from here: the ink a blank jacket's title// and author, the band's words and stars and a highlight's passage are set// in, the typewriter's black on the band, the slip, the sticker and the// spine label, the red of a sticker's stars, the gold a highlight's cloth// is stamped in, the cream a sleeve's lines are printed in; and where a// build carries no pictures, the stand-ins — the papers' cream, the cloth's// teal, a plain sleeve's navy, the cassette's black — and the baize's and// the felt's own colours, the grounds' where their tiles are not drawn. A// highlight's passage (`HighlightPassageFace`) is underlined in a pencil of// its colour, red, yellow or teal, and its note pencilled in graphite. 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 books' materials.public enum BooksMaterial: String, CaseIterable, Sendable {    /// The deep claret baize a film lies on (`FaceGround.claret`), its    /// tile's mean.    case baize    /// The deep blue-black a blank jacket's words, a band's and a    /// highlight's passage are set in.    case ink    /// The typewriter's warm near-black.    case type    /// The red a sticker's stars are struck in.    case red    /// The gold a highlight's cloth is stamped in.    case gold    /// The cream a sleeve's lines are printed in.    case cream    /// The papers' aged cream: an endpaper, a tag, a sticker, a label.    case paper    /// A cloth board's teal.    case cloth    /// A plain sleeve's printed navy.    case sleeve    /// The cassette's black plastic.    case plastic    /// The dark navy felt a hardback and a highlight's card stand on    /// (`FaceGround.feltNavy`), where its tile is not drawn.    case felt    /// The pencils a highlight's passage is underlined in, by its colour.    case pencilRed    case pencilYellow    case pencilTeal    /// The soft graphite a highlight's note is pencilled in, on its strip's    /// curled corner.    case graphite    public var colour: Color {        switch self {        case .baize: Color(red: 0.227, green: 0.090, blue: 0.110)        case .ink: Color(red: 0.10, green: 0.13, blue: 0.22)        case .type: Color(red: 0.11, green: 0.085, blue: 0.065)        case .red: Color(red: 0.72, green: 0.16, blue: 0.14)        case .gold: Color(red: 0.86, green: 0.70, blue: 0.40)        case .cream: Color(red: 0.93, green: 0.86, blue: 0.72)        case .paper: Color(red: 0.90, green: 0.80, blue: 0.66)        case .cloth: Color(red: 0.16, green: 0.30, blue: 0.33)        case .sleeve: Color(red: 0.13, green: 0.17, blue: 0.27)        case .plastic: Color(red: 0.08, green: 0.08, blue: 0.08)        case .felt: Color(red: 0.078, green: 0.102, blue: 0.173)        case .pencilRed: Color(red: 0.706, green: 0.263, blue: 0.184)        case .pencilYellow: Color(red: 0.851, green: 0.647, blue: 0.125)        case .pencilTeal: Color(red: 0.184, green: 0.498, blue: 0.478)        case .graphite: Color(red: 0.34, green: 0.33, blue: 0.32)        }    }}