@depthly/tokens
v0.1.0
Published
Depthly design tokens — DTCG sources, generated CSS variables, and base themes.
Maintainers
Readme
@depthly/tokens
The single source of styling truth for Depthly. Edit the DTCG JSON sources; everything else is generated. See the token-and-theming skill for the rules.
Layout
src/ DTCG token sources (edit these)
core.*.json tier 1 — primitives (color, scale, type, motion, 3D: light/camera/surface/grid)
sem.json tier 2 — semantic (the default = midnight; branding starts here)
component.json tier 3 — per-visual tokens
themes/ user/AI-facing theme files (validated by `pnpm validate:theme`)
midnight.theme.json default dark base (identity — :root is already midnight)
daylight.theme.json light base (overrides; accent-derived tokens cascade automatically)
theme.schema.json the contract a theme file must satisfy
scripts/ the build (DTCG -> CSS/TS/JSON, and themes -> scoped CSS)
generated/ build output (gitignored; published via package "files")Build
pnpm --filter @depthly/tokens buildProduces:
generated/depthly.css— the:rootcascade. References resolve tovar()chains, so overriding asemvar re-skins everything downstream.generated/tokens.json— fully-resolved literals ({ "--depthly-*": "value" }) for AI/tooling.generated/tokens.js+.d.ts—export { cssVars, resolved }for TS consumers (the engine reads 3D params like--depthly-core-light-key-intensityfrom here / from computed styles).generated/themes/<name>.css—[data-depthly-theme="<name>"] { … }per theme.
The build runs a WCAG contrast gate on foreground/background and terrain low/high; it exits non-zero if a default pair is illegible.
Using it
@import "@depthly/tokens/css"; /* :root defaults (midnight) */
@import "@depthly/tokens/themes/daylight.css"; /* opt-in light theme */<div data-depthly-theme="daylight"> … visuals re-skin … </div>Build-tool decision (interim)
We ship a small zero-dependency DTCG compiler (scripts/build-tokens.mjs) instead of wiring Style Dictionary 4 right now, so the token pipeline runs on plain node and is verifiable before pnpm install — matching tooling/scripts/. The DTCG sources are tool-agnostic, so migrating to Style Dictionary 4 later is a drop-in swap of the build script with no change to sources, themes, or output contract. CLAUDE.md still names Style Dictionary 4 as the eventual tool; this README is the documented interim decision.
