Artifact 79ed15c8f4a19e1595b508e2c433e79229ee6e89cc958f38e7e70a6b2e45a358:
- File
docs/manual/themes.md
— part of check-in
[f99ea5c3ff]
at
2026-11-22 11:08:00
on branch ghostty-fixes
— tui: consume terminal replies, pick light or dark from OSC 11, signal when a reply is ready
The decoder consumes OSC, DCS, APC, PM and SOS replies while a probe is outstanding and every private CSI reply (DA1, DA2, DECRQM, kitty flags, colour scheme reports) always, so an answer never reaches the editor as an Escape and typed text. At start pic asks for the background colour and DA1, waits up to 150 ms for DA1, and keeps the reply window open for a second; the answer decides system and light/dark themes ahead of COLORFGBG. Focus reports (DECSET 1004) gate a BEL plus OSC 9 (OSC 777 in foot and VTE) when a turn ends; the notifyWhenDone setting turns it off. (user: dmestas, size: 1879) [annotate] [blame] [check-ins using] [more...]
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 so does system (the default). At start pic asks the
terminal for its background colour and picks light when the answer is a light colour; this works in
Ghostty, iTerm2, Terminal.app, kitty, WezTerm and Alacritty, and over SSH. A terminal 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 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. pic does not
generate Pi's terminal-palette system theme.
/reload re-reads the theme files and the theme setting.