Behind every page in Aurora lie two bands of violet light that drift, follow the scroll and glow around the pointer, over a fine dot grid. They’re drawn by LightField, in src/components/fx/LightField.astro.
A shader on one canvas
The light is one <canvas> behind the page, drawn by a small WebGL shader. Each band follows a slow curve, bent by noise so it doesn’t look regular. Scrolling turns the bands and moves the bright spot; the pointer adds a soft glow where it is.
The colours come from the theme’s brand scale, read once when the page loads and again when dark mode changes. A new brand colour gives a new light.
Kept light
A moving light behind every page costs something on every frame, so the component limits what it does:
- It draws at half the screen’s resolution and at most 30 frames a second.
- It stops while the tab isn’t visible.
- It runs only on a device with a graphics chip.
src/scripts/gpu.tsasks the browser whether WebGL would be slow, and checks the name of the renderer for software ones. Without a graphics chip, and in Lighthouse, the page keeps a still light drawn in CSS and the canvas draws nothing. - Under reduced motion it draws one still frame, and redraws only when the page scrolls.
Text stays readable
In dark mode the light never gets brighter than a relative luminance of MAX_LUM, so grey text keeps a contrast of 4.5:1 over it. Where the light would be brighter, the shader dims it as one colour, by its brightest channel, so it keeps its hue. Dimming each channel on its own turned the violet grey-green where the light was brightest.
Where the light shows
LandingLayout puts the light on every page. A section shows it when it has no background of its own: the fx-clear class takes the background away. The cards are glass for the same reason, so the light shows through them.