Skip to content

Design tokens β€” quick reference

Semantic CSS custom properties (--zer0-*) used across zer0-mistakes. For architecture, SCSS import order, and override strategies, see design-system.md.


Source files

File Purpose
_sass/tokens/_index.scss Barrel β€” imported first from assets/css/main.scss
_sass/tokens/_color.scss Brand, state, surface, ink, link colors
_sass/tokens/_spacing.scss Spacing scale + FAB offsets + sidebar widths
_sass/tokens/_radius.scss Corner radii (sm β†’ xl, pill, circle)
_sass/tokens/_typography.scss Fluid heading + display scale, line heights, weights
_sass/tokens/_shadow.scss Elevation scale (xs β†’ lg, FAB, focus)
_sass/tokens/_motion.scss Durations + easings; auto-flattens under prefers-reduced-motion
_sass/tokens/_breakpoints.scss --zer0-bp-* (Bootstrap 5 default values)
_sass/tokens/_layers.scss z-index scale for header, FABs, offcanvas, toasts
_includes/core/tokens-inline.html Runtime overrides from _config.yml + localStorage

Color tokens

Token Default _config.yml key
--zer0-color-primary var(--bs-primary) theme_color.main
--zer0-color-secondary var(--bs-secondary) theme_color.secondary
--zer0-color-accent var(--bd-accent) theme_color.purple
--zer0-color-on-primary #fff β€” (each palette skin sets its own: #000 on the light brands)
--zer0-color-success var(--bs-success) theme_color.green
--zer0-color-info var(--bs-info) theme_color.teal
--zer0-color-warning var(--bs-warning) theme_color.yellow
--zer0-color-danger var(--bs-danger) theme_color.red
--zer0-color-link var(--bs-link-color) theme_color.blue
--zer0-color-bg var(--bs-body-bg) Bootstrap color mode
--zer0-color-bg-elevated var(--bs-tertiary-bg) Bootstrap color mode
--zer0-color-ink var(--bs-body-color) Bootstrap color mode
--zer0-color-code-bg var(--bd-pre-bg) β€”
--zer0-color-code-ink var(--bd-callout-code-color) β€”

--zer0-color-primary-rgb powers translucent surfaces: rgba(var(--zer0-color-primary-rgb), 0.12).

Example β€” _config.yml:

theme_color:
  main: '#0d6efd'
  green: '#22c55e'
  red: '#ef4444'

Precedence: skin vs theme_color

Strongest first:

  1. Appearance panel. localStorage["zer0-appearance"] is written as an inline style on <html>, and an inline style beats any selector.
  2. The active skin. The palette skins (air, aqua, dirt, neon, mint, plum, sunrise) set --zer0-color-primary (and -rgb), --zer0-color-link (and -hover), --zer0-color-accent and --zer0-color-on-primary, together with --bs-primary and --bs-link-color. So switching skin moves the theme layer and Bootstrap as one. Each skin's text colours reach WCAG AA (4.5:1) on every surface they are used on; the measured ratios sit beside each skin in _sass/theme/_skins.scss, and test/visual/core/skin-contrast.spec.js checks them in light and dark.
  3. _config.yml theme_color. It sets every token in the table above. For primary, link and accent this only takes effect when no palette skin is active, as with the dark and contrast skins. secondary, danger, warning, success and info are not set by any skin, so they always come from theme_color.
  4. The defaults in _sass/tokens/_color.scss.

tokens-inline.html enforces step 3. It emits primary/link/accent under :root:not([data-theme-skin="air"]):not(…) and keeps its palette_skins list in sync with _skins.scss. The "Skin palette vs site theme_color" block in test/visual/features/appearance.spec.js checks both the precedence and that list.


Spacing tokens

Token Value Notes
--zer0-space-0 … --zer0-space-5 0, .25rem, .5rem, 1rem, 1.5rem, 3rem Mirrors Bootstrap
--zer0-space-section clamp(2rem, 6vw, 5rem) Landing section rhythm
--zer0-space-fab-offset 1rem FAB distance from edge
--zer0-space-fab-size 3.5rem FAB diameter
--zer0-space-fab-gap 0.75rem Gap between stacked FABs
--zer0-sidebar-width 17rem Left sidebar
--zer0-sidebar-toc-width 12rem Right TOC

Example β€” SCSS override:

:root {
  --zer0-space-section: clamp(3rem, 8vw, 6rem);
}

Radius tokens

Token Value Notes
--zer0-radius-sm 0.25rem Focus outlines, small chips
--zer0-radius 0.375rem Default (callouts, nav links)
--zer0-radius-lg 0.5rem Mobile nav panel, tables
--zer0-radius-xl 0.75rem Landing feature cards
--zer0-radius-pill 50rem Pills, badges
--zer0-radius-circle 50% Icon chips, avatars, FABs

Every rounded surface in _sass/ uses these tokens, so overriding one (say --zer0-radius: 0.75rem) re-rounds the whole theme. A partial never spells out a value the scale names: write var(--zer0-radius), not 0.375rem. A radius that is deliberately off the scale (a 2px underline, a 10px card corner, a book cover's spine) stays a literal and says why on the same line with an // off-scale: <why> comment. There is no --zer0-radius-md: the step between --zer0-radius and --zer0-radius-xl is --zer0-radius-lg. ruby scripts/design-system-check.rb enforces all three rules (#390).


Typography tokens

Token Value
--zer0-font-sans var(--bs-body-font-family, system-ui, …)
--zer0-font-mono var(--bs-font-monospace, …)
--zer0-text-h1 clamp(2rem, 4vw + 1rem, 3rem)
--zer0-text-h2 clamp(1.5rem, 2.5vw + 1rem, 2.25rem)
--zer0-text-display-4 clamp(2.5rem, 6vw, 3.5rem)
--zer0-text-display-5 clamp(2rem, 5vw, 3rem)
--zer0-leading-normal 1.55

Shadow, motion, breakpoints, layers

See full tables in design-system.md.

Motion β€” under prefers-reduced-motion: reduce, durations collapse to 0.01ms.

Breakpoints β€” cannot be used in @media; JS reads via syncBreakpointsFromCss().

Layers β€” always use --zer0-layer-* for new overlays (see layouts-and-navigation.md).


Override methods

Method When to use Example
_config.yml theme_color Site-wide brand colors main: "#6366f1"
Appearance panel Per-user primary color Settings β†’ Appearance
user-overrides.css Custom rules without SCSS user_overrides: true
Fork _sass/tokens/*.scss Build-time token changes Copy partial to your repo

Example β€” user-overrides.css:

:root {
  --zer0-color-primary: #0ea5e9;
  --zer0-shadow-fab: 0 0.5rem 1.5rem rgba(14, 165, 233, 0.4);
}