Skip to main content

@svatah/yam-ui-tokens

The Yam design tokens: two themes, one type ramp, one status set (REQ-ADE-12)

Exports

ExportKindSignature
ansi256Offunctionexport function ansi256Of(hex: string): numberThe nearest xterm-256 index, computed.
appearanceOffunctionexport function appearanceOf(env: Record<string, string | undefined>): ThemeWhich theme a terminal is on (EX-02).
Capabilitiesinterfaceexport interface CapabilitiesWhat a terminal can do, as far as it will admit.
capabilitiesOffunctionexport function capabilitiesOf(What this terminal can do (TV-05).
ColourDepthtypealiasexport type ColourDepth = "truecolor" | "ansi256" | "none";How much colour to send.
DARKvariableDARK: Readonly<Record<TokenName, string>> The dark theme (docs/spec/design/base.css, the Tokens artboard).
declarationsfunctionexport function declarations(theme: Theme): string--bg0: #111613; … for one theme, in TOKEN_NAMES order.
depthForfunctionexport function depthFor(capabilities: Capabilities, asked?: string): ColourDepth--color, and what the terminal says when nobody passed it.
FONT_FILESvariableFONT_FILES = [The packaged font files (REQ-PKG-3, and the phase's environment note: "ship
FONTSvariableFONTS The font stacks. Monospace is for what the runtime wrote; sans for what we
foregroundfunctionexport function foreground(hex: string, depth: ColourDepth): stringThe escape that colours the foreground, for this depth.
hexOfvariablehexOf = (what: StatusTone, appearance: Theme = "dark"): string =>The hexadecimal a tone is, for a renderer that colours its own way.
LIGHTvariableLIGHT: Readonly<Record<TokenName, string>> The light theme (the site's :root).
METRICSvariableMETRICS The measurements every control shares (LLD §13.7: 28 px controls, 4 px radii).
RESETvariableRESET = "\u001b[39m"And the one that stops.
rgbOffunctionexport function rgbOf(hex: string): readonly [number, number, number]#4fc48a[79, 196, 138].
STATUSvariableSTATUS: Readonly<Record<StatusTone, StatusStyle>>
STATUS_TONESvariableSTATUS_TONES = ["pass", "fail", "skip", "healed", "abort", "info", "neutral"] as constThe five status colours, and the word each must appear with (LLD §13.7).
StatusStyleinterfaceexport interface StatusStyle
StatusTonetypealiasexport type StatusTone = (typeof STATUS_TONES)[number];
stylesheetfunctionexport function stylesheet(): stringThe whole stylesheet: the faces, the two themes, and how a machine chooses
Themetypealiasexport type Theme = "dark" | "light";
THEMESvariableTHEMES: Readonly<Record<Theme, Readonly<Record<TokenName, string>>>>
TOKEN_NAMESvariableTOKEN_NAMES = [Every token name, in the order docs/spec/design/base.css declares them.
tokenHexvariabletokenHex = (name: keyof (typeof THEMES)["dark"], appearance: Theme = "dark"): string =>A token's value, for the theme the terminal is on.
TokenNametypealiasexport type TokenName = (typeof TOKEN_NAMES)[number];
tonefunctionexport function tone(A tone, drawn.
TYPEvariableTYPE The type ramp (the Tokens artboard's "Type" block).