Skip to main content

Module tokens

Module tokens 

Modules§

colors
The colour half of the design language (docs/design-language.md).
contrast
The legibility half of the colour tokens.
elevation
metrics
Density metrics: the control heights, hit targets, panel widths and icon sizes HIG §9.6 fixes so two panels built by two people come out the same size. Spacing says how far apart things sit; metrics say how big the things are.
motion
Motion tokens — the one shared timing + spring vocabulary the whole UI (toolkit widgets AND shell chrome) animates against, so same-class gestures share a feel.
palette
What a theme document says about colour (docs/design-language.md, “Colour” and “Theming”).
radii
Corner radii, by what the corner belongs to (docs/design-language.md, “Shape”).
spacing
syntax_palette
The one colour scheme every syntax-highlighting surface paints with: the code editor widget, block-editor code fences, highlighted text inputs and any app that renders source (a code editor, a diff, a snippet preview).
terminal_palette
typography
The semantic type system.

Structs§

ColorRamp
Colors
Durations
Three-slot duration scale. Everything time-parametric picks one of these instead of a bespoke literal:
Elevation
Elevation, by the design language’s one rule: only floating things cast a shadow. Window tiles, bars, cards and selected controls have none — a tile is separated by the ground and its window edge, a selection is a lift (crate::tokens::Intents::selection).
FontFamily
A named font family, wrapped so consumers can extend with fallbacks/weights later without breaking token consumers.
Gesture
Tuning for direct-manipulation gestures — the numbers that decide how a dragged surface resists, catches and coasts. Shared for the same reason the springs are: two controls that resist differently read as two unrelated machines.
InkLadder
OKLCH lightness of the three ink tiers, defined on the content surface.
Intents
What controls paint with, by intent rather than by hue.
MediaColors
What is drawn straight onto media (video, a camera viewfinder, a photo): the letterbox around a frame, the fade under text that sits on the picture, and that text. Media is dark or light regardless of the theme, so these are the same in every theme; only the hue of the neutral material follows it. Controls over media are a floating Panel on the material instead, inked from the theme.
Metrics
Reference density (HIG §9.6), unscaled. Read live values from theme.tokens.metrics.
Motion
OnSurface
Ink tiers for content painted onto a surface, resolved against that surface’s actual luminance (Colors::on_surface).
Palette
The neutral material and its inks.
PresencePalette
One colour per participant: PRESENCE_HUES at one OKLCH lightness and chroma, so they differ in hue only and no participant looks more important than another. Where sRGB cannot carry the full chroma at a hue (a light cyan) only that hue’s chroma drops; lightness never does.
Radii
RhythmScale
The gaps of each Rhythm, each a step of the Spacing scale and scaled with it.
SemanticColors
Status colours. Muted (chroma at most STATUS_MAX_CHROMA) and used only for status: never as decoration, never as a brand.
Shadow
One step of the elevation ramp — a complete description of a drop shadow, and the only description a surface is allowed to use.
Spacing
The 4 px spacing scale every gap, inset and gutter is drawn from.
SpringParams
SpringPresets
StatusTones
The four status tones. Their hues are STATUS_HUES.
SurfaceLadder
OKLCH lightness of every surface, 0 black to 1 white.
Surfaces
The neutral material’s surfaces. Every one is opaque except Self::material, and every one shares [Colors::neutral_hue].
SyntaxPalette
Theme-derived colour for every syntax role. Read it from theme.tokens.syntax and resolve a token with SyntaxPalette::color.
TerminalPalette
Palette used by terminal-style widgets. Exposes default fg/bg and a 16-slot ANSI base palette. Higher-index colors (256/truecolor) are out of scope — consumers still derive those from the 16 anchors or from their own mapping.
TintedChip
A tinted pill (a status badge, a presence chip), resolved against the ground it paints on. Every field is opaque rather than a token plus alpha — measuring the token instead of the composite is how a chip ends up as tinted ink on a tinted wash.
Tokens
Tone
An OKLCH lightness and chroma at a hue the role fixes.
Typography
A theme’s type: three families and the scale every role derives from.
Wash
A status wash resolved on its ground: an opaque body and the inks that read on it.

Enums§

Emphasis
How primary actions, selection and “on” states show.
PresenceHue
One of the twelve presence hues: a person’s colour, as they choose it.
ReadingFace
A reading face the system ships, chosen by name in a theme’s type role or by a reader in an app that sets long-form text (Books). Each is set through the Reading role’s family, so its optical sizes, features and script fallbacks work like the default’s.
Rhythm
How two neighbours relate, which decides how far apart they sit (HIG §7b). Layout containers take one (Column::with_rhythm, Row::with_rhythm) and resolve it against the theme they are laid out with, so the gap follows density, ui_scale and a custom spacing scale.
SpacingStep
A named step on the Spacing scale, for APIs that resolve a gap at layout time from the Theme they are handed (Spacer::token) rather than taking an unscaled pixel value from the caller.
TextRole
What a piece of text is. Pick the role; never a pixel size.
UiFace
A UI face the system ships, chosen by name in a theme’s type role or by the accessibility layer. Reading (ReadingFace) and code keep their own faces.
WashStrength
How strongly a Colors::wash_on status wash shows.

Constants§

NON_TEXT_MIN_CONTRAST
WCAG 2.1 non-text contrast (a pill’s edge, a toggle’s knob).
REFERENCE_BODY_PX
The body size, in logical pixels at 1×, that every role is designed against. Role sizes are body × role_px / REFERENCE_BODY_PX, so they land on whole pixels at the stock size.

Functions§

dark_overlays
The veneer tiers for a dark ground: white at 5 % / 10 % / 20 %.
light_overlays
The veneer tiers for a light ground: black at ≈ 6 % / 12 % / 24 %.
rubber_band
iOS-style overscroll resistance.

Type Aliases§

OverlayTiers
The five state-veneer values for one theme, in tier order: (subtle, medium, strong, border_subtle, border_strong).