# Themes

> Pick a colour theme for Line CLI, let it follow your terminal's light or dark background, or write your own.

Line draws everything with a theme: a set of named colour slots. Pick one with `/theme` in the agent (it previews live as you move through the list) or from the shell:

```bash
line theme list          # all themes, the current one and where the choice came from
line theme set <name>    # save it in settings (theme = "<name>")
line theme show [name]   # the colours of a theme, slot by slot
```

## Built-in themes

| Theme | For |
| --- | --- |
| `clatter-dark` | Clatter green on a dark terminal (the default) |
| `clatter-light` | Light terminal backgrounds |
| `dark-colorblind` | Dark, with blue/orange diffs instead of green/red |
| `light-colorblind` | Light, with blue/orange diffs instead of green/red |
| `high-contrast` | Maximum contrast on dark backgrounds |
| `ansi` | Your terminal's own 16 colours (follows your terminal scheme, no 24-bit colour needed) |
| `mono` | No colour at all |

## How the theme is chosen

The first match wins:

1. `LINE_THEME` in the environment.
2. `NO_COLOR` set (to anything): `mono`.
3. The `theme` setting, unless it is empty or `auto`.
4. Auto:
   - Apple Terminal without 24-bit colour, and the Linux console, get `ansi`.
   - Otherwise Line asks the terminal for its background colour when it starts (it waits at most 200 ms and never blocks a terminal that doesn't answer). On a light background it uses `clatter-light`. When the terminal doesn't answer, `COLORFGBG` is used if it is set. The fallback is `clatter-dark`.
   - The Windows console keeps the dark default. Pick `clatter-light` with `/theme` if your Windows terminal is light.

## Custom themes

A custom theme is a JSON file in `~/.line/themes/<name>.json`. It can start from a built-in theme with `extends` and change only some slots:

```json ~/.line/themes/teal.json
{
  "extends": "clatter-light",
  "colors": {
    "accent": "#0b7a75",
    "diff_add_bg": "#e6f4ea",
    "diff_del_bg": "#fde8e8",
    "warning": "yellow"
  }
}
```

A colour is `#rrggbb` or an ANSI colour name (`black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, their `bright-` variants, `gray`, `reset`). Then use it with `line theme set <name>` or `/theme`.

### Slots

| Slot | Used for |
| --- | --- |
| `accent`, `accent_dim` | The Line accent: prompt marker, spinner, headings, success marks |
| `text`, `text_strong` | Body text and emphasis |
| `muted`, `dim`, `faint` | Secondary text, hints, borders and rules |
| `error`, `warning`, `success` | Messages and tool states |
| `code` | Inline code and code blocks |
| `border`, `border_busy` | The input box, idle and while Line works |
| `plan` | Plan mode |
| `added`, `removed` | `+`/`-` counts in the status bar |
| `diff_add_fg`, `diff_add_bg`, `diff_del_fg`, `diff_del_bg` | Diff lines |

<Tip>
`line theme show <name>` prints every slot of a theme as a swatch, which is a quick way to check a custom theme.
</Tip>
