Skip to content
pi-c Artifact [7a3c3e0105]
Login

Artifact [7a3c3e0105]

Artifact 7a3c3e01058efe26953fdb1f9ce8f1bf50d740a69657cf0cd89e0ed1661e0e90:


# Themes

The terminal interface uses Pi's theme model (`packages/coding-agent` `theme.ts`, `dark.json`,
`light.json`). Every colour is one of Pi's 51 tokens (`accent`, `border*`, `userMessage*`, `tool*`,
`md*`, `syntax*`, `toolDiff*`, `thinking*`, `bashMode`, ...); the built-in `dark` and `light` themes
are Pi's files and their OKHSL values convert to the same sRGB as Pi's `okhslToRgb`. Colours are
truecolor when `COLORTERM` says so and otherwise the nearest of 256, chosen as Pi's `rgbToAnsi256`
does.

## Choosing one

`--theme NAME` (or `--use-theme`) for one run; the `theme` setting, set in `/settings` (Theme opens
a picker that previews as you move and saves on enter) or with `pic settings theme dark`.
`light/dark` picks by the terminal, and `system` (the default) adapts to the terminal's own colours.
At start pic asks the terminal for its foreground, background and 16-colour ANSI palette (OSC 10,
OSC 11 and OSC 4); this works in Ghostty, iTerm2, kitty, WezTerm, Alacritty and xterm, and over SSH.
When the terminal answers with its background and ANSI 0-15 palette, `system` generates Pi's OKHSL
terminal-palette theme with WCAG contrast floors against the reported background. A terminal that
answers only its background picks the built-in `light` or `dark` theme by that background; one that
does not answer within a moment falls back to Pi's rule: light when `COLORFGBG` names a background
of 7 or 9-15, else dark. An explicit theme (`dark`, `light`, `light/dark` or a custom one) is never
overridden. Text already printed to the scrollback keeps the colours it was drawn with.

## Custom themes

JSON files in Pi's schema (`name`, optional `appearance`, `vars`, `colors`, `export`; colours as
`#rgb`/`#rrggbb`, `oklch()`, `okhsl()`, a 0-255 index, `""` for the terminal's default, or a
variable) in `~/.pic/themes/*.json`, and in the workspace's `.pic/themes/` only once it is trusted.
They are read through the input reader. An invalid file is reported with Pi's messages (missing
tokens, bad variables) and skipped; of two themes with one name the user's wins.

`/reload` re-reads the theme files and the theme setting.