// The reader's two lights (owner, 29 Oct 2026): THE PAGE by day (the // centred page on plain cream) and THE LAMP by night — one page, one layout // (`ReadGeometry`); the lamp changes only the ground, // the light, the ink and the marks (`ReaderMaterial`). The light follows the // appearance the theme carries (`Theme.appearance`, read off the colour // scheme once at the root, `themed(_:)`), with no switch of its own. // // TODAY THAT IS ALWAYS LIGHT ON A PHONE: the app is light-only by its // Info.plist (`UIUserInterfaceStyle: Light`, `project.yml`), which holds // every window, scene and screen trait light, so no public trait carries the // phone's own dark. The lamp is drawn the day the app lets the scheme // through; until then it is reached only by a build whose plist does. import CottonPaper import SwiftUI enum ReadLight: Equatable { /// The page: plain cream paper, near-black ink. case page /// The lamp: near-black paper lit by a warm pool, off-white words, dim /// amber marks. case lamp /// The light for the appearance `scheme`. static func of(_ scheme: ColorScheme) -> ReadLight { scheme == .dark ? .lamp : .page } /// The words' ink. var ink: Color { switch self { case .page: ReaderMaterial.ink.colour case .lamp: ReaderMaterial.lampInk.colour } } /// The marks around the words — the ×, the running head, the /// byline, the progress line: the ink by day, the dim amber by night. var marks: Color { switch self { case .page: ReaderMaterial.ink.colour case .lamp: ReaderMaterial.amber.colour } } /// The close mark's strength: the ink at about 40% on the page, the /// amber at about 70% under the lamp. var closeStrength: Double { self == .page ? 0.4 : 0.7 } /// The running head's and the byline's. var headStrength: Double { self == .page ? 0.6 : 0.7 } /// The progress line's read part, and its unread part (a faint tint). var readStrength: Double { self == .page ? 0.85 : 0.7 } var unreadStrength: Double { self == .page ? 0.12 : 0.18 } }