Tokens
Every value is in packages/system/DESIGN.md. The studio command generates the rest; never edit a generated file.
Generated files
| File | Holds |
|---|---|
dist/tokens.css | Every role as a custom property: --color-*, --spacing-*, --rounded-*, --type-<role>-*, --font-display · --font-sans · --font-serif · --font-mono, --elevation-*, --z-*, --motion-*, --material-<name>-*, --art-*. Light on :root; dark under [data-theme="dark"] and under prefers-color-scheme: dark unless data-theme="light"; page steps for --gutter and --band; [data-density="compact"] |
dist/type.css | .t-<role> for every type role, reading only its custom properties; caption roles uppercase, the accent italic |
dist/components.tokens.css | --component-<name>-* for every component and component extension |
dist/fonts.css | @font-face for the self-hosted woff2 files, URLs relative to dist/ |
dist/tokens.json | Resolved values per theme, type roles with their full stack, case and tabular flags, thresholds as numbers |
dist/tokens.js, tokens.d.ts | What scripts need: thresholds, motion in ms, z-index, shells, density, colours |
packages/swift/Sources/StudioKit/Generated/StudioTokens.swift | The same spec for SwiftUI (Swift) |
npm run tokens # all of the above
node packages/system/bin/studio.mjs tokens --check
node packages/system/bin/studio.mjs swift --out packages/swift/Sources/StudioKit/Generated/StudioTokens.swift --check
What the generator reads
The frontmatter (colors, typography, rounded, spacing, components) and these yaml-extension keys: themes.dark, themes.dark-materials, aliases, fluid-type, type-transform, type-style, materials, elevation.light / .dark, z-index, motion, density, environment, artwork, labels, regions, shells, primitives, ladder, component-extensions. Every spacing key ending in -at is a threshold.
Rules the generator enforces, so a broken spec fails the build:
- Every Bounded role sets
fontFeature: '"tnum" 1': Bounded's default digits are otherwise the body'sss01forms. - Every family is one of Studio's four: Bounded, Inter Tight, Instrument Serif, JetBrains Mono.
- A Swift type role needs a bundled face at its weight (
packages/system/fonts/fonts.json).
A product's roles
studio tokens --overrides public/design/overrides.json --out public/design
A product role references a system role or the artwork palette ("stage": "{colors.inverse-surface}"). A literal is refused unless it is listed under deviations with a reason. A product never redefines a system role: Station keeps every portable token when a product changes system (ADR 0003).
Swift
studio swift writes StudioTokens.swift (ADR 0005). A spec key is camel-cased (on-surface-2 → onSurface2, s-1h → s1h); component and material names are UpperCamel.
| API | Type |
|---|---|
StudioColor.<role> | Color that follows light and dark; StudioColor.Light.<role> and .Dark.<role> are StudioRGBA |
StudioArt.<colour>, StudioArt.LabelOn.<colour> | StudioRGBA: the artwork palette (one value in both themes) and the label colour for text on each, for artwork only |
StudioSpace.<key>, StudioRadius.<key>, StudioThreshold.<key> | CGFloat points; StudioThreshold.pageMdAt and .pageLgAt are the page steps (600 and 1024) |
StudioType.<role> | StudioTypeRole: PostScript name, size (nil for the inheriting accent), weight, variableWeight for Bounded, line height, tracking in points, uppercase, tabularFigures, OpenType features, fluidFraction, the Dynamic Type textStyle |
StudioMotion.<key> | StudioCurve, TimeInterval seconds, CGFloat, Double |
StudioZ.<key> | Double |
StudioElevation.<tier> | StudioShadowSet (light and dark layers) |
StudioMaterial.<Name>.<prop> | the glass recipe and the others, value by value |
StudioDensity.<Mode>.<key> | a density mode's spacing overrides |
StudioComponent.<Name>.<prop> | colours, metrics, padding (StudioInsets), type |
StudioFont.<name>, StudioFont.files | PostScript names; the bundled files to register |
Colours are converted from OKLCH to gamma-encoded sRGB; a colour outside sRGB is written in Display P3, and one outside P3 is clipped with a note at build time. A CSS value with no Swift equivalent (ch, vw, %) is listed at the end of the file, not guessed. The file is parsed by make syntax; it is not compiled in this repository's checks.
Fonts
| Family | Web (woff2) | Swift (TrueType) | PostScript names |
|---|---|---|---|
| Bounded | variable, wght 200–900 | Bounded-Variable.ttf | Bounded-Regular (variable) |
| Inter Tight | variable, wght 100–900, latin and latin-ext | 400, 500, 600, 700 | InterTight-Regular, -Medium, -SemiBold, -Bold |
| Instrument Serif | 400 regular and italic, latin and latin-ext | 400 regular and italic | InstrumentSerif-Regular, InstrumentSerif-Italic |
| JetBrains Mono | variable, wght 100–800, latin and latin-ext | 400, 500, 600 | JetBrainsMono-Regular, -Medium, -SemiBold |
All are SIL OFL 1.1, the licence beside the files. fonts.json records each file's source, PostScript name and SHA-256; tools/sync-fonts.mjs --check verifies them and StudioKit's copies. make fonts rebuilds from the pinned npm packages.