Skip to content

fix: improve text contrast on light terminal backgrounds#712

Open
altimate-harness-bot[bot] wants to merge 5 commits intomainfrom
fix/light-terminal-text-contrast
Open

fix: improve text contrast on light terminal backgrounds#712
altimate-harness-bot[bot] wants to merge 5 commits intomainfrom
fix/light-terminal-text-contrast

Conversation

@altimate-harness-bot
Copy link
Copy Markdown

@altimate-harness-bot altimate-harness-bot bot commented Apr 16, 2026

Summary

Fixes #704 (follow-up to #617). Code output was rendering as white/light text on light terminal backgrounds, making it unreadable.

Three fixes:

  • COLORFGBG env var fallback (app.tsx): When OSC 11 terminal background detection times out (common in many terminal setups), fall back to checking the COLORFGBG environment variable before defaulting to "dark" mode. Many terminals (iTerm2, xterm, etc.) set this to indicate their color scheme.

  • Light-mode foreground fallback (theme.tsx): When defaultForeground is unavailable and mode is "light", use #1a1a1a (near-black) instead of ANSI palette index 7 (#c0c0c0 — light gray), which is invisible on white backgrounds.

  • Inline code background (theme.tsx): Use backgroundElement instead of background for markup.raw.inline scope. background can be transparent (especially in the system theme), leaving inline code with no contrast protection. This is consistent with the Asking the model to do a suggestion for rewrite of code during review returns white lines of code while terminal background is white #617 fix already applied to markup.raw.block.

Test plan

  • Run CLI on a light-background terminal (e.g. Terminal.app with default white theme)
  • Verify code suggestions and rewrites are readable
  • Verify inline code blocks have visible background contrast
  • Test on a terminal that sets COLORFGBG env var
  • Test on a terminal that responds to OSC 11 (should still work as before)
  • Verify dark terminal themes are unaffected

Requested by @saravmajestic via harness


Summary by cubic

Fixes unreadable code and inline code on light terminal backgrounds by improving detection and safer color fallbacks. Closes #704.

  • Bug Fixes
    • Fallback to COLORFGBG when OSC 11 detection times out to detect light terminals.
    • In light mode, use #1a1a1a for missing foregrounds and backgroundElement for inline code (markup.raw.inline) to ensure contrast on transparent themes.
    • Add tests for COLORFGBG parsing, light-mode foreground contrast, and inline-code background; include regression tests (dark mode unchanged) and update the test helper; add altimate_change markers to patched sections.

Written for commit 4d06787. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

saravmajestic added 2 commits April 16, 2026 07:39
- Add COLORFGBG env var fallback when OSC 11 detection times out
- Use dark foreground (#1a1a1a) instead of palette[7] (#c0c0c0) for light mode system theme
- Use backgroundElement for inline code blocks to ensure contrast on transparent backgrounds

Closes #704
- Test markup.raw.inline uses backgroundElement (non-transparent)
- Test system theme light-mode foreground fallback contrast
- Test COLORFGBG env var parsing logic
- Update test helper to match production inline code background change
@altimate-harness-bot altimate-harness-bot bot force-pushed the fix/light-terminal-text-contrast branch from 72d8b51 to d3a4dac Compare April 16, 2026 07:40
saravmajestic added 2 commits April 16, 2026 07:43
Adds tests that reproduce the exact bugs:
- BUG test: proves palette[7] (#c0c0c0) has ~1.3:1 contrast on white (invisible)
- BUG test: proves old inline code bg was transparent (no contrast)
- FIX test: verifies new fg (#1a1a1a) has >=3:1 contrast on white
- FIX test: verifies inline code bg is now opaque
- FIX test: verifies dark mode is unaffected (still uses palette[7])
@saravmajestic saravmajestic marked this pull request as ready for review April 16, 2026 08:33
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code output still renders as white text on light terminal backgrounds (follow-up to #617)

1 participant