# Themes

> Restyle every component and block at once. Start from a ready-made theme or build your own in the theme builder, then apply it with one command.

## How theming works

Components and blocks never hard-code colors. They use semantic classes such as `bg-background`, `bg-primary` and `text-muted-foreground`, and each class reads a CSS variable from your global stylesheet:

```css title="app/globals.css"
:root {
  --background: oklch(1 0 0);
  --primary: oklch(0.205 0 0);
  --radius: 0.625rem;
  /* … */
}

.dark {
  --background: oklch(0.145 0 0);
  --primary: oklch(0.922 0 0);
  /* … */
}
```

`:root` holds the light mode values and `.dark` the dark mode values. Change the variables and every component and block follows, in both modes. Fonts and corner radius work the same way.

## Build a theme

Open the [theme builder](https://pro.shadcn.co/themes). Every choice is previewed live on real components:

| Option | What it sets |
|---|---|
| Theme | One of 18 ready-made themes, such as Graphite, Aurora or Paper. Picking one sets every option below. |
| Style | The shape of the components: Vega, Nova, Maia, Lyra, Mira, Luma, Sera or Rhea. |
| Base Color | The grays used for backgrounds, borders and text. |
| Accent | The primary color for buttons, links and focus rings. |
| Chart Color | The palette for charts. |
| Heading and Font | The heading and body fonts. |
| Icon Library | Lucide, Tabler Icons, Hugeicons, Phosphor Icons or Remix Icon. |
| Radius | How rounded the corners are. |
| Menu and Menu Accent | How menus and their highlighted items look. |

Themes are free to use: they install without a license key.

## Apply a theme

When the preview looks right, click **Export theme**. It offers three ways to use the theme.

### New project

Choose a framework template, Radix or Base UI, and options such as RTL support. Then copy the command, which creates the project with the theme already applied:

```bash
npx shadcn@latest init --preset <code> --template next
```

`<code>` is the preset code of your theme. With a ready-made theme, the dialog shows a second command that adds the theme's colors. Run it inside the new project:

```bash
npx shadcn@latest add https://pro.shadcn.co/r/themes/aurora.json
```

### Existing project

Choose **Full preset**, **Theme only** or **Fonts only**, and run the command in your project:

```bash
npx shadcn@latest apply --preset <code>
```

A ready-made theme installs from its own URL instead, for example `npx shadcn@latest add https://pro.shadcn.co/r/themes/aurora.json`. Commit your work first, so you can review what the command changed.

### CSS variables

The **Theme** tab shows the theme as CSS variables. Paste them over the `:root` and `.dark` blocks in your global stylesheet, `app/globals.css` in Next.js or `src/index.css` in Vite. Keep the rest of the file, including `@import "tailwindcss"` and the `@theme inline` block.

## Themes in Figma

The [Figma kit](https://pro.shadcn.co/docs/figma-kit) uses the same variable names as the CSS, so designers and developers talk about the same `primary` and `radius`. To bring the colors, radius and fonts of a Figma file into your project, use the [`/import-variables`](https://pro.shadcn.co/docs/agent-skills/import-variables) Agent Skill.

## Apply a theme from your AI editor

With the [MCP server](https://pro.shadcn.co/docs/mcp/introduction) connected, your agent can apply any base color (neutral, stone, zinc, mauve, olive, mist or taupe) or accent color (such as blue, violet or emerald):

- Apply the violet theme from shadcnpro to this project, on the zinc base color.
- Switch this project to the stone base color and make the corners more rounded.
- Change the primary color to our brand blue, #2563EB, in light and dark mode.
