Skip to content

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

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

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.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aff2fb92-5c0c-4c62-914e-7dd1c02bb207
Commits

Reviewing files that changed from the base of the PR and between f175d7b and 5d97a18.

Files selected for processing: 17
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/onboarding/ThemeStep.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.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.test.ts
  • src/renderer/src/components/settings/useGhosttyImport.ts
  • src/renderer/src/components/terminal-pane/compose-active-terminal-theme.test.ts
  • src/renderer/src/components/terminal-pane/terminal-appearance.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-projection.ts
  • src/renderer/src/lib/left-sidebar-appearance.ts
  • src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts
  • src/shared/global-settings-types.ts
  • src/shared/terminal-color-overrides.test.ts
  • src/shared/terminal-color-overrides.ts
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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/shared/terminal-color-overrides.ts Resolved
@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

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
Reset label names the active mode; Ghostty import seeds dark-only;
edits/resets target the effective bag when light matches dark.
@innocarpe
innocarpe force-pushed the fix/terminal-color-overrides-per-mode branch from 2cbca27 to 5d97a18 Compare October 29, 2026 08:36
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The change reaches terminal colors across the app.

Fix the saved-color resolver and plugin theme application before merging.

Findings

  1. P1 Saved colors stop matching ▶
  2. P1 Old colors cover plugin themes ▶
  3. P2 Reset promises too much ▶

Summary

This PR adds separate dark and light terminal color overrides, updates terminal views and previews, and adds a mode control in Settings.

  • Terminal colors now follow the appearance mode being shown.
  • Settings lets people edit and reset terminal colors by mode.
  • Ghostty imports now add colors to dark terminal settings.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Terminal appearance mode] --> B{Light matches dark?}
  B -->|Yes| C[Dark override field]
  B -->|No| D[Selected mode override field]
  C --> E{Any per-mode field exists?}
  D --> E
  E -->|Yes| F[Use selected field]
  E -->|No| G[Use legacy overrides]
  F --> H[Merge over terminal theme]
  G --> H
Loading

Reviews (1) · Last reviewed commit: "fix(settings): address CR on per-mode te..." · Reviewed by Greptile

Comment on lines +110 to +113
return {
terminalColorOverrides: undefined,
terminalColorOverridesDark: effectiveMode === 'dark' ? compactOverrides(seeded) : undefined,
terminalColorOverridesLight: effectiveMode === 'light' ? compactOverrides(seeded) : undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Saved colors stop matching

The first per-mode edit clears terminalColorOverrides, but resolveConfiguredTerminalColors still reads only that old field. Native chat with “match terminal” enabled then loses the user's colors. Hosts without a viewer also answer OSC 10/11 with the base theme instead of the saved overrides.

Update that shared resolver and its callers to pass and resolve both new fields.

Comment on lines +81 to +83
const colorOverrides = resolveTerminalColorOverridesForMode(settings, mode)
if (colorOverrides) {
theme = { ...theme, ...colorOverrides }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Old colors cover plugin themes

After a per-mode edit or Ghostty import, applying a plugin terminal theme leaves the old overrides covering its colors. terminalThemeUpdate clears only terminalColorOverrides, while this merge keeps applying terminalColorOverridesDark or terminalColorOverridesLight over the selected theme.

Update plugin theme application to clear the affected per-mode overrides and save them for “Switch back.”

Comment on lines +132 to +135
{translate(
'auto.components.settings.TerminalWindowSection.03c855d15f',
'Reset {{value0}} color overrides',
{ value0: mode }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Reset promises too much

The button reuses a translation key whose existing translations say “Reset all color overrides.” Those translations replace the new fallback, so non-English users are told the button resets both modes even though it resets only the effective selected mode.

Update the translations or use a new key with the mode placeholder.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@innocarpe

Copy link
Copy Markdown
Contributor Author

Thanks. Closing this in favour of #36581.

That PR keeps the #10561 outcome: color overrides belong to a theme slot, and light mode that matches dark still reuses the dark bag. Keeping the original key as the dark slot, resolving the palette in one place, and reusing the existing Dark/Light target avoid a second control and a second stored key. I will not keep this branch competing on the same readers.

@innocarpe innocarpe closed this Oct 31, 2026
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