Themes
Meaning
A Theme is a Group-owned semantic declaration that supplies interoperable token values and a closed set of portable roles. It preserves design meaning across targets without putting CSS, Flutter, SwiftUI, component-library names or environment selection into Runtime IR.
Canonical shape
themes:
shared.Brand:
group:
$ref: "#/groups/shared"
tokens:
ink:
kind: color
value: "#10201a"
paper:
kind: color
value: "#f7fbf9"
inkAlias:
kind: color
value:
token: ink
roles:
content.primary: { token: inkAlias }
surface.background: { token: paper }
modes:
dark:
color_scheme: dark
roles:
surface.background: { token: ink }
The closed token kinds are color, dimension, font-family, font-weight, duration, cubic-bezier, number, and shadow. An alias names another token and must retain the same kind. Dimensions use px or rem; durations are non-negative milliseconds; colors use six- or eight-digit hexadecimal notation.
The closed roles are content.primary, content.inverse, surface.background, surface.elevated, action.primary, action.danger, border.default, and focus.indicator. Runtime resolves aliases, rejects cycles and missing targets, and verifies that each role has the required token kind.
Modes
A named mode has a unique selector made from at least one of:
color_scheme:lightordark;contrast:standardormore;density:comfortableorcompact.
A mode overrides one or more role bindings. The environment selects a matching mode; Runtime IR does not contain operating-system probes, media queries or application preference storage.
Application relationship
An Application may reference one Theme. Generation context exposes the selected Theme with aliases resolved to deterministic typed values so packs do not need to reimplement alias traversal.
Boundaries
Themes do not define components, widgets, pages, route strings, responsive breakpoints or target token syntax. Packs map semantic roles and typed values to target representations. Clients and generated applications own environment observation and mode selection.