Skip to content
notes

How this site turns one token file into CSS

A sample post to check the type, colors, components and themes of joost.engineer.

Every color on this page comes from a single file, tokens.json, written during the design of the site. A script turns it into DTCG token files, and Terrazzo compiles those into CSS custom properties: 94 tokens, two themes.

Why one file

If a value is typed into a stylesheet by hand, it drifts. With one source, the light and dark themes can’t disagree about what teal-10 is.

What gets generated

The light theme lands on :root, the dark theme on :root[data-theme="dark"] and on the system preference.

const variableName = (token) => `--${token.id.replace(/^color\./, "").replace(/\./g, "-")}`;
The j.e mark as a dimensioned construction drawing, in font units

The short form j.e as a technical drawing. The period is centered optically: gaps of 146 and 147 units.

Charts

Charts use teal, plum and indigo, sampled from one color field. Lines take the categorical colors, which get lighter in dark mode; fills stay the same in both themes.

Stroke rate per rower over a 2,000 m piece (made-up data), and a diverging grid.

This is a sample post. It goes away when the first real post arrives.