Color Guidance
Generate tonal color palettes and the canonical CSS-variable contract for light and dark themes.
Overview
Morpha UI's color system is built on tonal palettes — Primary (purple #8265bd),
Secondary (blue #536b9d), Error, Neutral and Neutral Variant — each with tones from
0 (white) to 1000 (black). From these tones we derive a set of semantic roles
for light and dark themes.
The semantic layer follows Material-style (MD3) roles sourced from Figma — --primary,
--on-primary, --primary-container, --secondary, --surface*, --on-surface, --outline,
the *-fixed family, category colors and more — for richer, app-level surfaces. Generic base
tokens (--background, --foreground) keep shadcn/Base UI components working; components consume
the MD3 roles directly rather than the classic shadcn --card / --muted / --accent set.
Token Contract
Every color is exposed as a CSS custom property and, where useful, as a Tailwind color utility:
- Tonal scales →
--primary-500(raw) and--color-primary-500(utility, e.g.bg-primary-500). - Semantic roles →
--primary/--color-primary(utilitybg-primary),--surface,--on-surface, …
Tonal palettes are theme-independent; semantic roles change between :root (light) and
.dark. Switch to Semantic roles in the generator below for the full light/dark table.
Interactive Generator
Set a primary and a secondary color — the tonal scales and the semantic roles all regenerate from your choice. Neutral Variant auto-tints to the primary hue (so outlines and muted foregrounds follow the brand); Neutral and Error stay fixed. Use Download global.css to grab a clean, themed stylesheet that reflects your selection.
Primary
Brand purple. Drives primary actions, focus rings and links.
Secondary
Brand blue. Accent moments, gradients and secondary emphasis.
Neutral Variant
Auto-tinted to the primary hue.
Error
Destructive / error states.
Neutral
Surfaces, text and borders. The backbone of the UI.
Usage
-
Install the theme with the Morpha CLI — it writes the canonical token set (the full
@theme inline+:root+.dark) directly into your global CSS (resolved fromcomponents.json→tailwind.css). By default it overwrites that file, keeping your@importlines; no manual@importneeded, and re-running is idempotent:npx morpha-ui@latest add themepnpm dlx morpha-ui@latest add themebunx --bun morpha-ui@latest add themePass
--primary <#hex>(and optionally--secondary <#hex>) to apply a re-themed palette,--mergeto keep your existing CSS (theme goes in a managed block instead of overwriting), or--dry-runto preview without writing. -
Use the tokens through Tailwind utilities (
bg-primary,text-on-surface,bg-primary-500) or directly as variables (background: var(--surface)).
Because the semantic set matches shadcn's, components installed from the Morpha CLI inherit this theme automatically.