# Theme tokens

> The color tokens audio/ui adds to the shadcn/ui theme: semantic states, and the audio tokens a skin sets to change the material of a control.

## Overview

audio/ui adds semantic color tokens to the shadcn/ui theme, for states such as alerts and badges.

Standard shadcn/ui themes work too. The custom tokens keep contrast consistent across these states.

## Extended Tokens

To support advanced state communication, we extend the base palette with additional semantic tokens:

- `--destructive-foreground`: Foreground color specifically for destructive actions.
- `--info` & `--info-foreground`: Background and text colors for informational states.
- `--success` & `--success-foreground`: Background and text colors for success/positive outcomes.
- `--warning` & `--warning-foreground`: Background and text colors for cautionary states.
- `--invert` & `--invert-foreground`: Background and text colors for invert states.

```css title="app/globals.css"
@theme inline {
  --color-destructive-foreground: var(--destructive-foreground);
  --color-info: var(--info);
  --color-info-foreground: var(--info-foreground);
  --color-success: var(--success);
  --color-success-foreground: var(--success-foreground);
  --color-warning: var(--warning);
  --color-warning-foreground: var(--warning-foreground);
  --color-invert: var(--invert);
  --color-invert-foreground: var(--invert-foreground);
}

:root {
  --destructive-foreground: var(--color-red-800);
  --info: var(--color-violet-500);
  --info-foreground: var(--color-violet-900);
  --success: var(--color-emerald-500);
  --success-foreground: var(--color-emerald-900);
  --warning: var(--color-yellow-500);
  --warning-foreground: var(--color-yellow-900);
  --invert: var(--color-zinc-900);
  --invert-foreground: var(--color-zinc-50);
}

.dark {
  --destructive-foreground: var(--color-red-600);
  --info: var(--color-violet-500);
  --info-foreground: var(--color-violet-600);
  --success: var(--color-emerald-500);
  --success-foreground: var(--color-emerald-600);
  --warning: var(--color-yellow-500);
  --warning-foreground: var(--color-yellow-600);
  --invert: var(--color-zinc-700);
  --invert-foreground: var(--color-zinc-50);
}
```

## Audio Tokens

The knob, the fader and the meter take their colors from audio tokens, each named after the material it paints. None is defined by default: each falls back to the shadcn token it replaces, so an install looks the same until a token is set.

| Token | Material | Paints | Default |
| --- | --- | --- | --- |
| `--audio-socket` | The ring a knob turns in | Knob control | `--secondary` |
| `--audio-cap` | What the hand holds | Knob body, fader thumb | `--card` |
| `--audio-groove` | The slot a value runs in | Fader track, meter channel | `--input` |
| `--audio-accent` | The value | Knob arc and indicator, fader range and thumb mark, an active tick | `--primary` |
| `--audio-print` | Scales printed on the panel | Ticks, scale labels, meter marks | `--muted-foreground` |
| `--audio-readout` | A value shown on demand | Value chips, the active scale label, the meter's peak | `--foreground` |
| `--audio-readout-ink` | The text on a readout | Value chips | `--background` |
| `--audio-level` | A signal in range | Meter fill | `--success` |
| `--audio-warn` | A signal near its limit | Meter fill | `--warning` |
| `--audio-clip` | A signal over its limit | Meter fill | `--destructive` |

Set them on any element to restyle what it holds, in both color schemes:

```css title="app/globals.css"
.hardware {
  --audio-socket: oklch(0.9 0.01 85);
  --audio-cap: oklch(0.97 0.01 85);
  --audio-groove: oklch(0.32 0.01 85);
  --audio-accent: oklch(0.66 0.2 40);
  --audio-print: oklch(0.45 0.01 85);
}
```

A token changes a color, never a behavior: the controls keep their keyboard, pointer and ARIA whatever they wear.

## Skins

A skin is tokens and materials, drawn on the elements' own parts: the knob, the fader, the meter, the XY pad, the envelope, the pads, the piano and the device panels. It changes how a control looks, never its props, events or ARIA, and it is one sheet: React, Vue, Svelte and plain HTML read the same rules, so a skin looks the same in each.

Put the skin's class on the element that holds the controls, with `audio-body` for its surface:

```tsx
import { Knob } from "@/components/audio-ui/knob"

<div className="skin-hardware audio-body rounded-2xl p-8">
  <Knob aria-label="Drive" defaultValue={30} />
</div>
```

In React, `**CLI**

```bash
npx shadcn@latest add @audio-ui/skin-hardware
```

**Manual**

**1. Install the following dependencies:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/react@0.1.0-beta.14
```

**2. Copy and paste the following code into your project.**

**3. Update the import paths to match your project setup.**

**Agent**

Paste this prompt to your agent. It does the rest: it installs the skill, adds the component and wires it to your audio.

```text
Install the audio/ui skill with `npx skills add ouestlabs/audio-ui`, then follow it to add the skin hardware from audio/ui to my project and wire it to my audio code. Read the docs at https://www.audio-ui.dev/llms.txt first.
```

To let the agent read the docs live, connect the [MCP server](/docs/mcp). More in [Agent Skill](/docs/agents).

