Usage Guidelines
Do This
- ✓Use semantic tokens:
text-foreground - ✓Let tokens handle theme switching automatically
- ✓Follow color hierarchy (foreground → neutral-strong → neutral)
- ✓Use accent colors for interactive elements
Do not Do This
- ✗Avoid hard-coded colors:
#000000 - ✗Never use inline CSS variables in components
- ✗Do not mix semantic tokens with arbitrary colors
- ✗Avoid using surface colors for text
Text Colors
Semantic text color tokens for content hierarchy
Foreground
Primary text color - highest contrast
CSS Variable: --text-primary-color
Common Uses:
Neutral Strong
Secondary text with good contrast
CSS Variable: --text-secondary-color
Common Uses:
Neutral
Tertiary text with moderate contrast
CSS Variable: --text-tertiary-color
Common Uses:
Disabled
Disabled or inactive text
CSS Variable: --text-disabled-color
Common Uses:
Surface Colors
Background colors for elevation and layering
Background
Root background - deepest level
CSS Variable: --background-color
Common Uses:
Surface Sunken
Recessed surfaces below base level
CSS Variable: --surface-sunken-color
Common Uses:
Surface 1
Base surface level - primary containers
CSS Variable: --surface-1-color
Common Uses:
Surface 2
Raised surface - second elevation
CSS Variable: --surface-2-color
Common Uses:
Surface 3
Highest surface elevation
CSS Variable: --surface-3-color
Common Uses:
Border Colors
Border and divider tokens
Border
Default border color
CSS Variable: --border-color
Common Uses:
Border Muted
Subtle border with lower contrast
CSS Variable: --border-muted-color
Common Uses:
Accent Colors
Brand colors for interactive elements
Accent
Primary brand color
CSS Variable: --accent-color
Common Uses:
Accent Hover
Accent color hover state
CSS Variable: --accent-hover-color
Common Uses:
Status Colors
Semantic colors for state communication
Success
Success state indicator
CSS Variable: --success-color
Common Uses:
Warning
Warning state indicator
CSS Variable: --warning-color
Common Uses:
Error
Error state indicator
CSS Variable: --error-color
Common Uses:
Code Example
Here is how to properly use semantic tokens in your components:
// ✓ Correct - Using semantic tokens
<div className="bg-surface-1 border rounded-xl p-6">
<h2 className="text-foreground font-semibold mb-2">
Card Title
</h2>
<p className="text-neutral-strong">
Card description with secondary text
</p>
<button className="bg-accent hover:bg-accent-hover text-white px-4 py-2 rounded-lg">
Primary Action
</button>
</div>
// ✗ Incorrect - Hard-coded colors
<div style={{ backgroundColor: '#1a1a1a' }}>
<h2 style={{ color: '#ffffff' }}>Card Title</h2>
<p style={{ color: '#999999' }}>Card description</p>
</div>
// ✗ Incorrect - Inline CSS variables
<div style={{ backgroundColor: 'var(--surface-1-color)' }}>
<h2 style={{ color: 'var(--text-primary-color)' }}>Card Title</h2>
</div>Need Help Migrating?
Check out our comprehensive token migration guide with complete before/after examples and common patterns.
View Migration Guide →