@jarviisha/davinci-tokens
v0.5.0
Published
Design tokens (CSS variables and typed JS export) for the Davinci design system.
Maintainers
Readme
@jarviisha/davinci-tokens
Design tokens for the Davinci design system. Ships CSS variables for theming and a typed JavaScript export of every token.
Part of the Davinci design system. See DESIGN.md for the philosophy behind the token decisions (single-canvas, border-led, emphasis-only).
Install
pnpm add @jarviisha/davinci-tokens
# or npm / yarn / bunUsage
Import the CSS once in your app entry — once for the primitive variables, plus one or both themes.
@import "@jarviisha/davinci-tokens/css/variables.css";
@import "@jarviisha/davinci-tokens/css/light.css";
@import "@jarviisha/davinci-tokens/css/dark.css";variables.cssdeclares every primitive and component token on:root— always include it.light.csstargets:root, .lightso it acts as the default theme.dark.csstargets.darkand activates when thedarkclass is on<html>.
Toggle the active theme by setting the class on <html> (or use @jarviisha/davinci-react-theme-provider).
JS / TS access
import { tokens, type TokenName } from "@jarviisha/davinci-tokens/js/tokens";
const primary = tokens["semantic.color.primary"];
// → { type: "color", value: "{color.blue.700}", cssVar: "--davinci-semantic-color-primary" }Useful for design-system docs, codegen, or runtime lookups. Each entry exposes:
type— the original$typefrom the token source (color,dimension,fontWeight, …).value— the raw value as authored (may contain{reference}placeholders).cssVar— the generated CSS variable name to use at runtime.
Token layers
Tokens are organized into three layers:
- Primitive — raw palette and scale values (
color.blue.500,spacing.200). - Semantic — theme-aware roles (
semantic.color.primary,semantic.color.foreground). - Component — component-level decisions (
component.button.height.md).
The CSS bundles map onto these layers — primitive, component, and theme-independent semantic tokens (focus, radius aliases) go into variables.css; theme-aware semantic tokens (color, shadow) go into light.css / dark.css.
License
MIT