` writes the skin into your Tailwind stylesheet. In every framework, the [CLI](/docs/cli) writes it as its plain sheet, `css/skin-hardware.css`, last in the index the app imports once:

```bash
npx @audio-ui/cli add knob skin-hardware
```

Both sheets are served at `https://www.audio-ui.dev/css/skins/` for a project that copies them by hand.

### Axes

A skin derives its audio tokens from a few axes. Set them on the skin's own element, with `style` or a selector more specific than the skin's class.

| Axis | What it sets | Default |
| --- | --- | --- |
| `--audio-shade` | The material. Every token follows from it, and a dark shade, of a lightness under 0.5, turns the skin dark | The skin's own, one for each color scheme |
| `--audio-accent` | The value | The skin's own, one for each color scheme |
| `--audio-ink` | The lettering and the printed scales | Derived from the shade |
| `--audio-depth` | How far a part stands out of the surface or sinks into it. `0` is flat | `1` |
| `--audio-roundness` | The corners the skin draws. `0` is square, `2` twice as round | `1` |

```tsx
<div
  className="skin-hardware audio-body rounded-2xl p-8"
  style={{ "--audio-shade": "oklch(0.55 0.08 60)", "--audio-accent": "oklch(0.8 0.15 90)" }}
>
  <Knob aria-label="Drive" defaultValue={30} />
</div>
```

The tokens are derived with relative colors (`oklch(from var(--audio-shade) …)`), which browsers support since 2024.

### Hardware

The Hardware skin is a matte body, dark inset screens, one accent and printed scales.

**CLI**

```bash
npx shadcn@latest add @audio-ui/skin-hardware
```

**Manual**

**1. Install the following dependencies:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/react@0.1.0-beta.14
```

**2. Copy and paste the following code into your project.**

**3. Update the import paths to match your project setup.**

**Agent**

Paste this prompt to your agent. It does the rest: it installs the skill, adds the component and wires it to your audio.

```text
Install the audio/ui skill with `npx skills add ouestlabs/audio-ui`, then follow it to add the skin hardware from audio/ui to my project and wire it to my audio code. Read the docs at https://www.audio-ui.dev/llms.txt first.
```

To let the agent read the docs live, connect the [MCP server](/docs/mcp). More in [Agent Skill](/docs/agents).

| Element | Drawn as |
| --- | --- |
| Knob | A matte cap lit from above in a dark socket, a needle in the lettering's color, its arc in the accent, and a printed scale of eleven ticks when it has no `marks` |
| Fader | A narrow slot with no range, and a ribbed cap whose middle rib is in the accent |
| Meter | Its level lit in segments, as a row of lamps, in the screen's ink, warning and clipping colors |
| XY pad, envelope | Screens set in the body: their grid, curve and cursor in the screen's ink and the accent |
| Pads | Caps to strike, lit from above, flashing in the accent |
| Piano | Ivory and ebony keys in the body, held in the accent |
| Device panels | Their frame takes the body, their graphs become screens |

### Neu

The Neu skin is one material lit from above: a knob is a dome pushed out of the surface, a pad is pushed up and pressed in while struck, a fader's groove, a meter's channel, the XY pad, the envelope and the keyboard are pressed into it, a device panel is a plate with its graphs sunk in.

**CLI**

```bash
npx shadcn@latest add @audio-ui/skin-neu
```

**Manual**

**1. Install the following dependencies:**

```bash
npm install @ui-sdk/core@0.1.0-beta.14 @ui-sdk/react@0.1.0-beta.14
```

**2. Copy and paste the following code into your project.**

**3. Update the import paths to match your project setup.**

**Agent**

Paste this prompt to your agent. It does the rest: it installs the skill, adds the component and wires it to your audio.

```text
Install the audio/ui skill with `npx skills add ouestlabs/audio-ui`, then follow it to add the skin neu from audio/ui to my project and wire it to my audio code. Read the docs at https://www.audio-ui.dev/llms.txt first.
```

To let the agent read the docs live, connect the [MCP server](/docs/mcp). More in [Agent Skill](/docs/agents).

Its shadows are the material multiplied by itself and its light the material screened with itself, so a warm shade casts warm shadows. `--audio-depth` sets how far the parts stand out.

### Device panels

A device panel inside a skin wears it as it is: its frame takes the body, its graphs and pads change with the theme's colors the skin sets. The panels themselves do not change. `--audio-grid` is the width of a column of a panel with no groups, `4.5rem` by default. For faces of your own, give `DeviceFacesProvider` from `@/components/audio-ui/device-faces` a `Knob` or a `Fader` with the element's props.

### Materials

| Class | Material |
| --- | --- |
| `audio-body` | The matte panel |
| `audio-screen` | A dark screen set into the body |
| `audio-cap` | What the hand holds, lit from above |
| `audio-groove` | The slot a value runs in |
| `audio-print` | Lettering printed on the body |
| `audio-lamp`, `audio-lamp-on` | A lamp, off and lit |

The skin adds three tokens to the audio tokens: `--audio-body`, `--audio-screen` and `--audio-screen-ink`. Each material takes its light from the skin: `--audio-body-shadow`, `--audio-screen-shadow`, `--audio-cap-image`, `--audio-cap-shadow` and `--audio-groove-shadow`.

For general customization guidelines such as adding your own custom colors or switching between utility classes and variables, please refer to the [official shadcn/ui documentation](https://ui.shadcn.com/docs/theming).
