UI & Design SystemsBy PaletteKey Team 7 min read

Design System Color Tokens: Primitive vs Semantic Colors

Structure color architecture for scalability, multi-theme support, and UI consistency.

Key Technical Takeaway

Design system color architecture separates primitive scales from semantic usage tokens. Mapping UI components to semantic tokens (e.g., --color-surface-bg) rather than hardcoded hex values enables multi-theme switching.

The 3-Tier Color Token Architecture

Enterprise design systems organize color tokens across three distinct abstraction tiers: Primitives, Semantics, and Components.

Tier 1: Primitive Tokens  (Raw Values)  -> e.g. --blue-500: #2563EB;
Tier 2: Semantic Tokens   (Purpose/Role) -> e.g. --color-action-primary: var(--blue-500);
Tier 3: Component Tokens  (UI Specific)  -> e.g. --button-bg: var(--color-action-primary);

Primitive Tokens: The Raw Palette

Primitive tokens hold raw color values organized by hue family and shade step (e.g. `slate-100`, `blue-500`, `red-600`). Primitives should never be imported directly into UI components; they serve exclusively as building blocks for semantic tokens.

Semantic Tokens: Intent & Meaning

Semantic tokens communicate purpose rather than appearance. They define structural roles like surface backgrounds, body text, primary actions, borders, and status feedback.

Semantic Token CategoryExample Token NameLight Mode MappingDark Mode Mapping
Background Surface--surface-canvasvar(--slate-50)var(--slate-950)
Container Surface--surface-cardvar(--white)var(--slate-900)
Primary Text--text-mainvar(--slate-900)var(--slate-100)
Muted Text--text-mutedvar(--slate-600)var(--slate-400)
Border / Divider--border-subtlevar(--slate-200)var(--slate-800)
Primary Action--action-primaryvar(--blue-600)var(--blue-500)
Status Error--status-errorvar(--red-600)var(--red-500)

Code Example: CSS Custom Properties & W3C JSON Tokens

Expressing color tokens in CSS custom properties and W3C design token JSON formats:

/* CSS Custom Properties Syntax */
:root {
  /* Primitives */
  --blue-500: oklch(0.58 0.23 250);
  --slate-900: oklch(0.20 0.02 260);
  
  /* Semantics */
  --color-brand: var(--blue-500);
  --color-text-body: var(--slate-900);
}

/* W3C Design Token Specification Format (JSON) */
{
  "color": {
    "action": {
      "primary": {
        "$type": "color",
        "$value": "{color.blue.500}",
        "$description": "Primary interactive button background"
      }
    }
  }
}

Put Theory into Practice with Free Color Tools

Apply the concepts from this guide directly in your web workflow with our interactive tools.