Repository navigation
fix(appearance): keep low-contrast themes legible in match-terminal sidebar and terminal ghost text - #17000
fix(appearance): keep low-contrast themes legible in match-terminal sidebar and terminal ghost text#17000seedotlee wants to merge 7 commits into
Conversation
xterm's minimumContrastRatio lifts every below-floor color to the floor, so on a low-contrast theme the 4.5 light-background floor lands beside the theme's own foreground: Solarized Light's brightBlack #93a1a1 (2.5:1) was darkened to #5f6868 next to fg #586e75 (5:1), making zsh-autosuggestions / fish ghost text indistinguishable from typed text. Cap the floor at half the foreground's contrast (the ~20 L* step theme authors give their dim slot), bottoming out at 1. High-contrast themes are unaffected: the floor only moves when fg is under 9:1 on light or 6:1 on dark. Co-Authored-By: Claude Fable 5 <[email protected]>
…themes Match-terminal derived --muted-foreground with a fixed 62% fg/bg mix, and the sidebar nav used sidebar-foreground/60|55|45|30 alpha tiers. Both assume a near-black/near-white foreground; Solarized Light's #586e75 on #fdf6e3 (5:1) mixed down to ~2.4:1 and 1.5:1, so nav labels, worktree subtitles and the settings sidebar faded into the background. - Gate the muted mix on contrast: raise it from 62% until the result clears 4.5:1 (the light default's own ratio). High-contrast themes stay at ~62%. - Move the sidebar alpha tiers onto text-muted-foreground tiers chosen to keep the default light/dark look unchanged. Fixes stablyai#16999 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe PR adds foreground-aware terminal contrast correction and passes theme foreground colors from terminal previews. It adds utilities for adaptive muted-foreground mixing with WCAG contrast checks and test coverage. Inactive sidebar elements now use semantic muted foreground tokens instead of worktree-specific color tokens. Active and hover styling remains unchanged. Merge Risk: 🔵 Low · up to This renderer-only change improves sidebar and terminal readability for low-contrast themes. A bounded risk remains that translucent foreground colors may still yield muted sidebar text below the intended contrast floor in some themes, so merge is reasonable with explicit owner awareness or follow-up. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 705ddb5d-b2d6-454b-866b-8b0541af7b16
📒 Files selected for processing (15)
src/renderer/src/components/dashboard-popout/preview-terminal-options.tssrc/renderer/src/components/settings/SettingsSidebar.tsxsrc/renderer/src/components/settings/TerminalSettingsPreview.tsxsrc/renderer/src/components/sidebar/AgentDashboardSidebarEntry.tsxsrc/renderer/src/components/sidebar/SetupGuideSidebarEntry.tsxsrc/renderer/src/components/sidebar/SidebarNav.tsxsrc/renderer/src/components/sidebar/SidebarTaskNavButton.tsxsrc/renderer/src/components/terminal-pane/terminal-appearance.tssrc/renderer/src/lib/left-sidebar-appearance.test.tssrc/renderer/src/lib/left-sidebar-appearance.tssrc/renderer/src/lib/muted-foreground-contrast.test.tssrc/renderer/src/lib/muted-foreground-contrast.tssrc/renderer/src/lib/terminal-contrast-correction.test.tssrc/renderer/src/lib/terminal-contrast-correction.tssrc/renderer/src/lib/terminal-title-contrast.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
CodeRabbit's docstring-coverage pre-merge check flagged 28.57% on the functions this PR touches; brief one-liners bring every touched function in the diff over the 80% threshold. Co-Authored-By: Claude Fable 5 <[email protected]>
CodeRabbit still counted the test file's nested arrows and a few context-line functions as undocumented (70.37% < 80%). Hoist the luminance/channel helpers into named, documented functions and add one-liners to the remaining touched functions. Co-Authored-By: Claude Fable 5 <[email protected]>
Address CodeRabbit review on stablyai#17000: - resolveMutedForegroundMixPercent composites a translucent background over the app surface first: color-mix(fg P%, rgba-bg) rendered over the surface equals mixSrgb(fg, composited-bg, P), so the gate now rates what is seen. The sidebar passes the effective app mode as the surface. - resolveTerminalTextContrastRatio composites a translucent foreground over the composited background instead of rating it as opaque. Co-Authored-By: Claude Fable 5 <[email protected]>
Greptile SummaryThe PR makes muted sidebar colors and terminal ghost-text correction responsive to the active theme’s foreground contrast.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/lib/muted-foreground-contrast.ts | Models premultiplied CSS color mixing and compositing to select the minimum muted-foreground percentage meeting the contrast target. |
| src/renderer/src/lib/left-sidebar-appearance.ts | Applies the contrast-aware muted foreground to match-terminal sidebar variables using the actual app surface mode. |
| src/renderer/src/lib/terminal-contrast-correction.ts | Caps xterm contrast correction according to foreground headroom while retaining existing floors for high-contrast themes. |
| src/renderer/src/lib/terminal-title-contrast.ts | Exposes shared parsing and compositing helpers and adds rendered foreground-to-background contrast calculation. |
| src/renderer/src/lib/muted-foreground-contrast.test.ts | Covers opaque, translucent, low-contrast, unparseable, and unattainable contrast scenarios. |
Reviews (3): Last reviewed commit: "fix(appearance): rate muted text by the ..." | Re-trigger Greptile
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: da0aba20-10a3-411b-b01b-90c1fa6cce39
📒 Files selected for processing (6)
src/renderer/src/lib/left-sidebar-appearance.test.tssrc/renderer/src/lib/left-sidebar-appearance.tssrc/renderer/src/lib/muted-foreground-contrast.test.tssrc/renderer/src/lib/muted-foreground-contrast.tssrc/renderer/src/lib/terminal-contrast-correction.test.tssrc/renderer/src/lib/terminal-title-contrast.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Inline .map / nested lambdas count as undocumented functions for the docstring-coverage gate; hoist them into named helpers with JSDoc. Co-Authored-By: Claude Fable 5 <[email protected]>
…a translucent sidebar Address Greptile + CodeRabbit review on stablyai#17000. The previous model composited the background first and mixed opaquely, but the emitted CSS mixes color-mix(fg P%, rgba-bg) premultiplied (CSS Color 4 §12.3) and the browser composites that still-translucent text over the sidebar — whose own transparent part shows the raw background layer again. Model exactly: text = P·a_fg·fg + (1-P)·a_bg·bg + (1 - P·a_fg - (1-P)·a_bg)·S S = a_bg·bg + (1-a_bg)·appSurface and rate text against S. Verified against Chromium 152's computed color-mix values. Foreground alpha is now part of the same formula, so rgba(0,0,0,0.5) on white correctly falls back to 100. Co-Authored-By: Claude Fable 5 <[email protected]>
|
+1. I use Rosé Pine themes, and readable muted text in match-terminal mode matters once more of the app follows the terminal theme (see #16768). |
|
Closing as superseded by #36567: Match Terminal is now a full app theme that colors the whole window and keeps low-contrast terminal palettes legible. Thank you for this PR, it shaped the design. |
ELI5
On "soft" low-contrast terminal themes (Solarized, Everforest, Rosé Pine Dawn, Catppuccin Latte…) two things fade out: sidebar text in Match terminal mode, and shell autosuggestion "ghost text" in the terminal, which gets pushed to the same gray as typed text. Both derive dim colors from the theme foreground using ratios tuned for a near-black/near-white foreground; this PR makes those derivations contrast-aware, so high-contrast themes look exactly as before and low-contrast ones stay readable.
What Changed
Two focused commits:
1.
fix(sidebar)— match-terminal muted text (left-sidebar-appearance.ts, newmuted-foreground-contrast.ts)--muted-foregroundwas a fixedcolor-mix(fg 62%, bg). It is now gated on contrast: the mix is raised from 62 % until the result clears 4.5:1 against the background (the light default#737373/#fafafasits at exactly 4.5:1), capped at the foreground itself. High-contrast pairs stay at 62 %, so existing expectations are unchanged.text-worktree-sidebar-foreground/60|55|45|30alpha tiers, which have the same flaw and can't be fixed by tokens. They now usetext-muted-foregroundtiers (/60→muted,/55→/90,/45→/75,/30→/50) chosen so the default light and dark looks are visually unchanged (e.g. dark/30= 2.64:1 before and after).2.
fix(terminal)— xterm contrast floor (terminal-contrast-correction.ts,terminal-title-contrast.ts+ 3 call sites)resolveTerminalMinimumContrastRationow takes the theme foreground and caps the floor at half the foreground's contrast (DIM_TEXT_CONTRAST_HEADROOM = 2, bottoming out at 1). The 4.5 / 3 floors from [Feature] Minimum Contrast Ratio #7934 / [Bug]: Antigravity agent output text is unreadable (dark text on dark mode background) after recent update #10104 are untouched whenever fg ≥ 9:1 on light or ≥ 6:1 on dark backgrounds — i.e. every builtin theme except the low-contrast ones.Why
Fixed mix ratios and alpha tiers assume the default theme's foreground (~19:1). Solarized Light's
#586e75on#fdf6e3is ~5:1, so:--muted-foreground(62 %)fg/30brightBlack #93a1a1, 2.5:1) after xterm's 4.5 floor#5f6868— fg is#586e75Editing the theme is not a workaround: a 60 % alpha tier only reaches 4.5:1 on a light background with a near-black foreground (even Gruvbox Light's 10:1 fg yields 3.4:1), and any
brightBlackunder 4.5:1 is lifted onto the foreground by xterm regardless of its value. Gating on the actual contrast fixes the whole family of themes (Everforest Light, Rosé Pine Dawn, Catppuccin Latte, Solarized Dark…) without touching high-contrast ones.Linked Issue
Fixes #16999
Visual Proof
Solarized Light, Left sidebar: Match terminal, macOS.
Settings sidebar:
Terminal (zsh-autosuggestions,
fg=8): before, typed text and ghost text both render as ~#5f6868; after, ghost text stays at the theme'sbrightBlack(#93a1a1, 2.5:1) while typed text remains#586e75(5:1).Testing
macOS:
pnpm devwith Solarized Light (builtin and a Ghostty/Warp-imported variant), sidebar in match-terminal mode; verified sidebar labels/subtitles/settings sidebar and ghost text in a zsh pane. Also checked GitHub Light / Ghostty Default Dark render unchanged.Not a platform-specific change (pure color derivation in the renderer); no SSH/remote or path impact.
pnpm test(281 files / 2387 tests),pnpm tc:web, changed-file lint all pass locally.I manually tested these changes locally
Automated tests added/updated, or explained why not below
New/updated tests:
muted-foreground-contrast.test.ts(7),left-sidebar-appearance.test.ts(+1 match-terminal Solarized case),terminal-contrast-correction.test.ts(+7 headroom cases, incl. pinning that Solarized's ownbrightBlackis no longer lifted and that high-contrast themes keep their floors).AI Disclosure
Root-cause analysis, implementation and tests were done with Claude (Claude Code), reviewed and verified manually by me.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Renderer-only color derivation; no security, cross-platform, SSH, mobile, wire or performance surface. The contrast search in
resolveMutedForegroundMixPercentis at most 38 iterations of a few multiplications and runs only when sidebar style variables are recomputed.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code