fix(tui): improve colour contrast for light-background terminals#40339
fix(tui): improve colour contrast for light-background terminals#40339ademczuk wants to merge 2 commits intoopenclaw:mainfrom
Conversation
…nclaw#38636) Detect light terminal backgrounds via COLORFGBG and apply a WCAG AA-compliant light palette. Adds OPENCLAW_THEME=light|dark env var override for terminals without auto-detection. Uses proper sRGB linearisation and WCAG 2.1 contrast ratios to pick whichever text palette (dark or light) has higher contrast against the detected background colour. Co-authored-by: ademczuk <[email protected]>
|
Yes please! 🙏 This has been driving me crazy. I use a light terminal theme (Solarized Light) and some of the UI elements are basically invisible. The gray text on light background is particularly bad - I have to squint to read status messages. Would love to see either:
This is probably an easy win that would help a lot of users who prefer light backgrounds. Happy to provide screenshots of the problematic areas if that helps! |
Greptile SummaryThis PR adds adaptive light/dark TUI theming by detecting the terminal background colour via Key observations:
Confidence Score: 4/5
Last reviewed commit: f164605 |
Replaces #38636 (closed due to force-push).
Summary
COLORFGBGenv var with proper WCAG 2.1 sRGB linearisationOPENCLAW_THEME=light|darkoverride for terminals without auto-detectionChanges
src/tui/theme/theme.ts- background detection + adaptive palettessrc/tui/theme/syntax-theme.ts- light-theme syntax colourssrc/tui/theme/theme.test.ts- detection + WCAG AA contrast testsdocs/help/environment.md- document OPENCLAW_THEME and COLORFGBGdocs/web/tui.md- terminal colours sectionCHANGELOG.md- entry under FixesTest plan
pnpm vitest run src/tui/theme/theme.test.tspnpm tsgo(type check)pnpm buildOriginal author: @ademczuk. Rewrite by @vincentkoc. CHANGELOG conflict resolved.