Skip to content

fix: improve terminal contrast in light themes (Tango Light + xterm minimumContrastRatio) - #5985

Closed
zhangqinzhong wants to merge 2 commits into
stablyai:mainfrom
zhangqinzhong:fix/tango-light-theme-contrast
Closed

zhangqinzhong wants to merge 2 commits into
stablyai:mainfrom
zhangqinzhong:fix/tango-light-theme-contrast

Conversation

@zhangqinzhong

@zhangqinzhong zhangqinzhong commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

What

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 (two layers)

Layer 1 — Theme colors (defaults.ts)

Darkened 9 low-contrast ANSI colors to readable Tango palette shades:

Color Before After Contrast
white #d3d7cf #6a6a6a 1.5:1 → 5.4:1
brightWhite #eeeeec #3d3d3d 1.2:1 → 10.9:1
cyan #06989a #05727e 3.5:1 → 5.7:1
brightCyan #34e2e2 #034b50 1.6:1 → 9.9:1
yellow #c4a000 #8e7700 2.5:1 → 4.4:1
brightGreen #8ae234 #1b7a1b 1.6:1 → 5.5:1
brightYellow #fce94f #6d5a00 1.2:1 → 6.7:1
brightBlue #729fcf #204a87 2.8:1 → 8.8:1
brightCyan #34e2e2 #034b50 1.6:1 → 9.9:1

Layer 2 — Renderer safety net (pane-terminal-options.ts)

Enabled xterm.js minimumContrastRatio: 4.5. This auto-adjusts any low-contrast foreground color at render time — protecting ALL themes including user-imported custom themes.

Layer 3 — Tests

  • terminal-theme.test.ts: asserts Tango Light key ANSI colors (cyan, white, brightCyan, brightWhite) pass ≥4.5:1 contrast
  • pane-lifecycle.test.ts: asserts minimumContrastRatio is enabled in default terminal options

Verification

  • All existing tests pass
  • Typecheck passes
  • Lint passes

X: @askrygg

🤖 Generated with Claude Code


Open in Stage

vhudsongit and others added 2 commits June 21, 2026 22:39
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]>
@ghost

ghost commented Jun 21, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Darken Tango Light ANSI colors for readability
2 Enable xterm.js minimum contrast ratio safety net
3 Verify terminal contrast and configuration in tests
Open in Stage

Chapters generated by Stage for commit ca506bf on Jun 21, 2026 2:47pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b8a4447-8ad6-414e-9dbb-de6fa6fd1809

📥 Commits

Reviewing files that changed from the base of the PR and between 3117ebc and ca506bf.

📒 Files selected for processing (4)
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-terminal-options.ts
  • src/renderer/src/lib/terminal-theme.test.ts
  • src/renderer/src/lib/terminal-themes/defaults.ts

📝 Walkthrough

Walkthrough

Two coordinated changes improve ANSI color readability on light terminal themes. The Builtin Tango Light theme's color palette is updated: yellow, cyan, white, brightYellow, brightCyan, brightWhite, and related entries are replaced with darker/adjusted equivalents. Separately, buildDefaultTerminalOptions() now returns minimumContrastRatio: 4.5 in the xterm options object. Tests are added for both: one verifies the contrast ratio property value, and another checks that the selected ANSI colors (cyan, white, brightCyan, brightWhite) each meet a 4.5 contrast ratio against the light theme background.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zhangqinzhong
zhangqinzhong deleted the fix/tango-light-theme-contrast branch June 21, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants