shadcn/ui Theme Generator
Generate custom shadcn/ui themes with CSS variables for light and dark mode. Copy-paste into your globals.css.
Examples
Convert the Blue preset primary
#3b82f6217 91% 60%The rounded HSL channels become the light-mode --primary value; the dark primary uses the same hue and saturation at 55% lightness.
Convert a Green primary
#22c55e142 71% 45%Because the lightness is below 50%, the light theme pairs this primary with a near-white foreground.
Convert the Slate preset primary
#64748b215 16% 47%The generator rounds the converted channels to integers before placing them in CSS custom properties.
About this tool
The shadcn/ui Theme Generator converts five chosen hex colors into HSL-channel CSS custom properties for light and dark interfaces. It emits the classic background, foreground, card, popover, primary, secondary, muted, accent, destructive, border, input, ring and radius tokens inside an @layer base block.
Choose one of six presets or adjust Primary, Secondary, Accent, Muted and Destructive with native color pickers. The converter rounds hue, saturation and lightness to whole numbers, derives foreground colors with a lightness heuristic, and creates darker variants by clamping or offsetting the selected lightness values.
The side-by-side preview helps compare the generated light and dark palettes before copying the CSS into globals.css. Because foreground selection is not a contrast audit, verify important text and controls against your accessibility targets after generation.
How to use
Start from a preset
Choose Default, Blue, Green, Orange, Rose or Slate to load a coordinated starting palette and radius.
Tune the semantic colors
Use the five color pickers to adjust primary actions, secondary surfaces, accents, muted surfaces and destructive states.
Adjust the radius
Move the radius slider from 0 to 2rem in 0.125rem steps and inspect the simulated controls in both previews.
Copy the CSS
Review the generated :root and .dark token blocks, copy them, and integrate them into the base layer of globals.css.
Use cases
Bootstrapping a new shadcn/ui application
Generate a coherent initial token set before building components and page layouts.
Creating branded light and dark modes
Translate brand colors into both theme blocks while keeping the same semantic token names.
Prototyping palette alternatives
Switch presets and color inputs quickly to compare visual directions without hand-editing dozens of CSS variables.
Standardizing border radius
Set one shared radius token and preview how it affects buttons, panels and other rounded surfaces.
Common mistakes
Mistake:Treating generated foreground colors as guaranteed accessible.
Fix:Measure contrast for text, icons and controls; the generator uses only a simple lightness threshold.
Mistake:Pasting the channel values into CSS as standalone colors.
Fix:Consume tokens in the convention expected by the app, commonly hsl(var(--primary)), because values such as 217 91% 60% are HSL channels.
Mistake:Expecting every modern shadcn token to be generated.
Fix:Add any project-specific chart, sidebar or status tokens manually after copying the fixed token set.
Mistake:Assuming hex-to-HSL conversion is lossless.
Fix:Expect small differences because hue, saturation and lightness are rounded to whole numbers.
Frequently asked questions
Related guides
References & standards
Related tools
Aspect Ratio Calculator
Calculate dimensions and ratios for images and videos.
Border Radius Generator
Visually craft CSS border-radius values — including the advanced 8-value slash syntax for organic blob shapes — with a live preview and one-click copy.
Box Shadow Generator
Visual CSS box-shadow generator. Create beautiful shadows with live preview and copy the CSS code.
CSS Grid Generator
Visually build CSS Grid layouts — set columns, rows and gaps, see a live preview, and copy production-ready grid-template CSS.
Cubic Bezier / Easing Generator
Build a CSS cubic-bezier() timing function visually — drag control points, preview common presets, see the easing curve live, and copy the transition-timing-function CSS.
Dummy Avatar Generator
Generate unique SVG avatars for mockups and placeholders using various illustration styles