Tokens
The names of every Feitio value: where they come from, how to use them in CSS and TypeScript, and the full list.
On this page
What they are
Every Feitio value (color, space, type, corner, duration) is a named token. Nobody writes a value by hand: you write the name, and the value comes from the theme and mode.
Where they come from
- The source is JSON in the open DTCG format, in
tokens/:base.tokens.jsonfor what does not change with the theme, and one file per theme and mode intokens/themes/. bun run buildgenerates the CSS variables (css/tokens.css) and the TypeScript names (js/tokens.ts).bun run checktests the contrast of every color pair and whether every color fits an ordinary screen (sRGB).
How to use
CSS
.minha-area {
padding: var(--feitio-space-5) var(--feitio-space-4);
border-radius: var(--feitio-radius);
background: var(--feitio-color-surface-raised);
}TypeScript
js/tokens.ts exports every name with its variable, and the TokenName type: a wrong name does not compile.
import { tokens, type TokenName } from '@feitio/core/js/tokens.ts';
const gap: TokenName = 'space.4';
element.style.gap = tokens[gap]; // 'var(--feitio-space-4)'The base tokens
The same in every theme and mode.
| Token | Value | Group |
|---|---|---|
--feitio-font-text | "Alegreya", "Georgia", serif | Type |
--feitio-font-ui | "Alegreya Sans", "Gill Sans", sans-serif | Type |
--feitio-font-weight-regular | 400 | Type |
--feitio-font-weight-medium | 500 | Type |
--feitio-font-weight-bold | 700 | Type |
--feitio-font-weight-heavy | 800 | Type |
--feitio-font-size-small | 1rem | Type |
--feitio-font-size-body | 1.25rem | Type |
--feitio-font-size-h3 | 1.5rem | Type |
--feitio-font-size-h2 | 2rem | Type |
--feitio-font-size-h1 | 2.75rem | Type |
--feitio-font-size-display | 4rem | Type |
--feitio-line-height-text | 1.6 | Line height |
--feitio-line-height-heading | 1.08 | Line height |
--feitio-space-1 | 0.25rem | Space |
--feitio-space-2 | 0.5rem | Space |
--feitio-space-3 | 1rem | Space |
--feitio-space-4 | 1.5rem | Space |
--feitio-space-5 | 2.5rem | Space |
--feitio-space-6 | 4rem | Space |
--feitio-space-7 | 6rem | Space |
--feitio-measure-reading | 46rem | Measure |
--feitio-radius-top-left | 6px | Corners |
--feitio-radius-top-right | 10px | Corners |
--feitio-radius-bottom-right | 6px | Corners |
--feitio-radius-bottom-left | 8px | Corners |
--feitio-border-width | 1px | Stroke |
--feitio-focus-width | 3px | Focus |
--feitio-focus-offset | 3px | Focus |
--feitio-duration-place | 260ms | Duration |
--feitio-duration-change | 320ms | Duration |
--feitio-easing-place | cubic-bezier(0.2, 0.9, 0.3, 1.25) | Easing |
--feitio-easing-change | cubic-bezier(0.3, 0, 0.2, 1) | Easing |
The color roles
The home theme values, by day and at night. A facade fills the same names with other values.
| Token | Day | Night |
|---|---|---|
--feitio-color-surface | oklch(96% 0.018 80) | oklch(22% 0.016 55) |
--feitio-color-surface-raised | oklch(92.5% 0.026 76) | oklch(27.5% 0.02 55) |
--feitio-color-surface-top | oklch(98.5% 0.01 85) | oklch(31% 0.022 55) |
--feitio-color-text | oklch(26% 0.022 55) | oklch(93% 0.022 80) |
--feitio-color-text-soft | oklch(46% 0.025 55) | oklch(76% 0.03 72) |
--feitio-color-accent | oklch(54% 0.165 40) | oklch(54% 0.165 40) |
--feitio-color-accent-strong | oklch(50% 0.16 38) | oklch(77% 0.15 52) |
--feitio-color-on-accent | oklch(97% 0.015 80) | oklch(97% 0.015 80) |
--feitio-color-line | oklch(26% 0.022 55 / 0.15) | oklch(93% 0.022 80 / 0.15) |
--feitio-color-shadow | oklch(26% 0.022 55 / 0.9) | oklch(12% 0.01 55 / 0.95) |
--feitio-color-ok | oklch(45% 0.09 140) | oklch(78% 0.1 140) |
--feitio-color-ok-surface | oklch(91% 0.04 135) | oklch(30% 0.04 140) |
--feitio-color-warn | oklch(50% 0.1 85) | oklch(83% 0.11 88) |
--feitio-color-warn-surface | oklch(92% 0.06 90) | oklch(32% 0.05 85) |
--feitio-color-error | oklch(45% 0.15 15) | oklch(76% 0.12 15) |
--feitio-color-error-surface | oklch(91% 0.04 15) | oklch(31% 0.06 15) |
Rules
- No hand-written value where a token exists.
- A new token goes in the JSON, never in the generated CSS: the build overwrites hand edits.
- A new color goes through the contrast test before it gets in.