Faragiri
English

Choose a language 2

Learn Tokens Design systems

An Athens grocery chain whose green tokens turned blue, and the shelf label printer that kept printing green for a further month.

6Sections
4Min read
4Depth

Recommended Before This

0 / 1

Three tiers: primitive, semantic and component. Almost every problem a token system has is a tier problem, and the commonest one is a system with only the first tier, where a colour is called green and a rebrand becomes a rename.

Eleni runs the token set for a grocery chain in Athens: two web products, an app, a shelf label printer and a till. 62 primitives, 38 semantics and 118 component tokens.

What each tier is for, and who touches it

A primitive is a raw value with a descriptive name: a green at a given lightness, a 16 pixel space, an 8 pixel radius. Nobody uses primitives directly. They are the palette the semantic tier is built from, and a screen referencing one has bypassed the system.

One source, five products

Three tiers, and who is allowed to reach into each

Reading down is what makes a rebrand survivable: a change at the top moves through the middle and the bottom never notices.

one source of values

  • primitive/62 raw values with descriptive names, referenced by the tier below and by nothing else
    • colour-green-600a value, and the only place the word green appears in the system
    • space-16one step of the spacing scale, with no opinion about what it is for
    • radius-8a number, used by two semantic tokens and no component
  • semantic/38 tokens saying what a value is for, and the only tier a designer names in a review
    • colour-surfacetwo values in one token, one per mode, rather than a parallel dark set
    • colour-inkthe name that survived the rebrand without being touched
    • space-gap-inlinethe gap between items in a row, wherever a row appears
  • component/118 tokens, and only where a component genuinely differs from the semantic
    • button-padding-inlineexists because a button pads differently from a card
    • table-row-heightexists because rows have a compact mode and nothing else does
    • card-radiusone of about forty that were deleted, because it was the control radius

The bottom tier is the one that grows without anybody deciding. Every token in it that merely repeats the tier above is a name somebody will have to change twice.

Modular Type Scale & CSS Flex/Grid Motion Lab

Test harmonic typography ratios and live Flexbox/Grid layouts with 1-click CSS export.

A semantic token says what a value is for: surface, ink, the gap between inline items, the radius of a control. Designers use the semantic tier and nobody uses the primitives directly, which is the sentence that makes the model work in practice rather than on a diagram.

A component token is the third tier and it is where restraint matters. A component token exists only when the component differs from the semantic: the button's inline padding is its own token because a button pads differently from a card, and the button's text colour is not, because it is the same ink as everything else. Applying that rule to this system removed about forty tokens in an afternoon.

The grammar

The grammar is category, property, variant, state. Colour, surface, raised, hover. Space, gap, inline. Radius, control.

Predictable structure

Four parts let developers construct names without looking them up

When category, property, variant, and state follow one order, missing tokens stand out as clear gaps.

  1. Categorycolour, space, or radius sets the domain
  2. Propertysurface, gap, or control names the job
  3. Variantraised or inline narrows the context
  4. Statehover or focus finishes the name; modes live inside the same token

Keeping light and dark inside colour-surface prevents a parallel dark-surface set from drifting.

A name you can predict is a name nobody has to look up. That is the whole benefit: a developer who needs the hover colour of a raised surface can construct the name without opening the documentation, and if it does not exist they have found a gap rather than guessed a value.

Modes are a dimension of the semantic tier, not a second set of tokens. Light and dark are two values of colour-surface, in the same token, and a parallel set called dark-surface is two systems that will drift.

Two rules about what is not a token

A value used once is a value, not a token. Tokenising everything produces a set nobody can hold, and the cost is not storage, it is that a person scanning 300 names for the one they need gives up and types a number.

Two token rules

When to leave a value local vs keep an alias during a change

Bloated lists make developers type raw numbers, while unaliased renames break external repositories.

How should this token change be handled?
  • Used in only one place
    Leave it as a plain valuesingle-use tokens bloat the set until scanning 300 names drives people back to hardcoded numbers
    • Do not promote one-off measurements
    • Keep the semantic list small enough to hold in memory
  • Existing token needs a rename
    Deprecate and keep both namesfind-and-replace only looks free inside a single repo
    • Alias old name to new name across releases
    • Remove only after every consumer repository migrates

