Cotton code
40 lines · 1.5 KB · SwiftRaw
// What a family makes its objects of, beyond the palette: the paper family's// photographed materials (the instant print's warm card, its unexposed// window), and the flat family's plain stand-ins for them. A face asks the// theme for the material and never names `PaperPaint`, so the same face draws// a print in either family.import SwiftUIextension Theme {    /// The card an instant print is framed in.    public var printFrame: Color {        switch family {        case .paper: return PaperPaint.printFrame        case .plain: return colors.paper.color        }    }    /// A print's window before its picture arrives — never a grey that reads    /// as a failed load.    public var printWindow: Color {        switch family {        case .paper: return PaperPaint.printWindow        case .plain: return colors.chipGround.color        }    }    /// The colour of a sheet of `dye` — the photographed paper's measured    /// tone, or the flat family's one card.    public func sheet(_ dye: PaperDye) -> Color {        switch family {        case .paper: return colors.dyes[dye].map(PaperDye.fill(measured:)) ?? dye.fill        case .plain: return colors.paper.color        }    }    /// Whether the family draws an object's outline as a line: a flat card    /// has no shadow or fibre to tell it from the ground, so it wears the    /// palette's hairline; paper's edge is the photograph's own.    public var outlinesObjects: Bool { family == .plain }}