Skip to content

Tokens

218 tokens: 145 primitives and 73 semantic roles, in 4 themes. The source is tokens/*.json (W3C design-token format: $value, $type, $description). The build writes the outputs; nobody edits them.

<link rel="stylesheet" href="/downloads/xg-tokens.css">
<html data-brand="xendiz" data-theme="light">
.my-panel {
background: var(--xg-color-surface-card);
color: var(--xg-color-text-body);
border: 1px solid var(--xg-color-border-default);
border-radius: var(--xg-radius-card);
padding: var(--xg-space-5);
box-shadow: var(--xg-shadow-sm);
}

Names follow the JSON path with dashes: color.text.muted is --xg-color-text-muted; space.4 is --xg-space-4.

Attribute Values Default
data-brand xendiz, waardex xendiz
data-theme light, dark light

Set both on <html>. To preview another theme inside a page (as every example on this site does), set both attributes on a wrapper: the wrapper then carries a complete set of semantic values. Follow the user’s system setting for mode with matchMedia('(prefers-color-scheme: dark)'), and remember their choice.

xg-tokens.json holds every resolved value:

const t = await fetch('/downloads/xg-tokens.json').then((r) => r.json());
t.themes.waardex.dark['color.chart.1']; // "#4d6bff"
t.primitives['space.4'].value; // "16px"
t.counts; // { primitives, semantic, total, … }

Use it for chart libraries, canvas, emails and anything that cannot read CSS variables.

  1. Edit tokens/primitives.json, tokens/semantic.json or tokens/brands/waardex.json. A semantic value is one reference ("{color.electric.600}") or a pair { "light": …, "dark": … }.
  2. Run npm run tokens. It resolves every reference and measures every pair in tokens/contrast-pairs.json in all themes; it stops on an unresolved reference or a pair below its minimum.
  3. Run npm test and open a pull request. Which change needs which version is in Releasing.
  • Components use semantic tokens only. A primitive in a component is a review comment; a hex value is a bug.
  • A new semantic token needs a job nobody else does. Prefer an existing role.
  • A brand override may change a value, never add a name: both brands always have the same set.