How semantic color tokens make large base-ui systems easier to scale
A systematic approach to decoupling primitive color palettes from component intent, preventing token drift and streamlining multi-brand themes.
Ali Raza
Lead Systems Architect at Ziilink AI
The Fragility of Primitive Tokens
In early-stage codebases, referencing color primitives directly inside component styles is deceptively convenient. Writing `bg-orange-600` or `text-neutral-400` works fine until the design team introduces high-contrast accessibility modes, brand white-labeling, or dark theme inversions.
Once you have hundreds of components hardcoded to primitive values, adjusting the primary action color or surface elevation requires mass refactors with high regression risks.
The Anti-Pattern
Never use primitive color tokens (e.g. gray-900, orange-500) directly in component templates. Always route through a semantic intent layer.
A 3-Tier Token Architecture
At Ziilink AI, we structure our tokens into three explicit tiers to ensure maintainability across web and native clients:
- Tier 1: Global Primitives — Raw color scales with no semantic meaning (e.g., brand-500: #FC3B10, neutral-950: #050201).
- Tier 2: Semantic Intent Tokens — Purpose-driven abstractions mapping to primitives (e.g., bg-surface, text-ink, border-line, accent-primary).
- Tier 3: Component Scoped Tokens — Context-specific variables for complex compound components (e.g., button-primary-bg-hover, chat-bubble-agent).
@theme {
/* Tier 1: Primitives */
--color-brand-orange: #fc3b10;
--color-ground-dark: #050201;
/* Tier 2: Semantic Aliases */
--color-primary: var(--color-brand-orange);
--color-ground: var(--color-ground-dark);
--color-surface: #0e0503;
--color-line: #2d140e;
--color-ink: #ffffff;
--color-muted: #a39591;
}Scaling Without Breaking Changes
By strictly decoupling semantics from visual primitives, engineers can redesign entire brand expressions or introduce specialized client-branded themes in minutes simply by overriding the Tier 2 layer, leaving all component markup untouched.
This architectural discipline provides the rock-solid foundation needed for studio-grade interfaces that age gracefully.
Enjoyed this article?
Help other engineers discover it with a like or share.
Comments (0)