Skip to content

Glossary

Semantic colour tokens

Semantic colour tokens name a colour by the job it does, such as `fg-muted` for secondary text or `danger-fg` for the word of a failed status, instead of by what it looks like. The component asks for the role and the theme decides the value. Meadowstack's kit has no colour named by hue for the chrome and no accent at all.

By Bohuslav PoláčekChecked

packages/kit/src/styles/tokens.css
--color-fg: var(--fg);
--color-fg-muted: var(--fg-muted);
--color-fg-subtle: var(--fg-subtle);
--color-fg-disabled: var(--fg-disabled);
--color-fg-inverse: var(--fg-inverse);
--color-border: var(--border);
--color-border-strong: var(--border-strong);
--color-border-control: var(--border-control);
--color-border-hover: var(--border-hover);
--color-primary: var(--primary);
--color-primary-hover: var(--primary-hover);
--color-primary-fg: var(--primary-fg);
--color-ring: var(--ring);
--color-selection: var(--selection);
--color-overlay: var(--overlay);
--color-success: var(--success);
--color-success-solid: var(--success-solid);
--color-success-contrast: var(--success-contrast);
--color-success-subtle: var(--success-subtle);
--color-success-fg: var(--success-fg);
--color-success-border: var(--success-border);
In the kit's tokens.css each utility colour points at a role, and the role's value comes from the generated palette of the theme.

Why it matters in a business app

An order list uses the same few roles hundreds of times: the customer's name in text-fg, the date in text-fg-muted, the hovered row on bg-surface-hover, an overdue status in danger. When those are roles, the dark theme, a high contrast palette and a client's theme change every one of them at once and the code does not move.

Roles also carry the contract. danger-fg is promised to read at 4.5:1 on danger-subtle and on the page, so whoever uses it gets readable text without measuring.

How Meadowstack handles it

The utilities AGENTS.md allows are roles only:

There is no accent and no tint-*: colour carries a status, an identity or a data series, always next to a word or a legend. scripts/check-contrast.mjs checks each text role against each surface it may sit on, in both themes.

Common mistakes

  • Using a status for decoration. A green header because the module is about money makes every real success harder to see.
  • Colour without a word. A red dot alone fails people who do not see red; the kit's StatusLabel puts the glyph next to the word.
  • Opacity instead of a role. bg-danger/80 on hover changes the contrast of the text on it; the kit has darker hover tokens instead.
  • One-off roles. A role that one screen uses is a value with a long name. Add one only when the palette rules can generate it for both themes.

Questions

What is the difference between a semantic token and a primitive token?

A primitive names a value, such as a grey at a given lightness. A semantic token names a job, such as muted text, and points at a primitive. Components should only ever use the semantic name.

Why does Meadowstack's kit have no accent colour?

The chrome stays neutral so colour can mean something: a status, an identity or a data series. Buttons and links are ink, and focus is a dark neutral ring.

How does dark mode use semantic tokens?

The roles stay, their values change. The palette generator writes a second set for the dark page, and the contrast guard checks both sets.

Two ways

Build it yourself, or have it built

  • Build it yourself

    Build your app on the framework

    Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.

    One payment, lifetime updates

    Get the framework
  • Have it built

    Have us build your app

    Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.

    After launch, Care keeps it improving, from €99 a month.

    from €1,990

    Describe your app