Skip to content

Design Tokens

Human’s design system is built on W3C Design Tokens Community Group (DTCG) format JSON files that compile to CSS custom properties, Swift constants, Kotlin objects, and C macros.

design-tokens/
base.tokens.json — primitive color scales, spacing, radii
semantic.tokens.json — theme-aware aliases (dark, light, high-contrast)
typography.tokens.json — font families, sizes, weights, tracking
motion.tokens.json — durations, easings, micro-physics presets
glass.tokens.json — Liquid Glass tiers (subtle, standard, prominent)
components.tokens.json — component-level overrides
opacity.tokens.json — opacity scale
elevation.tokens.json — z-index layers and shadows
breakpoints.tokens.json — responsive breakpoints
TokenCSS VariableUsage
dark.bg--hu-bgPage background
dark.bg-surface--hu-bg-surfaceCard/panel surfaces
dark.bg-elevated--hu-bg-elevatedModals, popovers
dark.text--hu-textPrimary body text
dark.text-muted--hu-text-mutedSecondary text
dark.text-faint--hu-text-faintPlaceholder, hint text
dark.accent--hu-accentPrimary accent (Fidelity green)
dark.accent-secondary--hu-accent-secondarySecondary accent (amber)
dark.accent-tertiary--hu-accent-tertiaryTertiary accent (indigo)
dark.success--hu-successSuccess states
dark.warning--hu-warningWarning states
dark.error--hu-errorError states
dark.info--hu-infoInformational states
dark.border--hu-borderDefault borders
dark.border-subtle--hu-border-subtleSubtle dividers

Light theme tokens mirror dark theme with adjusted values for white backgrounds. Access via the same CSS variables — they swap automatically based on prefers-color-scheme or explicit theme class.

High contrast tokens maximize luminance ratios for users with low vision. All text/background pairs exceed 7:1 contrast ratio (WCAG AAA).

TokenValueCSS Variable
space.2xs0.25rem (4px)--hu-space-2xs
space.xs0.5rem (8px)--hu-space-xs
space.sm0.75rem (12px)--hu-space-sm
space.md1rem (16px)--hu-space-md
space.lg1.5rem (24px)--hu-space-lg
space.xl2rem (32px)--hu-space-xl
space.2xl3rem (48px)--hu-space-2xl
space.3xl4rem (64px)--hu-space-3xl
TokenValueCSS Variable
radius.xs4px--hu-radius-xs
radius.sm6px--hu-radius-sm
radius.md8px--hu-radius-md
radius.lg12px--hu-radius-lg
radius.xl16px--hu-radius-xl
radius.full9999px--hu-radius-full

Z-index layers are explicitly ordered to prevent stacking conflicts:

TokenValueUsage
z.base0Default content
z.raised100Sticky headers, raised cards
z.dropdown1000Dropdowns, select menus
z.sticky1100Sticky nav, toolbars
z.overlay1200Overlays, backdrops
z.modal1300Modal dialogs
z.popover1400Popovers, tooltips
z.toast1500Toast notifications
z.max9999Absolute top layer

Generate all platform outputs:

Terminal window
cd design-tokens && npx tsx build.ts

Outputs:

  • ui/src/styles/_tokens.css — CSS custom properties
  • website/src/styles/_tokens.css — Website CSS custom properties
  • apps/shared/.../DesignTokens.swift — Swift Color/CGFloat constants
  • apps/android/.../DesignTokens.kt — Kotlin Color/Dp constants
  • include/human/design_tokens.h — C preprocessor macros (256-color + truecolor)
  • docs/design-tokens-reference.json — Machine-readable reference for docs