Skip to content

fix(settings): scope terminal color overrides per light/dark mode - #10581

Open
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/terminal-color-overrides-per-mode
Open

innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/terminal-color-overrides-per-mode

Conversation

@innocarpe

@innocarpe innocarpe commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Terminal Color Overrides were a single global bag (terminalColorOverrides), so a dark-mode background override also covered light mode ([Bug]: Appearance terminal color overrides affects both light/dark mode #10561).
  • Add mode-specific terminalColorOverridesDark / terminalColorOverridesLight, keep the legacy bag until the first per-mode edit, and resolve overrides from the effective terminal appearance mode (light “Match dark mode” reuses the dark bag).
  • Settings UI gains a Dark/Light control under Color Overrides; Ghostty/onboarding imports still merge cleanly into legacy or the dark bag.

Test plan

  • vitest — terminal-color-overrides, compose-active-terminal-theme, useGhosttyImport, left-sidebar-appearance
  • Appearance → Terminal → Color Overrides: set dark background only; switch app to light with separate light theme → light terminal should keep its theme background
  • With “Match dark mode” on for light theme, dark overrides still apply in light
  • Ghostty import still applies color overrides

Closes #10561

ELI5

Terminal color overrides applied to both light and dark modes together, so a dark background tweak broke light mode. Overrides are per light/dark mode with a clear Settings control.

Color Overrides previously lived in a single terminalColorOverrides bag, so a
dark-mode background tweak also painted light mode. Keep the legacy bag for
backward compatibility, add mode-specific dark/light bags, and resolve the
active bag from the terminal appearance mode (with Match dark mode reuse).

Closes stablyai#10561
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@innocarpe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f7a2cfc-31c1-4c30-b2da-debb5659aad6

📥 Commits

Reviewing files that changed from the base of the PR and between f175d7b and 2cbca27.

📒 Files selected for processing (4)
  • src/renderer/src/components/settings/TerminalColorOverridesSection.tsx
  • src/renderer/src/components/settings/useGhosttyImport.test.ts
  • src/shared/terminal-color-overrides.test.ts
  • src/shared/terminal-color-overrides.ts
📝 Walkthrough

Walkthrough

Terminal color overrides now support legacy shared storage and separate dark/light override bags. Shared utilities handle mode resolution, edits, imports, and resets. Settings editing was moved into a dedicated component with mode selection and reset controls. Terminal theme composition and related rendering paths now receive the active appearance mode, while previews and tests cover mode-specific behavior.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and test plan but omits required sections like Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes. Add the missing template sections, include the full testing checklist, and summarize the AI review, security audit, screenshots/no visual change, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: scoping terminal color overrides by light/dark mode.
Linked Issues check ✅ Passed The PR implements per-mode terminal color overrides and preserves the legacy bag until per-mode edits, matching #10561.
Out of Scope Changes check ✅ Passed The changes stay focused on terminal color override scoping, UI, import paths, and tests, with no unrelated additions.

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.

@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: 3

🧹 Nitpick comments (3)
src/shared/terminal-color-overrides.test.ts (1)

1-9: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Missing coverage for mergeImportedTerminalColorOverrides.

No test in this suite exercises mergeImportedTerminalColorOverrides (imported by useGhosttyImport.ts/ThemeStep.tsx). A test seeding only the legacy terminalColorOverrides bag and asserting the resulting overrides don't leak into the other mode after resolution would have caught the mode-scoping gap flagged in useGhosttyImport.ts/ThemeStep.tsx.

src/renderer/src/components/settings/TerminalColorOverridesSection.tsx (2)

43-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Collapse toggle lacks aria-expanded.

The disclosure <button> toggling expanded doesn't expose its state to assistive tech.

♿ Proposed fix
         <button
           onClick={() => setExpanded((prev) => !prev)}
           className="flex items-center gap-2 text-sm font-medium"
+          aria-expanded={expanded}
         >

31-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

New locale keys deviate from the established hash-based convention in this namespace.

Every neighboring key in the TerminalWindowSection namespace here uses the 10-char hash format (63f8d9336e, 03c855d15f), but the new keys (color_overrides_mode_description, color_overrides_mode_title, color_overrides_mode_aria, color_overrides_match_dark_hint) are semantic slugs, and they're also namespaced under TerminalWindowSection despite living in the new TerminalColorOverridesSection.tsx file.

Based on learnings, semantic keys are acceptable only "when they match the established neighboring namespaces," which isn't the case here; the codebase otherwise "use[s] hash-based locale keys with translate('auto.components.<Dir>.<ComponentFile>.<10-char-hash>', ...)" for settings components.

Also applies to: 61-64, 69-72, 93-96

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cc5e6948-058e-437d-9705-20e913c88585

📥 Commits

Reviewing files that changed from the base of the PR and between 505967e and f175d7b.

📒 Files selected for processing (15)
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/onboarding/ThemeStep.tsx
  • src/renderer/src/components/settings/TerminalColorOverridesSection.tsx
  • src/renderer/src/components/settings/TerminalSettingsPreview.tsx
  • src/renderer/src/components/settings/TerminalWindowSection.tsx
  • src/renderer/src/components/settings/setting-labels.ts
  • src/renderer/src/components/settings/useGhosttyImport.ts
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/renderer/src/components/terminal-pane/compose-active-terminal-theme.test.ts
  • src/renderer/src/components/terminal-pane/terminal-appearance.ts
  • src/renderer/src/lib/left-sidebar-appearance.ts
  • src/renderer/src/runtime/sync-runtime-graph.ts
  • src/shared/terminal-color-overrides.test.ts
  • src/shared/terminal-color-overrides.ts
  • src/shared/types.ts

Comment thread src/renderer/src/components/settings/useGhosttyImport.ts
Comment thread src/shared/terminal-color-overrides.ts
Reset label names the active mode; Ghostty import seeds dark-only;
edits/resets target the effective bag when light matches dark.
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (2cbca27be)

Address CodeRabbit: mode-scoped reset label, dark-only Ghostty import, normalize edits/resets to effective mode when light matches dark.

@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@nwparker

Copy link
Copy Markdown
Contributor

Visual verification: Terminal Settings exposes separate Dark/Light override modes. The capture shows the selected Light mode using its own foreground and background values rather than the dark-mode palette.

terminal-color-overrides-light-mode.png

This branch has not been deployed

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Appearance terminal color overrides affects both light/dark mode

4 participants