Skip to content

feat(settings): delete imported terminal themes from the theme picker - #37356

Merged
nwparker merged 4 commits into
mainfrom
nwparker/theme-delete-imported-terminal-themes
Nov 2, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/theme-delete-imported-terminal-themes

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​64 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​64
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​210 $\color{#cf222e}{\Huge{\mathbf{−}}}$​55 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155

Summary

Themes imported from Warp or YAML are stored in terminalCustomThemes, and until now nothing in the UI could remove one. Re-importing an edited file also creates a new entry, because the id includes a content hash, so the picker filled up with stale copies.

What changes: hovering or focusing an Imported row in Settings → Appearance → Terminal Themes now shows a ghost trash button with a tooltip. Built-in and plugin rows don't get one. Deleting a theme shows a toast with Undo, following the same pattern as removing a browser history suggestion.

No dangling selections. The core change is one shared function, terminalCustomThemeRemoval in src/shared/terminal-theme-selection.ts:

  • It removes the theme. Every terminal theme slot that showed it (terminalThemeDark or terminalThemeLight, the per-mode slots from fix(terminal): scope terminal color overrides to their light/dark theme slot #36581) goes back to that slot's default.
  • It clears that slot's color overrides, as choosing any theme in the picker already does. Otherwise the old overrides would be painted over the default theme.
  • A slot showing a different theme is left alone.
  • Nothing else stores a custom: selection. Match Terminal, native chat, previews, OSC replies and mobile all derive their colors from these slots through resolveTerminalPalette, so they follow the fallback automatically.

Undo puts the theme back only if it hasn't been re-imported since. It restores a slot only if the user hasn't changed that slot since (it still shows the default and has no overrides). An Undo can't overwrite a newer choice.

Writes are serialized. The store applies a settings write only once it's acknowledged, so two quick deletes would each be computed from the same stale list and the first deleted theme would come back. Deletes and undos therefore go through a small promise queue that reads the latest store settings before each write. The bug was reproduced by Codex against the real persistVisibilityAwareSettings, then verified fixed in the app.

Not done: upserting on re-import of the same file name (the issue's alternative ask). The id includes a content hash on purpose, and delete covers the clutter case.

Closes #32138

Visual proof

Before (origin/main), with no way to remove an imported theme:

before

After, dark mode, hovering the selected imported theme:

after hover

After deleting the selected Dusk: the dark slot falls back to Ghostty Default Style Dark (shown in the "Selected" line and the live preview), focus moves to the search field, and the toast offers Undo:

after delete

After, light mode:

after light

Merge-risk assessment: Low

  • Blast radius: the Settings terminal theme picker plus one pure shared function. No new settings keys, IPC, schema or migration.
  • Remote and web clients: the delete is an ordinary updateSettings patch of existing keys (terminalCustomThemes, terminalThemeDark/Light, terminalColorOverrides(Light)). It goes through the same store path on desktop, the web client and remote orca serve settings.
  • Mixed versions: older clients or servers just see a shorter list and a default theme name. Older clients that still hold a stale custom: selection already fall back to the slot default on read (resolveTerminalPalette), so nothing breaks either way. Clearing overrides uses the same undefined patch the picker already sends.
  • Mobile: mobile has no terminal theme picker. It receives the resolved theme from the host, so it follows the fallback with no change.
  • Platforms: pure React/settings code, nothing platform-specific.

Negative user-facing tradeoffs

  • Deleting the theme a slot is using also drops that slot's color overrides, matching what choosing another theme does. Undo restores them while the toast is open (about 4s). After that, they're gone.
  • There is no confirmation dialog. A theme can be re-imported from its file, and Undo covers mistakes.
  • The trash button keeps its space even while hidden, so swatches and the "Current" label on imported rows sit about 24px further left than before.
  • A theme restored by Undo goes to the end of the Imported list.
  • An import and a delete that overlap within the same few milliseconds (before the first write is acknowledged) can still overwrite each other, because imports don't go through the new queue. This was already true for imports racing other list writes.

Validation

  • pnpm test src/shared/terminal-theme-selection.test.ts passes (12 tests). The new cases cover fallback of both slots and Undo, Undo keeping a later slot change, Undo not clobbering a re-import, and slots showing another theme being left untouched.
  • pnpm test on TerminalThemeSections.lifecycle.test.ts, TerminalPane.section-lifetime.test.tsx and AppearancePane.test.tsx passes (46 tests).
  • pnpm tc:web passes. pnpm tc:node reports one error in agent-model-catalog-scaling.test.ts (a missing module, unrelated to this branch); the files this PR touches typecheck clean. oxlint is clean. pnpm sync:localization-catalog plus the verify:localization-* protected-copy and extraction checks pass.
  • Real app: ORCA_BACKGROUND_LAUNCH=1 dev build, CDP port 9361, throwaway HOME and user-data dir. I seeded three imported themes, with Dusk selected for dark (plus a cursor override) and Dawn selected for light. Through the real picker I checked:
    • Deleting Dusk switched dark to the default, cleared the override, repainted the preview and moved focus to search.
    • Undo restored Dusk, the dark selection and the override (re-read from disk with fetchSettings).
    • Deleting Dawn on the Light target switched light to Builtin Tango Light.
    • Two deletes in a row within milliseconds both stuck.
    • Light and dark rendering looked right.
  • Review: one Opus sub-agent review, then an Opus re-review of the delta. Codex (gpt-6.1-sol, xhigh) was cut off at about 5.5 minutes before it wrote its final summary. Before that, it reproduced three findings, all fixed here: the stale double delete, Undo clobbering overrides edited later, and Undo clobbering a re-import. Opus findings also fixed: focus loss after delete, the button being undiscoverable on touch (hover:none now keeps it visible), and the inner button's focus ring radius.

Perf

  • Scanned: the full diff vs origin/main (perf-scan questions 1–6).
    • Work runs only on a delete or Undo click: one filter over at most 200 themes, then one settings write.
    • There are no new subscriptions, effects, timers or listeners. The queue holds one resolved promise when idle.
    • Rendering: each imported row adds 8 DOM nodes (wrapper, button, icon). That was measured in the app; there are at most 80 rows (MAX_THEME_RESULTS), and only on the Settings page. Tooltip content mounts only on hover.
    • Terminal, explorer and other hot surfaces are untouched.
  • Findings: none.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
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: 1bec16ac-8f59-432f-91d0-32906eec607a
Commits

Reviewing files that changed from the base of the PR and between 9d22b02 and a277bb8.

Files selected for processing: 5
  • src/renderer/src/components/settings/TerminalThemePicker.tsx
  • src/renderer/src/components/settings/TerminalThemeSections.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/terminal-theme-selection.test.ts
  • src/shared/terminal-theme-selection.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

The terminal theme picker now provides a delete control for imported themes when a delete callback is available. Deletion removes the theme, resets slots that select it, and clears their color overrides. A toast offers an undo action that restores the theme and eligible saved slot settings. The change adds English labels and tests for removal and undo behavior.

Severity of issue fixed: Low

Merge Risk: Low · up to a277b

Importing and deleting themes at nearly the same time can leave the theme list in an unexpected state. This is a bounded, recoverable risk that can be accepted for merge or addressed by coordinating the writes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "feat(settings): delete imported terminal themes from the theme picker" matches the main change in the changeset: a delete action for imported terminal themes in the Settings theme picker, w…
Description check Passed The description follows the repository template closely. It includes a summary covering what changed and why, a clear mechanism section for the shared removal function, a before/after visual proof sec…
Linked Issues check Passed Issue #32138 requests a way to remove imported terminal themes. ThemePicker renders a delete button only for imported themes. TerminalThemeSections queues deletion and provides Undo. `terminalCust…
Out of Scope Changes check Passed The changes stay within issue #32138. The shared removal function, picker UI, toast and Undo flow, localization, focus handling, serialization queue, and automated tests directly support deletion of i…
Full details: Title check

Explanation

The title "feat(settings): delete imported terminal themes from the theme picker" matches the main change in the changeset: a delete action for imported terminal themes in the Settings theme picker, with slot fallback and Undo. It is specific and conventional, and it does not describe anything absent from the changeset. The title is 69 characters, which is within a reasonable length for a single-sentence summary.

Full details: Description check

Explanation

The description follows the repository template closely. It includes a summary covering what changed and why, a clear mechanism section for the shared removal function, a before/after visual proof section with four images, detailed testing and validation notes, a merge-risk assessment with a stated level (Low), and a perf section. It links the issue with 'Closes #32138'. Gaps: the template's ELI5 section is missing, the 'Linked Issue' section uses 'Closes' instead of the template's 'Fixes #' heading wording, the Testing checkbox list is not marked, the 'Risk' section does not explicitly state the backout path (plain revert versus what a revert would not undo), the 'Agent skill upstream boundary' checkbox is not ticked, the 'AI Disclosure' section is blank, and the Checklist items are not ticked. These are mostly non-critical sections or checkboxes, so the description is mostly complete.

Resolution

Optional improvements: add a short ELI5 section; state the backout method (plain revert and what a revert would not undo, such as settings already written by a delete); tick or address the Testing and Checklist items; complete the AI Disclosure section if applicable; and confirm the Agent skill upstream boundary item.

Full details: Linked Issues check

Explanation

Issue #32138 requests a way to remove imported terminal themes. ThemePicker renders a delete button only for imported themes. TerminalThemeSections queues deletion and provides Undo. terminalCustomThemeRemoval removes the theme, resets affected dark and light slots, and clears their color overrides. The added tests cover deletion, fallback, Undo, later slot changes, re-imports, and unrelated slots. The issue presents id-based upsert as an alternative, so the PR does not need to implement it.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #32138. The shared removal function, picker UI, toast and Undo flow, localization, focus handling, serialization queue, and automated tests directly support deletion of imported terminal themes. Built-in and plugin themes remain non-deletable. No unrelated product area or settings schema change is shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • 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

@nwparker
nwparker force-pushed the nwparker/theme-delete-imported-terminal-themes branch from 17ca819 to e000951 Compare November 2, 2026 06:34
@nwparker
nwparker force-pushed the nwparker/theme-delete-imported-terminal-themes branch from e000951 to a277bb8 Compare November 2, 2026 08:13
@nwparker
nwparker merged commit adb2d2d into main Nov 2, 2026
51 checks passed
@nwparker
nwparker deleted the nwparker/theme-delete-imported-terminal-themes branch November 2, 2026 08:31
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.

feat(settings): allow deleting imported custom terminal themes

1 participant