Cotton code
56 lines · 2.4 KB · SwiftRaw
// The colours of Cotton Pages' things (12 Nov 2026), drawn and not yet// painted: a kept page is a newspaper clipping held in a bulldog clip,// lying on the pages' cobalt enamel desk (`FaceGround.cobaltEnamel`). What is drawn// takes its colour from here: the clipping's grey newsprint and the shade at// its torn edge, the near-black it is printed in and the grey of its small// print and rules, the halftone's ink, and the clip's steel, its lit edge// and its shade, or its brass, lit and shaded, when the page is starred. A// material is NOT a palette role: it is the colour of a thing, read off the// thing 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/// Cotton Pages' materials.public enum PagesMaterial: String, CaseIterable, Sendable {    /// A clipping's grey newsprint.    case newsprint    /// The newsprint's torn edge, its fibres a shade darker.    case tornEdge    /// The near-black a clipping is printed in.    case ink    /// The grey of its small print: the byline, the foot, the rules.    case smallPrint    /// The ink of a picture's halftone dots.    case halftone    /// A bulldog clip's steel.    case steel    /// The steel where the light catches it.    case steelLit    /// The steel in its own shade.    case steelShade    /// The clip's brass, a starred page's.    case brass    /// The brass where the light catches it.    case brassLit    /// The brass in its own shade.    case brassShade    public var colour: Color {        switch self {        case .newsprint: Color(red: 0.882, green: 0.871, blue: 0.835)        case .tornEdge: Color(red: 0.792, green: 0.776, blue: 0.733)        case .ink: Color(red: 0.137, green: 0.133, blue: 0.125)        case .smallPrint: Color(red: 0.388, green: 0.376, blue: 0.353)        case .halftone: Color(red: 0.169, green: 0.161, blue: 0.153)        case .steel: Color(red: 0.604, green: 0.627, blue: 0.651)        case .steelLit: Color(red: 0.871, green: 0.886, blue: 0.898)        case .steelShade: Color(red: 0.322, green: 0.341, blue: 0.365)        case .brass: Color(red: 0.749, green: 0.608, blue: 0.294)        case .brassLit: Color(red: 0.961, green: 0.871, blue: 0.592)        case .brassShade: Color(red: 0.443, green: 0.329, blue: 0.122)        }    }}