--- title: Theming description: Use CSS Variables to customize the look and feel of your application. --- You can choose between using CSS variables or Tailwind CSS utility classes for theming. ## Utility classes ```html /bg-zinc-950/ /text-zinc-50/ /dark:bg-white/ /dark:text-zinc-950/
``` To use utility classes for theming set `tailwind.cssVariables` to `false` in your `components.json` file. ```json {7} title="components.json" { "style": "default", "tailwind": { "config": "tailwind.config.js", "css": "app/globals.css", "baseColor": "slate", "cssVariables": false }, "aliases": { "components": "@/components", "utils": "@/lib/utils" } } ``` ## CSS Variables ```html /bg-background/ /text-foreground/
``` To use CSS variables for theming set `tailwind.cssVariables` to `true` in your `components.json` file. ```json {7} title="components.json" { "style": "default", "tailwind": { "config": "tailwind.config.js", "css": "app/globals.css", "baseColor": "slate", "cssVariables": true }, "aliases": { "components": "@/components", "utils": "@/lib/utils" } } ``` ### Convention We use a simple `background` 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. Given the following CSS variables: ```css --primary: 222.2 47.4% 11.2%; --primary-foreground: 210 40% 98%; ``` The `background` color of the following component will be `hsl(var(--primary))` and the `foreground` color will be `hsl(var(--primary-foreground))`. ```html
Hello
``` **CSS variables must be defined without color space function**. See the [Tailwind CSS documentation](https://tailwindcss.com/docs/customizing-colors#using-css-variables) for more information. ### List of variables Here's the list of variables available for customization: ```css /* Default background color of ...etc */ --background: 0 0% 100%; --foreground: 222.2 47.4% 11.2%; ``` ```css /* Muted backgrounds such as , and */ --muted: 210 40% 96.1%; --muted-foreground: 215.4 16.3% 46.9%; ``` ```css /* Background color for */ --card: 0 0% 100%; --card-foreground: 222.2 47.4% 11.2%; ``` ```css /* Background color for popovers such as , , */ --popover: 0 0% 100%; --popover-foreground: 222.2 47.4% 11.2%; ``` ```css /* Default border color */ --border: 214.3 31.8% 91.4%; ``` ```css /* Border color for inputs such as ,