Skip to content

fix(terminal): restore a dark-background contrast floor - #10108

Merged
AmethystLiang merged 2 commits into
stablyai:mainfrom
innocarpe:fix/terminal-dark-bg-contrast-floor
Jul 23, 2026
Merged

AmethystLiang merged 2 commits into
stablyai:mainfrom
innocarpe:fix/terminal-dark-bg-contrast-floor

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

After a recent update, Antigravity agent output in dark mode rendered as near-invisible dark gray (#262b30) on the dark terminal background (#1e242a). Claude stayed readable.

Orca gates xterm minimumContrastRatio by terminal background luminance (#7934 / #9599): light backgrounds keep WCAG-AA 4.5, but dark backgrounds were set to 1 (no correction) to avoid over-brightening vibrant ANSI colors. That also skips correction for near-background body text — contrast ~1.1:1 for the reported Antigravity colors.

This PR sets a mild dark-background floor of 3 (still below light’s 4.5) so dark-on-dark body text is rescued without restoring full AA correction on every dark cell.

Evidence

ELI5

Some agents draw text almost the same color as the dark background. Orca used to fix that automatically, then stopped on dark themes so bright colors would not get “washed.” Now it uses a gentle fix again so you can still read the text.

User-regression-tradeoffs

  • Dark-theme ANSI colors that were slightly low-contrast may brighten a bit more than with ratio 1 (intentional; milder than light-bg 4.5).
  • Light backgrounds unchanged (4.5).
  • Agents that already paint high-contrast colors (e.g. Claude) should look the same.

Checklist notes

  • Cross-platform: xterm option on all platforms.
  • SSH/remote: renderer appearance path; remote PTY still paints through the same xterm.
  • Agents/integrations: Antigravity is the reported case; any dark-on-dark TUI benefits.
  • Performance: no change beyond existing per-appearance apply.
  • UI: terminal text contrast only.
  • Security: n/a

Fixes #10104

Fully disabling xterm minimumContrastRatio on dark backgrounds (stablyai#9599)
left near-background body text unreadable — Antigravity paints #262b30
on #1e242a (~1.1:1). Keep light backgrounds at WCAG-AA 4.5 and use a
milder dark floor (3) so dark-on-dark body text is lifted without the
full light-bg correction strength.

Fixes stablyai#10104
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated terminal contrast correction so dark backgrounds use a minimum contrast ratio of 3 instead of 1. Added resolver and catalog regression tests, wired contrast floors into desktop preview and mobile terminals, and adjusted appearance tests for dark themes, live theme flips, and shared light-theme settings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is informative, but it does not follow the required template sections and omits the AI review report and security audit. Rewrite the PR description to match the template: Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring a dark-background terminal contrast floor.
Linked Issues check ✅ Passed The changes address #10104 by raising the dark contrast floor and applying it across live terminals, previews, and mobile terminals.
Out of Scope Changes check ✅ Passed The changes stay focused on terminal contrast handling and related tests, with no obvious unrelated code introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

…inals

The dark-background minimumContrastRatio floor (stablyai#10104) is applied per
`new Terminal()` construction site. Beyond the live pane, agent output also
renders in the dashboard popout preview and the mobile WebView, which were
still at the floor-1 default, so Antigravity output stayed unreadable there.

- AgentTerminalPreview: gate via resolveTerminalMinimumContrastRatio
- mobile WebView: port the gate as resolveTerminalContrastFloor (Chrome-74 JS)
- tests: builtin-catalog guard + mobile vm-harness coverage

Co-authored-by: Orca <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b9bdf76f-2f69-4c57-9b80-c200518e4bc1

📥 Commits

Reviewing files that changed from the base of the PR and between c09fa4f and 06ecb8e.

📒 Files selected for processing (7)
  • mobile/src/terminal/terminal-webview-html.ts
  • mobile/src/terminal/terminal-webview-theme-injected.test.ts
  • mobile/src/terminal/terminal-webview-theme-injected.ts
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/terminal-pane/terminal-appearance.test.ts
  • src/renderer/src/lib/terminal-contrast-correction.test.ts
  • src/renderer/src/lib/terminal-contrast-correction.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/lib/terminal-contrast-correction.ts
  • src/renderer/src/components/terminal-pane/terminal-appearance.test.ts

Comment on lines 9 to +13
export const TERMINAL_WEBVIEW_THEME_JS = `
var DARK_BG_MIN_CONTRAST = 3;
var LIGHT_BG_MIN_CONTRAST = 4.5;
// Dark app surface a transparent terminal background composites over (matches desktop APP_SURFACE_COLORS.dark).
var CONTRAST_APP_SURFACE = { r: 10, g: 10, b: 10 };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether the desktop APP_SURFACE_COLORS has a light counterpart, and whether
# mobile's terminal webview theme injection is ever generated for a light app theme.
rg -n 'APP_SURFACE_COLORS' -C3
rg -n 'CONTRAST_APP_SURFACE|terminalMinimumContrastRatio' mobile/src/terminal -C3
rg -n "import.*colors" mobile/src/terminal/terminal-webview-theme-injected.ts mobile/src/terminal/terminal-webview-html.ts -C3

Repository: stablyai/orca

Length of output: 151


🏁 Script executed:

#!/bin/bash
set -u

echo "tracked mobile terminal files:"
git ls-files | rg 'mobile/src/terminal|terminal' | sed -n '1,200p'

echo
echo "search APP_SURFACE_COLORS case-insensitive:"
rg -n -i 'APP_SURFACE_COLORS|APP_SURFACE' . || true

echo
echo "search CONTRAST_APP_SURFACE / terminalMinimumContrastRatio / resolveTerminalMinimumContrastRatio:"
rg -n 'CONTRAST_APP_SURFACE|terminalMinimumContrastRatio|resolveTerminalMinimumContrastRatio|LIGHT_BG_MIN_CONTRAST|DARK_BG_MIN_CONTRAST' . || true

echo
echo "list files by name:"
fd -i 'terminal' . || true

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -u

echo "terminal-title-contrast app surface:"
sed -n '1,70p' src/renderer/src/lib/terminal-title-contrast.ts

echo
echo "core contrast resolver:"
sed -n '1,65p' src/renderer/src/lib/terminal-contrast-correction.ts

echo
echo "terminal-webview-theme-injected relevant section:"
sed -n '1,125p' mobile/src/terminal/terminal-webview-theme-injected.ts

echo
echo "mobile terminal color/appearance generation references:"
rg -n 'generateTerminalWebview|terminal-minimum-contrast|appSurface|minimumContrastRatio|generateTerminalTheme|colors' mobile/src mobile/scripts -C2 || true

echo
echo "mobile TerminalWebView excerpt:"
sed -n '1,260p' mobile/src/terminal/TerminalWebView.tsx

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -u

echo "terminal-title-contrast app surface:"
sed -n '1,70p' src/renderer/src/lib/terminal-title-contrast.ts

echo
echo "core contrast resolver:"
sed -n '1,65p' src/renderer/src/lib/terminal-contrast-correction.ts

echo
echo "mobile theme file:"
fd -i 'mobile-theme' mobile -a | sed -n '1,20p'
sed -n '1,140p' mobile/src/theme/mobile-theme.ts 2>/dev/null || true
sed -n '1,140p' mobile/theme/mobile-theme.ts 2>/dev/null || true

echo
echo "mobile TerminalWebView relevant imports/extraction:"
sed -n '1,240p' mobile/src/terminal/TerminalWebView.tsx

echo
echo "terminal-webview-html theme injection relevant ranges:"
sed -n '260,310p' mobile/src/terminal/terminal-webview-html.ts
sed -n '680,735p' mobile/src/terminal/terminal-webview-html.ts

echo
echo "exact appSurface/theme generation references in mobile terminal files only:"
rg -n 'appSurface|APP_SURFACE|terminal-minimum-contrast|minimumContrastRatio|mobile-theme|generate.*Theme|ThemeHtml|webview-.*theme' mobile/src/terminal mobile/app mobile/scripts -C2 || true

Repository: stablyai/orca

Length of output: 37908


Use mobile's actual app surface when computing the contrast floor.

CONTRAST_APP_SURFACE is permanently set to { r: 10, g: 10, b: 10 }, so translucent terminal backgrounds only composite against the dark app surface (bgBase: '#111111'). If the mobile app ever renders the terminal webview with light-mode chrome, pick a light surface value instead.

@AmethystLiang
AmethystLiang merged commit 1648251 into stablyai:main Jul 23, 2026
3 checks passed
@innocarpe
innocarpe deleted the fix/terminal-dark-bg-contrast-floor branch July 23, 2026 11:39
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(terminal): restore a dark-background contrast floor

Fully disabling xterm minimumContrastRatio on dark backgrounds (stablyai#9599)
left near-background body text unreadable — Antigravity paints #262b30
on #1e242a (~1.1:1). Keep light backgrounds at WCAG-AA 4.5 and use a
milder dark floor (3) so dark-on-dark body text is lifted without the
full light-bg correction strength.

Fixes stablyai#10104

* fix(terminal): extend dark-bg contrast floor to preview + mobile terminals

The dark-background minimumContrastRatio floor (stablyai#10104) is applied per
`new Terminal()` construction site. Beyond the live pane, agent output also
renders in the dashboard popout preview and the mobile WebView, which were
still at the floor-1 default, so Antigravity output stayed unreadable there.

- AgentTerminalPreview: gate via resolveTerminalMinimumContrastRatio
- mobile WebView: port the gate as resolveTerminalContrastFloor (Chrome-74 JS)
- tests: builtin-catalog guard + mobile vm-harness coverage

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

[Bug]: Antigravity agent output text is unreadable (dark text on dark mode background) after recent update

2 participants