Every extra token adds scan friction, and every hard rename breaks downstream consumers.

Renaming a token is a breaking change, so deprecate and keep both. A rename looks free because a find and replace runs in a second, and it is free only if every consumer is in one repository, which is never true by the time a system has a name.

What to open

The design tokens format from the W3C community group is worth building against, free, and it replaces a bespoke JSON shape that every tool then has to be taught. It is still a draft and it is already what most tooling reads, which makes it the cheapest bet available for a set that has to feed a website, an app and a label printer.

What to open

Standard JSON and codemods connect one source to every product

Shared schemas and scripted renames beat custom parsers and Friday find-and-replace sessions.

Single token definitionone source of values
  1. 01W3C Design Tokens formatreplaces bespoke JSON that every tool had to learn separately
  2. 02Automated codemod scriptreplaces manual edits across four repos and reruns when a fifth appears
Web, app, printer, and tillmultiple repositories

Expressing a rename as a script turns a recurring manual chore into a repeatable command.

A codemod is the other tool, free and open source in every language anybody uses, and it replaces a find and replace across four repositories done by hand on a Friday. A rename expressed as a script can be run again when a fifth repository appears, which is the situation that makes a manual rename permanent work.

Where it stalls: named for what they look like

The first tokens anybody writes are colours, and the obvious name for a colour is the colour. Green six hundred. Grey one hundred. It is honest, it is easy to read in a file, and it is a description of a value rather than of a job.

Where it stalls

Naming tokens for how they look vs what job they perform

Appearance names tell the truth until a rebrand or contrast fix changes the underlying colour.

Appearance namee.g. green-600, grey-100
Semantic role namee.g. colour-surface
What it describesThe raw colour value in the fileWhere and why the UI uses it
During a rebrandTurns green tokens into blue liesStays accurate while values swap
Cost of an accessibility tweakForces code-wide renames when lightness shiftsUpdates one mapping at the semantic tier

The semantic tier exists so names survive when palettes change.

A name that describes the value has to be renamed the day the value changes, which is the day everybody is busy. A rebrand, a merger, an accessibility fix that moves a lightness: any of those turns a hundred correct names into a hundred lies, and the choice at that moment is between a large rename and a system whose green tokens are blue.

The semantic name survives a rebrand and the primitive name does not, and that is the entire argument for the middle tier. Surface is still surface after the colour changes; green six hundred is not.

What it looks like when it goes wrong

The chain rebranded from green to blue. The token set had a semantic tier on paper and a primitive tier in practice, because 118 component tokens referenced the primitives directly with names like green-600 baked into them. The rename ran across four repositories over six weeks, the app and the web products were out of step for most of it, and the shelf label printer, whose build nobody had touched in two years, printed green labels for a further month. Every value in the system was correct throughout. The names had stopped being true.

Failure sequence

How bypassing the semantic tier broke a green-to-blue rebrand

Every value in the system was right, yet four repositories and a shelf printer fell out of step.

  • Semantic tier bypassedexisted on paper only
    • 118 component tokens pointed to primitives
    • names baked green-600 directly into components
  • Web and app driftedduring the transition
    • products shipped out of sync
    • parallel old and new palettes in flight
118 tokens tied to green-600
  • Six-week code renameacross four repositories
    • manual hunt across separate codebases
    • correct values trapped behind false names
  • Shelf label printer laggeduntouched build for two years
    • missed the first rename pass
    • printed green shelf labels for an extra month

Naming components after raw primitives forces every rebrand through every downstream build.

How many colours the semantic tier should hold before any of this is decided is how many colours, and what each is for. The same argument applied to distance rather than colour is a scale, applied consistently. And the 118 component tokens belong to components that have to be built, versioned and shipped in two places at once, which is building the kit, in design and in code. What the whole thing is for, and how much it is allowed to bend, is one level up in a shared kit, and the rules for using it.

Alongside this

Above this