tdpxl

Tokens

A role scale in two layers. Components name jobs, not colors.

This is the centre of the system. Everything else leans on it.

Two layers

Underneath, raw ramps. Seven colors, twelve steps each, generated from a shared lightness curve in oklch. gray-500 is a color and nothing more. It means nothing.

On top, roles. A role points at a step and gives it a job. text-sub-600 is not "grey 600": it is secondary text.

Components may only touch the top layer. That rule is what makes dark mode a reassignment instead of a rewrite.

Why the names carry numbers

The number records how far the role sits from the light end of the scale. It is not decoration, and it earns its place:

soft-200   a soft surface, a divider
soft-400   soft text, a label

They share the adjective because they play a similar part, but they do not share a value, because readable text needs more contrast than a line does. Without the number you would have to invent two different adjectives for the same idea.

Surfaces

white-0
weak-25
weak-50
soft-200
sub-300
surface-800
strong-950

Text

text-strong-950 for headings, text-sub-600 for secondary body copy, text-soft-400 for supporting detail, text-disabled-300 for anything inactive, text-white-0 to read on top of a dark fill.

States, in four steps

Six families: success, warning, error, information, away, faded. Each with the same four steps, and each step with a fixed job:

StepWhat it is for
lighterthe background fill
lightthe border around that fill
basethe solid color that acts
darkthe text read on top of the fill

away and faded look out of place beside error until you see what they are for: they are presence states. Away and offline. They live here because they behave exactly like the other states, with the same four steps.

ONAWBSOF

Brand

primary-base, primary-dark and primary-darker for the solids. Plus three translucent fills, primary-alpha-10, primary-alpha-16 and primary-alpha-24, for hover and focus rings over surfaces the component does not know in advance.

Dark mode

Dark mode redefines no colors. It reassigns which step each role points at:

// light
"weak-50": "gray.50"      // nearly white
"strong-950": "gray.950"  // nearly black
 
// dark
"weak-50": "gray.900"     // nearly black
"strong-950": "gray.25"   // nearly white

The raw ramps never move. That is why bg-weak-50 still means "the background one notch away from the paper" in both schemes, even though the value is the opposite one.

Where it all comes from

lib/tokens.ts is the single source of truth. It defines the ramps, the light role map and the dark one.

scripts/build-tokens.ts turns that into app/tokens.css: the variables under :root and .dark, plus a @theme inline block that teaches Tailwind the bg-weak-50, text-sub-600, border-soft-200, rounded-10 and shadow-regular-md utilities.

The same file feeds the registry's theme item, so anyone running npx @tdpxl/cli add theme receives exactly the scale this site renders.

pnpm tokens:build

Changing the entire palette means editing one TypeScript file and running that command. No component is touched.

Typography

The same reasoning applies to text: text-title-h1, text-label-md, text-paragraph-sm, text-subheading-xs. A component picks a typographic role, never a loose size.

On this page