This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.

Recipe: theme: colours, light and dark, icons

A role (-exact-secondary-label) follows light, dark and Increased Contrast with nothing written.
A role (-exact-secondary-label) follows light, dark and Increased Contrast with nothing written. A brand is app.forma beside app.contract: tokens that a row names as it names a role.
Give my app its colours
Paste this into Claude, Cursor, Codex, or another agent.
forma
forma brand
theme
AccentColor = light-dark(#c8102e, #ff453a)
surface.card = light-dark(#f6f1ea, #1f1b17)
text.muted = light-dark(#6b5e52, #a89a8c) pair=surface.card
brand.fill = #c8102e scheme=fixed
ink.on-brand = #ffffff scheme=fixed
icons
icon.play = icon(sf "play.fill", svg "icons/play.svg")
contract
component App
action dark
setScheme("dark")
action system
setScheme("system")
view
column padding=16 gap=12
column background-color="surface.card" padding=12 gap=4 border-radius=12 testId="card"
text "Tonight" font="-exact-headline"
text "3 patterns" color="text.muted"
row background-color="brand.fill" color="ink.on-brand" padding=12 gap=8 border-radius=12
image "symbol:icon.play" aria-label="Play"
text "Now playing"
row gap=8
button press=dark testId="dark"
text "Dark"
button press=system testId="system"
text "System"
column color-scheme="dark" background-color="surface.card" padding=12 testId="always-dark"
text "Always dark"
•
A role if the platform has one, a token if it is the brand (color="ink", or color="var(--ink)"; forma import css tokens.css writes a stylesheet's). contract vocab color lists the roles. From data, a fn names the token: fn tint(t: string): string = `type-${t}`.
•
light-dark(light, dark) gives a token both schemes. One colour on purpose (an ink on the brand's fill, a ground under media) says scheme=fixed; an unmarked one is warned (lower-colour-one-scheme; several share a line, --json each). An app.contract root theme cannot mark it: move it to app.forma.
•
AccentColor is the app's tint: filled buttons, a plain button's text, the focus ring. A filled button's label stays white, so keep both sides at 3:1 under white: a pale dark side is warned (forma-contrast).
•
Icons: app.forma's icons block names sf for Apple and svg under assets/ elsewhere. Without sf, Apple draws a template path or rasterizes the SVG (watchOS needs sf); -exact-symbol-rendering="multicolor" keeps colours. The web needs SVG (forma-icon-missing). Prefer a role; sf/<name> is blank on the web. Use image "symbol:icon.play"; color tints it, its font sizes it (symbols).
•
The scheme: setScheme("light" | "dark" | "system") sets it, kept from a relaunch's first frame (system forgets it); color-scheme fixes a subtree in one. Modes the person picks (Dim, Black) are axes (a brand).
•
Check it: bun exact.mjs forma check . (pair= warns below 4.5:1); a drive or a test says prefer prefers-color-scheme dark (then light) before an expect or screenshot; check both judges both schemes.
Is this helpful
Last updated November 14, 2026
Exact Docs