shadcn/ui Theme Generator
Generate the CSS variables for a shadcn/ui theme from a primary colour, a neutral tint and a border radius. Light and dark modes are included in OKLCH, with the @theme inline mapping.
Use the tool
Why this tool exists
A shadcn/ui theme is a long list of CSS variables: background, foreground, card, popover, primary, secondary, muted, accent, destructive, border, input, ring, chart colours and sidebar tokens, each with a light and a dark value. Building a coherent set by hand takes a while, and a single poorly chosen foreground can make text unreadable.
Choose a primary colour, a neutral tint such as slate, zinc or stone, and a radius. The tool derives the rest, picks light or dark foreground text for the primary, creates dark-mode variants, and adds chart colours around the hue wheel. The @theme inline block maps the variables to Tailwind colour names. The result is a starting point, so check contrast in your own components. Nothing is uploaded.
How to use it
- Pick the primary colour.
- Choose a neutral tint: neutral, slate, zinc, stone or match primary.
- Set the radius, for example 0.625rem, and keep @theme inline ticked for Tailwind v4.
- Copy the CSS into your global stylesheet and look at the light and dark preview.
Frequently asked questions
Which versions does it target?
The variable names and OKLCH values follow the current shadcn/ui and Tailwind v4 conventions, including the @theme inline block. For older setups, you may need to adjust the format.
How is the foreground colour chosen?
For the primary colour, the tool uses dark text when the colour is light and near-white text when it is dark. Check contrast with the contrast checker for your actual components.
What does the neutral tint change?
It sets the hue and a small amount of colour in greys such as background, border and muted. Neutral is pure grey, while slate and others add a slight cool or warm tone.
Can I edit the result?
Yes, all values are plain CSS variables. Adjust any token, then keep light and dark pairs consistent so the interface stays readable.