jbmui

Tokens

  • Foundations

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.

bg#FFF6E8
card#FFFCF5
ink#20241F
dim#65675F
line#D5D1C6
accent#C63D24
accent2#A04D31
soft#FF8A6A
dimOnDarkrgba(255, 246, 232, 0.62)
codeBg#20241F
codeGreen#9BE59B

Install

npx shadcn@latest add @jbm/tokens

Needs the @jbm entry in components.json; see Install once.

Docs

Usage

Inline styles from tokens
import { color, font } from "@/jbm/lib/tokens"<div style={{ color: color.ink, background: color.bg, fontFamily: font.sans }} />
Keep content inside the safe area
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 vertical
CSS variables for Tailwind
import { cssVars } from "@/jbm/lib/tokens"<style>{cssVars}</style>// or paste the string into globals.css and use var(--jbm-accent)

API

Stage
n/a

Token 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.

ParamTypeDefaultDescription
textstringrequiredThe line.
sizenumberrequiredFont size in the units you want back.
italicbooleanfalsetrue 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).

ParamTypeDefaultDescription
unitsPerPxnumber1Local 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.