For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. The dithercn agent skill, for building any dither on the engine, is at /.well-known/agent-skills/dithercn/SKILL.md.
dithercn

Retro grid

A perspective grid floor scrolling towards a horizon under a striped, glowing sun, drawn as a dither.

Controls
Colour
Horizon0.42
Sun0.4
Animate

Installation

pnpm dlx shadcn@latest add https://dithercn.dev/r/retro-grid.json

Usage

import { RetroGrid } from "@/components/dithercn/retro-grid";
 
export function Hero() {
  return (
    <section className="relative isolate min-h-[480px]">
      <RetroGrid className="absolute inset-0 -z-10" />
      <h1>Your headline</h1>
    </section>
  );
}

The floor is a grid seen from a low camera, scrolling slowly towards you. Lines stay about one cell wide at every depth and fade out where they would crowd closer than a few cells, so the horizon doesn't break into moiré. The sun sits half sunk behind the horizon, with slits through its lower half that thicken towards the ground and drift down. Grid squares keep their size against the box height, so a phone shows fewer columns, not thinner ones.

Examples

Sunset

Four warm colours, from a deep violet paper through magenta to a pale gold sun. A bigger sun and cell={4} give it the chunky look of an old game.

Without the sun

sun={0} leaves only the glow along the horizon, which clears the sky for a headline.

Props

PropTypeDefault
horizon

Height of the horizon, from 0 (bottom) to 1 (top).

Type: numberDefault 0.42
sun

Size of the sun as a share of the box height. 0 hides it.

Type: numberDefault 0.4
columns

How many squares across the front of the floor in a 16:10 box. Narrower boxes show fewer.

Type: numberDefault 12
palette

Colours from paper to ink: palette names such as "blue", CSS variable names, or any CSS colour.

Type: [DitherColor, DitherColor, ...DitherColor[]]Default Paper, two tints of --dither-ink, then --dither-ink
matrix

The threshold pattern. See Dither engine.

Type: "bayer2" | "bayer4" | "bayer8" | "blue-noise"Default "bayer4"
cell

Size of one dither cell in CSS pixels.

Type: numberDefault --dither-cell
speed

How fast the floor scrolls and the sun's slits drift.

Type: numberDefault 1
animate

false draws one still frame.

Type: booleanDefault true
className

Size and position. The scene fills this box.

Type: stringDefault –

Notes

  • It is decorative and hidden from assistive technology. Put real text on top of it, not inside it.
  • With reduced motion turned on, it draws one still frame and stops.
  • It pauses when scrolled out of view or when the tab is hidden, and releases its WebGL context when far offscreen. Without WebGL it shows a horizon line, a soft sun and a fade in CSS.