# Import variables

> Write the variables of a Figma file into your global stylesheet, with colors for light and dark mode, radius and fonts, converted exactly and merged one variable at a time.

## Usage

### Copy a link to your Figma file

Open your copy of the [Figma kit](https://pro.shadcn.co/docs/figma-kit), or the file that holds your variables, and copy its link from the browser's address bar or with **Share → Copy link**.

### Run the skill

In your editor's chat, run the skill with the link:

```text title="Prompt"
/shadcnpro-import-variables https://figma.com/design/abc123/Kit
```

### Pick the mode

The kit has one mode per style, such as Vega and Nova, plus any brand mode you added. The agent lists them and asks which one to import.

### Check the summary

The agent updates your global stylesheet and reports every variable it changed, added or skipped, with the old and the new value. Read it before you commit.

## What gets written

### Colors

Every theme color, such as `background`, `primary` and `border`, gets its value from Figma, in the format your stylesheet already uses: OKLCH, HSL or hex. Light mode values go in `:root` and dark mode values in `.dark`:

```css title="app/globals.css"
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --primary: oklch(0.491 0.241 292.6);
  --primary-foreground: oklch(0.985 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --primary: oklch(0.709 0.159 293.5);
  --primary-foreground: oklch(0.145 0 0);
}
```

The agent converts colors with a script, never by estimate. Each value it writes turns back into exactly the color in Figma.

### Radius

A shadcn/ui project defines one `--radius` and derives the steps from it, so `rounded-md` and `rounded-xl` follow on their own. The skill sets `--radius` from the kit's radius, converted from pixels to rem, and tells you if a step in Figma differs from what your project derives.

### Fonts

A font variable in Figma holds a family name, and a name in a CSS variable doesn't load a font. So the skill compares the families with the fonts your project loads. When they differ, it asks first, then installs the font the way your project loads fonts, for example with `next/font` in Next.js.

### Shadows

Shadows in Figma are effect styles, not variables, and shadcn/ui uses the default shadows of Tailwind CSS. The skill imports them only when you ask, or when your stylesheet already defines its own `--shadow-*` values.

## Two ways to read a file

| | Whole file | One frame |
|---|---|---|
| Reads | Every variable, in the modes you pick | Only the variables that frame uses, in the modes it is set to |
| Needs | The remote Figma MCP server, edit access and a Figma plan that lets agents work in files | View access, with the remote or the desktop server |

The skill reads the whole file when it can, and tells you when it has to fall back to a frame. For the frame route, copy a link to a frame that uses many components, such as a style guide or a full screen: right-click it and choose **Copy link to selection**.

The skill never changes your Figma file. Reading a whole file uses the same Figma tool as writing to it, which is why it needs the same access. See [Skills that write to Figma](https://pro.shadcn.co/docs/agent-skills/setup#skills-that-write-to-figma).

## Light and dark mode

Reading the whole file returns both modes, so one import writes `:root` and `.dark` together.

A frame only returns the mode it is set to. To import both, give the agent two links: the frame in light mode and the same frame in dark mode. With one link, the skill updates only that mode and leaves the other as it is. It never works out dark values from light ones.

## What stays the same

The skill replaces the value of a variable that exists and adds one that is missing. Everything else stays exactly as it is:

- variables that aren't in Figma, including your own tokens
- the order of the variables and your comments
- the `@import` lines, `@custom-variant`, the `@theme inline` block and your base styles

You can run it as often as you like, for example each time a designer updates the variables. Commit your work first, so the diff shows exactly what the import changed.

## Questions

### Can I switch to another color format?

The skill writes the format your stylesheet already uses. To switch, for example from HSL to OKLCH, change the existing variables to the new format first, and the skill follows. For a new project, use OKLCH, which is what shadcn/ui uses.

### Does it work with a file that uses the kit as a library?

That file has no variables of its own. Give the agent the link to the library file, which is your copy of the kit, or a link to a frame in your file.

### What happens to variables that aren't theme tokens?

Spacing, breakpoints, type sizes and other extras aren't written, and the report lists them. Ask for a specific one if you want it in your stylesheet.

### How do I get my brand into Figma first?

[`/shadcnpro-create-brand-mode`](https://pro.shadcn.co/docs/agent-skills/create-brand-mode) adds your brand to the kit as its own mode. Import that mode afterwards, and Figma and code match.
