Tokens
Cream, ink, and vermilion palette, Geist font stacks and tab-name metrics, radii, the shared ink outline weight, surface shadows and borders, stage safe areas, and a CSS variables string.
#FFF6E8#FFFCF5#20241F#65675F#D5D1C6#C63D24#A04D31#FF8A6Argba(255, 246, 232, 0.62)#20241F#9BE59BInstall
npx shadcn@latest add @jbm/tokensNeeds the @jbm entry in components.json; see Install once.
Usage
import { color, font } from "@/jbm/lib/tokens"<div style={{ color: color.ink, background: color.bg, fontFamily: font.sans }} />import { stage, type Orientation } from "@/jbm/lib/tokens"const o: Orientation = "vertical"const { w, pad, top, bottom } = stage[o]const contentWidth = w - pad * 2 // 936 stage px in verticalconst contentHeight = bottom - top // 1340 stage px in verticalimport { cssVars } from "@/jbm/lib/tokens"<style>{cssVars}</style>// or paste the string into globals.css and use var(--jbm-accent)API
- Stage
n/aToken values only; nothing renders. The gallery shows the color entries as swatches.
colorconstant
Two-colour palette as hex strings: bg (cream canvas), card (raised surface), ink (text), dim (muted text), line (rules and borders), accent (vermilion, the one accent), accent2 (annotations), soft (emphasis on dark), dimOnDark (cream at 62% for muted text on ink), codeBg, and codeGreen.
fontconstant
Font stacks for sans and mono: the host's --font-sans / --font-mono CSS variable when set (for example by next/font), else Geist and Geist Mono, then system fallbacks.
sansWidthfunction
Estimated advance width of a line set in Geist 800 (tab names) or Geist 400 italic (sublabels), from a built-in per-glyph table measured in the browser, so layouts that size tabs match before fonts load and in Remotion. Accented letters measure as their base letter; other non-ASCII glyphs as an average. Kerning is ignored, so it errs slightly wide.
| Param | Type | Default | Description |
|---|---|---|---|
text | string | required | The line. |
size | number | required | Font size in the units you want back. |
italic | boolean | false | true for Geist 400 italic; default false (Geist 800). |
Returns Width in the same units as size.
radiusconstant
Corner radii in pixels: chip 14, code 12, card 28, pill 10.
strokeconstant
The shared ink outline, stroke.outline, in stage px: 3 (3px on a 1080 stage). Every desk, paper, and thread object (Hand, Folder, Cajon, FileCabinet, Escritorio, DeskTop, DeskProp, Bandeja, ToolCaddy, Document, Paper, Tear, Register, Slip, Hilo, VideoPrint, PunchedTag) draws its outline at this weight, so a composed scene reads as one line weight.
outlineInfunction
The shared outline converted to a local unit system, for art whose viewBox or transform scales against the stage (Hand's 30-unit viewBox at 180 px, a scaled DeskProp group).
| Param | Type | Default | Description |
|---|---|---|---|
unitsPerPx | number | 1 | Local units per stage px; default 1. Non-finite or non-positive values count as 1. |
Returns stroke.outline × unitsPerPx, in local units.
shadowLayersconstant
The surface recipes split into inset (edge light), contact, and ambient box-shadow layers for card and cardDark. Use it to compose or inspect individual layers; see docs/surface-depth.md.
shadowconstant
Complete box-shadow strings card and cardDark, joined from shadowLayers (inset, contact, then ambient). Used by Card, StatCard, and CodeCard.
surfaceBorderconstant
1px ink-tinted border shorthands card (12% ink) and cardDark (65% ink) that pair with the matching shadow.
stageconstant
Stage size and safe area per orientation, in stage pixels: landscape 1920×1080 with 120 side padding, top 90, content bottom 920; vertical 1080×1920 with 72 side padding, top 100, content bottom 1440. Captions live below bottom.
Orientationtype
The keys of stage: "landscape" or "vertical".
cssVarsconstant
A :root{…} CSS string defining --jbm-bg, --jbm-card, --jbm-ink, --jbm-dim, --jbm-line, --jbm-accent, --jbm-accent2, and --jbm-soft for Tailwind or shadcn consumers. It omits dimOnDark, codeBg, and codeGreen.
QA checks
- Check each swatch against the cream, ink, and vermilion palette; the accent stays the only saturated color.
- After changing shadowLayers, compare light and dark Card, StatCard, and CodeCard; shadow.card must still equal the joined card layers for existing consumers.
- When adding a color, decide whether cssVars should expose it; today it exports eight of the eleven colors.
- Verify text using dim or dimOnDark keeps readable contrast on its background.