Back to docs

Lighting

Light sources as objects, not parameters. A room has lamps; a page can too — lamps pinned to the viewport that the text scrolls under, and text that glows like backlit keys when the room is dark.

Lamps in the viewport

Scroll through this scene. The lamps stay in the viewport while the text moves under them — the way a reading lamp stays on the wall while you turn pages.

A room has lamps; a page should too. The lamps in this scene are fixed to your viewport, not to the text — scroll, and the text moves under the light while the lamps stay where they are.

The e-reader got this right years ago. A Kindle's front light is a row of LEDs along the edge of the screen, washing light across the page instead of shining it into your eyes. These three lamps work the same way: light that falls on the surface, with falloff, so the text near a lamp is bright and the text between lamps sits in the dim.

That falloff is the whole trick. A global brightness slider lights everything equally and the page looks flat; a lamp lights a place, and places have edges. Your eye reads the gradient as depth — the page stops being a document and starts being a room you are sitting in.

Liquid glass is the same idea from the other side. Apple's material refracts what is behind it and catches a specular highlight from a light that has a position. The web reimplementations do it with SVG filters — and an SVG filter already has a lamp in it: feSpecularLighting takes a fePointLight, a light with coordinates. The platform has had lamps all along; it just never treated them as furniture.

Turn a lamp off and its corner of the room goes dark. Turn all three off and you are reading by whatever light the page itself gives off — which is the next section.

One honest limit: these lamps belong to this scene. Scroll past it and they go with it — a fixed lamp on the whole page would light the header, the dock, everything, and stop being a lamp and start being a theme. A room has walls; this scene is the room.

How it works: each lamp is a position: sticky row of height zero inside the tall scene — it scrolls with the text until it reaches its viewport offset, then sticks there while the rest of the scene passes under it. The light is a radial-gradient layer with mix-blend-mode: screen and pointer-events: none, so it brightens whatever passes beneath it without intercepting taps or selection. Uncheck a lamp to remove it from the room. No animation anywhere here — both effects are scroll-driven — so there is nothing to kill under prefers-reduced-motion.

Backlit text

A Mac keyboard in a dark room: the keys are dark, the glyphs glow, and the glow is the reading light. No lamp needed — the text is the lamp.

LIGHT

Backlit text works in the dark for the opposite reason lamps do. A lamp lights the surface; a backlit glyph lights itself, and the light spills just past the letter's edge — enough to find the key, not enough to wash out the room. Drag the glow down to nothing and the keys go dark; the letters are still there, but in a dark room, unlit letters might as well not be.

How it works: one --glow variable drives two text-shadow layers on the glyphs — a tight bright core and a wide soft halo. At zero blur both shadows collapse to nothing, so the slider is also the off switch. The keys are plain boxes with a top highlight; the glow does all the work.