Theming Approaches
You can choose between two approaches for theming:CSS Variables (Recommended)
tailwind.cssVariables to true in your components.json file.
components.json
Utility Classes
tailwind.cssVariables to false in your components.json file.
components.json
Color Convention
We use a simplebackground and foreground convention for colors. The background variable is used for the background color of the component and the foreground variable is used for the text color.
The
background suffix is omitted when the variable is used for the background color of the component.background color of the following component will be var(--primary) and the foreground color will be var(--primary-foreground).
Available CSS Variables
Here’s the complete list of CSS variables available for customization:app/globals.css
Adding New Colors
To add new colors, add them to your CSS file under the:root and dark pseudo-classes, then use the @theme inline directive to make them available as CSS variables.
app/globals.css
warning utility class in your components:
Base Color Palettes
Shadcn/ui provides several base color palettes to choose from:- Tab Title
- Tab Title
- Tab Title
- Tab Title
- Tab Title
The default neutral color palette with minimal hue.
app/globals.css
Color Formats
Shadcn/ui uses the OKLCH color format by default, which provides better perceptual uniformity than RGB or HSL. However, you can use any color format supported by Tailwind CSS. For more information on color formats, see the Tailwind CSS documentation.Border Radius
The--radius variable controls the default border radius for components: