// The reader's paper, in either light (`ReadLight`). By day the centred page// (owner, 29 Oct 2026: "it looks too much paper"): a plain warm cream with// the faintest grain (`reader-paper`, a fine even noise, no mottle), and// nothing drawn over it — no binding, no gutter, no page edges. By night the// lamp: the painted near-black tile (`reader-night`) lit by a soft warm pool// centred on the text block, falling off smoothly to the margins and the// corners — added to the paper, so its tooth shows through the light. The// tiles are made by `scripts/import-reader-materials.py`; the pool is drawn.// Where a build carries no pictures, each paper is its colour alone.importCottonPaperimportSwiftUIenumReadGroundKnobs {/// The lamp's pool: its centre on the screen (the text block's middle,/// which the page centres), and how far it reaches as a share of the/// screen's half-diagonal.staticlet poolCentre = UnitPoint(x: 0.5, y: 0.5)staticlet poolReach: CGFloat = 0.85}structReadGround: View {let light: ReadLightvar body: someView {switch light {case .page: ReaderMaterial.paper.colourcase .lamp: lamp } }privatevar lamp: someView {let pool = ReaderMaterial.pool.colourreturn paper(ReaderMaterial.night.colour, tile: "reader-night") .overlay {EllipticalGradient( stops: [ .init(color: pool, location: 0), .init(color: pool.opacity(0.75), location: 0.2), .init(color: pool.opacity(0.42), location: 0.45), .init(color: pool.opacity(0.16), location: 0.72), .init(color: .clear, location: 1), ], center: ReadGroundKnobs.poolCentre, startRadiusFraction: 0, endRadiusFraction: ReadGroundKnobs.poolReach ) .blendMode(.plusLighter) } }/// The paper's colour with its tile repeated over it, where this build/// carries the pictures. @ViewBuilderprivatefunc paper(_ colour: Color, tile name: String) -> someView {iflet tile = CottonMedia.image(name, scale: 3) { colour.overlay(tile.resizable(resizingMode: .tile)) } else { colour } }}