Repository navigation
fix(terminal): restore a dark-background contrast floor - #10108
Conversation
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
📝 WalkthroughWalkthroughUpdated 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)
✅ Passed checks (4 passed)
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 |
…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]>
There was a problem hiding this comment.
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
📒 Files selected for processing (7)
mobile/src/terminal/terminal-webview-html.tsmobile/src/terminal/terminal-webview-theme-injected.test.tsmobile/src/terminal/terminal-webview-theme-injected.tssrc/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsxsrc/renderer/src/components/terminal-pane/terminal-appearance.test.tssrc/renderer/src/lib/terminal-contrast-correction.test.tssrc/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
| 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 }; |
There was a problem hiding this comment.
🎯 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 -C3Repository: 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' . || trueRepository: 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.tsxRepository: 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 || trueRepository: 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.
* 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]>
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
minimumContrastRatioby 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
#262b30on bg#1e242a→ ~1.1:1 without correction.pnpm exec vitest run --config config/vitest.config.ts \ src/renderer/src/lib/terminal-contrast-correction.test.ts \ src/renderer/src/components/terminal-pane/terminal-appearance.test.tsELI5
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
1(intentional; milder than light-bg4.5).4.5).Checklist notes
Fixes #10104