Repository navigation
fix: improve terminal contrast in light themes (Tango Light + xterm minimumContrastRatio) - #5986
Conversation
Nine ANSI colors had contrast ratios below 3:1 against the white background, making CLI output unreadable in light mode. Darkened to readable Tango shades while keeping the warm palette identity. Co-Authored-By: Claude <[email protected]>
xterm.js minimumContrastRatio (4.5) auto-adjusts low-contrast ANSI foreground colors at render time — a safety net for all themes, including custom imports. Added test coverage for this option and for the Tango Light ANSI color contrast assertions. Co-Authored-By: Claude <[email protected]>
|
Ready to review this PR? Stage has broken it down into 2 individual chapters for you:
Chapters generated by Stage for commit 6322eb9 on Jun 21, 2026 3:07pm UTC. |
📝 WalkthroughWalkthroughTwo complementary changes address ANSI color readability on light terminal themes. The 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks, this looks good.\n\nVerified locally:\n- focused terminal theme/options tests pass\n- typecheck and lint pass\n- light terminal preview renders with the built-in light theme\n- xterm applies the 4.5 minimum contrast correction for low-contrast ANSI cells\n\nThe runtime contrast guard is the key piece here because it also covers custom/imported terminal themes.
…luminance (#7934) (#9599) * fix(terminal): gate xterm contrast correction by theme mode (#7934) minimumContrastRatio: 4.5 (added in #5986 to rescue invisible white/bright-white ANSI text on light backgrounds) was applied globally, over-correcting vibrant ANSI colors on dark themes. Keep 4.5 on light themes; disable it (1) on dark themes. applyTerminalAppearance re-gates it in its per-pane loop, so live auto/system dark<->light flips are handled for free. buildDefaultTerminalOptions keeps 4.5 as the initial value so the first paint on a light theme never flashes low-contrast text. Supersedes #7939. Co-authored-by: Orca <[email protected]> * fix(terminal): gate contrast correction by terminal background luminance Contrast correction rescues white text on light backgrounds but over-corrects on dark. The previous mode-based gate failed when the terminal theme didn't match the app mode (e.g., terminalUseSeparateLightTheme=false). Now gates by the theme's background luminance via isTerminalBackgroundLight() instead. * refactor(terminal): extract contrast correction gating into shared helpe Centralizes the minimumContrastRatio gating logic (#7934) into a dedicated module so both the settings preview and live terminal appearance apply the same contrast-by-luminance rule, preventing drift. Adds value-gating to skip redundant writes that would clear xterm's contrast cache on re-applies. --------- Co-authored-by: Orca <[email protected]>
…inimumContrastRatio) (stablyai#5986) * fix: darken Builtin Tango Light ANSI colors for readability Nine ANSI colors had contrast ratios below 3:1 against the white background, making CLI output unreadable in light mode. Darkened to readable Tango shades while keeping the warm palette identity. Co-Authored-By: Claude <[email protected]> * fix: enable xterm minimumContrastRatio and add light theme tests xterm.js minimumContrastRatio (4.5) auto-adjusts low-contrast ANSI foreground colors at render time — a safety net for all themes, including custom imports. Added test coverage for this option and for the Tango Light ANSI color contrast assertions. Co-Authored-By: Claude <[email protected]> * chore: trigger CI re-run --------- Co-authored-by: zhangqinzhong <[email protected]> Co-authored-by: Claude <[email protected]>
…luminance (stablyai#7934) (stablyai#9599) * fix(terminal): gate xterm contrast correction by theme mode (stablyai#7934) minimumContrastRatio: 4.5 (added in stablyai#5986 to rescue invisible white/bright-white ANSI text on light backgrounds) was applied globally, over-correcting vibrant ANSI colors on dark themes. Keep 4.5 on light themes; disable it (1) on dark themes. applyTerminalAppearance re-gates it in its per-pane loop, so live auto/system dark<->light flips are handled for free. buildDefaultTerminalOptions keeps 4.5 as the initial value so the first paint on a light theme never flashes low-contrast text. Supersedes stablyai#7939. Co-authored-by: Orca <[email protected]> * fix(terminal): gate contrast correction by terminal background luminance Contrast correction rescues white text on light backgrounds but over-corrects on dark. The previous mode-based gate failed when the terminal theme didn't match the app mode (e.g., terminalUseSeparateLightTheme=false). Now gates by the theme's background luminance via isTerminalBackgroundLight() instead. * refactor(terminal): extract contrast correction gating into shared helpe Centralizes the minimumContrastRatio gating logic (stablyai#7934) into a dedicated module so both the settings preview and live terminal appearance apply the same contrast-by-luminance rule, preventing drift. Adds value-gating to skip redundant writes that would clear xterm's contrast cache on re-applies. --------- Co-authored-by: Orca <[email protected]>
Summary
The Builtin Tango Light theme had 9 ANSI colors with contrast ratios below 3:1 against its white (#ffffff) background. CLI tools that render body text, file contents, and headers using ANSI white/bright-white produced unreadable output in light mode.
Fix
defaults.ts): darkened 9 low-contrast ANSI colors to readable Tango palette shades (all now ≥4.4:1 on white)pane-terminal-options.ts): enabled xterm.jsminimumContrastRatio: 4.5, which auto-adjusts low-contrast foreground colors at render time for ALL themes including custom importsminimumContrastRatiois enabledScreenshots
No visual change — the terminal theme picker and settings UI are unaffected.
Testing
pnpm lintpnpm typecheckpnpm testAI Review Report
Code review performed with AI agent:
minimumContrastRatiois xterm.js built-in, negligible overheadSecurity Audit
minimumContrastRatio).Notes
X: @askrygg
🤖 Generated with Claude Code