Color
Color is two tiers. The live values are in the Storybook, which computes each contrast ratio in the browser against the current tokens, so the numbers there are never stale. This page is what the tokens are for.
Token names
Section titled “Token names”Every system token starts with --sdc-. Anything without the prefix is private
to one component and is not part of the system. Figma keeps the plain names; the
prefix is added when the tokens are generated.
Two tiers
Section titled “Two tiers”Primitives hold the raw values and are named for what they are:
--sdc-paper-cloud, --sdc-ink-charcoal, --sdc-brand-regatta. Twenty-eight of them, defined
once on :root, the same in every theme. Nothing in the stylesheet may use one
directly except the semantic tokens below.
Primitives are generated, not hand-written. Figma is the source of truth for
their values. The canonical record is src/styles/tokens/primitives.tokens.json
in DTCG format, and scripts/build-tokens.mjs is the only thing that writes
them into the stylesheet, between the TOKENS:START and TOKENS:END markers in
Site.astro. Edit the block by hand and the next build overwrites you.
npm run tokens:check fails when the two drift, and ship runs it first.
The semantic tier stays hand-written on purpose. It uses rgba() over the
-rgb channels and clamp() fluid type, and a Figma variable can express
neither. Generating it would flatten the type scale to fixed breakpoint values.
Semantic tokens are named for what they are for: --sdc-bg, --sdc-text,
--sdc-accent. Each theme maps them onto primitives and introduces no values of its
own. If you find yourself writing a hex here, the primitive you need does not
exist yet. Add it rather than inlining the value.
The split exists because the palette used to be written out in full three times:
once for dark, and twice for light, since the light block was duplicated behind
a prefers-color-scheme query. Three copies of the same fifteen declarations
with nothing keeping them in step. A color change is now one line in one place.
A primitive also carries its channels where a translucent version is needed, as
--sdc-ink-charcoal-rgb, so --sdc-rule can be built from the same source as --sdc-text
instead of repeating the numbers.
The roles
Section titled “The roles”Ground and surface. --sdc-bg is the page, a warm off-white. --sdc-surface is a
card sitting on it, --sdc-surface-2 a hover. The difference between them is small
on purpose: cards are lifted by shadow, not by color.
Ink. --sdc-text is charcoal, never pure black. --sdc-text-mute is for supporting
copy and labels, and is the darkest muted tone that still clears AA on both the
page and a card.
Accent. --sdc-accent is a slate blue. It marks one thing at a time: a link, a
kicker, the filled button, the bar on a social card. It is not a brand wash.
Rules. --sdc-rule is a divider between content. --sdc-rule-strong is for the
boundary of a control. They are not interchangeable, and confusing them is the
mistake this site has actually made.
Focus. --sdc-focus-ring is the keyboard focus indicator and nothing else. It
points at its own primitives, --sdc-brand-focus and --sdc-brand-focus-dark, rather
than reusing --sdc-accent-hover. That separation is deliberate: retuning a hover
color should never silently move an accessibility affordance. See
Focus.
Two contrast rules that decide the values
Section titled “Two contrast rules that decide the values”Text needs 4.5 to 1. A control boundary or a meaningful graphical edge needs 3 to 1. Both are measured against what sits behind them, which on a card is the surface, not the page.
Two tokens have already moved because of this:
--sdc-text-mute was lightened at some point and measured 4.06 to 1. It is now a
darker charcoal at about 5.5.
--sdc-accent was a brighter blue measuring 4.38 on the page and 3.89 on a card, so
every inline link inside a card failed. It is now slightly deeper and clears 4.5
on both.
--sdc-rule-strong is the cautionary one. It was introduced specifically so control
borders would clear 3 to 1, with a comment in the code saying so, and the value
chosen measured 2.49. The comment was wrong for weeks and the Storybook was
publicly showing it as a failure. It now measures about 3.3 on the page.
The lesson is not about a number. It is that a token’s name and its comment are claims, and claims need checking.
Status
Section titled “Status”Three colors, for the three things the system has to say: something failed, something needs attention, something worked. Added October 2026. Before that the system had none, and anything needing a red invented one.
--sdc-error, --sdc-warning and --sdc-success are the solids, for text and
small marks. Each has a tint, --sdc-error-tint, --sdc-warning-tint and
--sdc-success-tint, which is the
ground a message sits on with ordinary --sdc-text on top. Six semantic tokens,
pointing at twelve primitives under --sdc-signal-.
The three picked values are #B50F34, #FFA500 and #5F923F. They behave very
differently on a warm paper ground, and the token set exists to hide that:
The red works everywhere. As text it clears 4.5 on all three grounds, it takes white text as a fill, and it reads as a dot. It needed no second form.
The orange is very light. It is a fill with charcoal on it, or a tint. As text or a bare dot on paper it measures 1.3 to 1 and is not there. White text on it is 2.0, so never white on the orange.
The green is the hard one. It sits in the middle of the lightness range, which is the worst place to be: too light for white text at 3.7, too dark for charcoal at 3.4. Nothing can sit on it, and against paper it is 2.5.
So in the light theme --sdc-success and --sdc-warning resolve to deeper forms
of the same hue and saturation, taken down until they clear 4.5 on every ground.
The full-strength values are still what the tints are mixed from, so the message
grounds are the picked colors. In the dark theme it reverses: the green and
orange are bright enough to use directly, and the red is the one that needs a
lighter form, because on near-black it is 2.6.
That is the whole reason the solids differ between themes. A color that reads on paper does not read on black.
Never color alone
Section titled “Never color alone”Every status message carries an icon or a word as well. This is not a nicety. If you tune a set of status colors to one contrast target they land at one lightness, and a reader with the common form of red-green color blindness sees three identical olives. An earlier version of this palette did exactly that and scored 27 on a separation measure where 60 is the threshold. The three shipped values are far apart in lightness, which is what keeps them distinct, and the icon is what makes the point moot.
Dark mode
Section titled “Dark mode”A full dark palette: black ground, near-white ink, a neon lime accent. It is the alternate, not the default.
The toggle is real again. It sits bottom right, remembers a choice once one is made, and resolves before the page paints so switching never flashes the wrong palette. Without JavaScript it hides itself and the page stays light.
The operating system is not consulted. It used to be: a first visit read
prefers-color-scheme, so anyone whose machine was set to dark got the dark
palette without asking for it, and the same was true of the documentation, where
Starlight’s “auto” mode did it. Both now default to light and change only when
someone picks dark, which is what the stored value records. The reasoning is
that this palette is the brand and the other one is an accommodation, so it
should be offered rather than assumed. Clearing site data returns a visitor to
light, not to whatever their laptop is set to.
For a long stretch it was not real: data-theme="light" was fixed in the markup,
nothing ever changed it, and the toggle had styling but no button. Roughly forty
rules served a mode nobody could reach, and the whole dark palette went without a
scanner ever seeing it. That is how a figure caption came to sit at 3.31 to 1 on
black: its rule named --text-muted, a token that does not exist, and fell back
to a hard-coded light-theme hex. In the only theme anyone could load, the
fallback happened to be the right color.
Both themes are checked now, on every page, by npm run qa.
Checks before you ship
Section titled “Checks before you ship”- Any new text color clears 4.5 to 1 against both the page and a card, in
both themes.
npm run qa -- contrastmeasures it on the rendered page. - Any new control border clears 3 to 1.
- The token exists in both the light and dark blocks, and points at a primitive rather than a literal value.
- A new raw value was added as a primitive, not inlined into a semantic token.
- The Storybook color page shows the new token passing, not failing.
- The token name is spelled the way it is defined. A typo in a
var()is silent: it falls through to the fallback, or to nothing.