Back to Openclaw

Color Tokens

ui/docs/design-system/color-tokens.md

2026.6.86.6 KB
Original Source

Color Tokens

All tokens are defined in ui/src/styles/base.css under :root (dark mode default) and :root[data-theme-mode="light"] (light override). Theme families may override accent tokens while keeping shared surface tokens.

Contrast ratios are measured against --bg (#0e1015) in dark mode using WCAG relative luminance formula. AA requires ≥4.5:1 for normal text, ≥3:1 for large text and UI components.


Background Scale

TokenDark ValueLight ValueUseDon't
--bg#0e1015#f8f9faPage root, deepest layerNever use on elevated surfaces
--bg-accent#13151b#f1f3f5Sidebar, secondary panelsNot for interactive card hover
--bg-elevated#191c24#ffffffRaised panels, modalsNot for inline elements
--bg-hover#1f2330#eceef0List item hover stateNot for default state
--bg-muted#1f2330#eceef0Subtle fills, disabled statesNot for focus states

Surface / Card

TokenDark ValueLight ValueUseDon't
--card#161920#ffffffCard backgrounds, composerAvoid as border
--card-foreground#f0f0f2#1a1a1eText on cards
--card-highlightrgba(255,255,255,0.04)rgba(0,0,0,0.02)Inner highlight on hoverNot for text
--popover#191c24#ffffffDropdown, tooltip backgrounds
--popover-foreground#f0f0f2#1a1a1eText inside popovers

Text

TokenDark ValueContrast on --bgUse
--text#d4d4d8~12.9:1 ✅Body copy, labels
--text-strong#f4f4f5~17.3:1 ✅Headings, emphasis
--muted#838387~5.0:1 ✅Placeholder, metadata
--muted-strong#75757d~4.2:1Secondary text, captions; avoid for normal body text

Accent (Primary — Red)

TokenValueUseDon't
--accent#ff5c5cPrimary CTA, send button, active tab indicatorDon't use for large filled backgrounds
--accent-hover#ff7070Hover state of accent elements
--accent-muted#ff5c5cSame as accent (aliased)
--accent-subtlergba(255,92,92,0.1)Badge backgrounds, tinted fillsNot for text on dark bg (fails contrast)
--accent-glowrgba(255,92,92,0.2)Focus rings, glow effectsNot as background
--primary#ff5c5cComponent library primary alias

Accent 2 (Teal)

TokenValueUse
--accent-2#14b8a6Success-adjacent status, secondary badges
--accent-2-mutedrgba(20,184,166,0.7)Subtle teal fills
--accent-2-subtlergba(20,184,166,0.1)Tinted teal background

Semantic

TokenDark ValueLight ValueContrast on --bgUse
--ok#22c55e#15803d~8.4:1 ✅Success states, token meter low
--warn#f59e0b#d97706~8.9:1 ✅Warnings, degraded states
--danger#ef4444#dc2626~5.1:1 ✅Errors, destructive actions, token meter high
--info#3b82f6#2563eb~5.2:1 ✅Informational, token meter mid
--destructive#ef4444~5.1:1 ✅Destructive action labels

Border

TokenValueUse
--border#1e2028Default subtle borders, dividers
--border-strong#2e3040Active/focused borders
--border-hover#3e4050Hover-state borders

Focus

TokenValueUse
--ring#ff5c5cFocus ring colour
--focus-ring0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ring) 80%, transparent)Standard focus ring box-shadow
--focus-glow0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow)Elevated interactive elements

Anti-Patterns

  • ❌ Hardcoded hex colours in component CSS — always use tokens
  • --accent-subtle as text colour — fails contrast on dark backgrounds
  • ❌ Mixing --ok and --accent-2 for "green success" — use --ok only
  • ❌ Using --danger for non-error states (e.g. "hot feature") — reserve for errors and destructive actions
  • --muted-strong for normal body text — below 4.5:1 on dark --bg; use --text instead