Design System
Palette, semantic tokens and components — and how themes and dark mode change them.
How It Works
-
1 · Palette
Raw scales, 50–950
-
2 · Semantic tokens
Roles, named by meaning
brand-fill→ blue-500surface-card→ white · grey-950 -
3 · Components
Read only the roles
Active
The Default Theme
Needs no attribute. A custom theme gets its own data-theme.
- Theme
- Default
data-theme="default" - Font family
- Onest, system-ui, sans-serif
- Radius (lg)
- 16px
Dark Mode
Add .dark to <html>; every role switches.
Analytics overview
Revenue is up 12% this week.
Switch and remember the mode
<!-- Toggle dark mode -->
<script>
function toggleDarkMode() {
const html = document.documentElement;
html.classList.toggle('dark');
localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
}
</script>
<!-- Restore on page load (put in <head>) -->
<script>
const mode = localStorage.getItem('theme');
if (mode === 'dark' ||
(!mode && matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
}
</script>
Custom Theme
Build one in Studio, or write the JSON.
json
- Create
themes/my-theme.json - Run the build
- Apply it with
data-theme="my-theme"
{
"name": "my-theme",
"label": "My Theme",
"fontFamily": "Poppins, system-ui, sans-serif",
"radius": { "sm": "8px", "lg": "12px", "xl": "16px", "2xl": "20px", "3xl": "24px" },
"colors": {
"foregroundPrimary": "240 3% 6%",
"surfacePage": "0 0% 98%",
"surfaceCard": "0 0% 100%",
"borderDefault": "0 5% 92%",
"infoFill": "219 88% 54%",
...
},
"dark": { "colors": { "foregroundPrimary": "0 0% 98%", ... } }
}
Theme Exports
The Default theme in portable formats.
| Theme | CSS variables | Tailwind v4 | Design Tokens (DTCG) | theme.json |
|---|---|---|---|---|
default |
default.vars.css | default.tailwind.css | default.tokens.json | default.json |
*.vars.css— plain custom properties, light and dark*.tailwind.css— a Tailwind v4@theme*.tokens.json— W3C Design Tokens, for Style Dictionary and Tokens Studio*.json— Veritheme's theme.json, for Studio and the Figma plugin
Override Order
Later layers win.
| # | Layer | Sets | Changed by |
|---|---|---|---|
| 1 | Theme | Font, radius, color roles | data-theme |
| 2 | Dark mode | Color roles for dark | .dark |
| 3 | Components | Read the roles | Variant classes |
| 4 | Utilities | Layout | Your markup |