Light terminal themes: use the terminal's text color too

On a light background (Catppuccin Latte in Ghostty on macOS) the panes
kept palette color 0, a dark grey slab with white text. The probe now also
asks for the text color (OSC 10). Light backgrounds are used as well, with
text, borders and titles in the terminal's text color, input fields and
buttons in a light shade of it, and the active tab drawn in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
2026-10-21 11:59:44 +02:00
co-authored by Claude Opus 5.5
parent d2e868293f
commit 08d3417b05
6 changed files with 114 additions and 50 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ Layout sketch (Library view; the other views follow the same frame):
Popups for action feedback appear in the bottom right and fade away; the Log view (F7) keeps the history.
Colors: the panes' background is the terminal's own background color (asked with OSC 11 at startup) when the terminal has 24-bit color (by tcell's rules: `TCELL_TRUECOLOR`, `COLORTERM`, or a terminal description with direct color such as `xterm-ghostty`, which Ghostty on macOS uses without setting `COLORTERM`) and a dark background, and the Log says which and why; otherwise tview's default, palette color 0. Color themes often make color 0 a grey lighter than their background (Catppuccin: `#45475a` on `#1e1e2e`), on which grey text almost disappears. Light backgrounds keep color 0 because the text colors are made for dark ones.
Colors: the terminal is asked for its text and background colors at startup (OSC 10 and 11, in the same round trip as the graphics query). With 24-bit color (by tcell's rules: `TCELL_TRUECOLOR`, `COLORTERM`, or a terminal description with direct color such as `xterm-ghostty`, which Ghostty on macOS uses without setting `COLORTERM`) the panes' background is the terminal's own; otherwise tview's default, palette color 0, which color themes often make a grey that differs from their background (Catppuccin Mocha: `#45475a` on `#1e1e2e`; Latte: `#5c5f77` on `#eff1f5`). On a light background (luminance above 0.5) text, borders and titles use the terminal's text color (black if it did not say), input fields and buttons a 12% shade of it, placeholders 55%, and the active tab is drawn in the text color; tview's own defaults (white text, blue fields) are made for dark backgrounds. Accent colors (yellow, green, red, grey) stay palette colors, which a theme picks to suit its background. The Log says which colors are used and why.
tview primitives: `Pages` (views and stacked overlays), `Flex` (layout), `InputField` (search), `List`/`Table` (results, queues, library), `TextView` (details, log), `Form` (add dialog), `Modal` (confirmations). Popups are drawn by a wrapper around the root primitive.