Skip to content

feat(settings): import Ghostty themes, including light/dark pairs, as per-mode terminal themes - #37368

Merged
nwparker merged 4 commits into
mainfrom
nwparker/theme-ghostty-theme-pairs
Nov 2, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/theme-ghostty-theme-pairs

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97 $\color{#cf222e}{\Huge{\mathbf{−}}}$​64 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​412 $\color{#cf222e}{\Huge{\mathbf{−}}}$​82 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​330

Summary

Most Ghostty users get their colors from theme, and that includes the theme = light:X,dark:Y pair that follows the system appearance. Before this PR, the Ghostty import:

  • flattened a single theme into color overrides, which leaked across light and dark mode;
  • rejected light/dark pairs as unsupported;
  • looked themes up in a single directory per platform, with no Windows lookup at all.

Root cause: the import had no notion of Orca's per-mode terminal theme slots, which landed in #36581. It treated a theme as a bag of override colors.

The import now maps theme onto the slots:

Ghostty config Orca settings
theme = X Terminal Theme = X, "Match dark mode" on. One theme paints both appearances, as in Ghostty.
theme = light:A,dark:B Dark slot = B, Light slot = A, separate light theme on.
Explicit background =, palette =, … That slot's color overrides. They replace stale overrides from earlier imports, so they no longer tint the new theme.

Name resolution follows Ghostty (src/config/theme.zig):

  • An absolute path or ~/… is read directly.
  • Otherwise, Orca checks the user themes dir ($XDG_CONFIG_HOME/ghostty/themes; on Windows, LOCALAPPDATA), then Ghostty's bundled themes:
    • macOS: Ghostty.app in /Applications or ~/Applications
    • Linux: $XDG_DATA_DIRS, ~/.local/share, or the snap path
    • any platform: GHOSTTY_RESOURCES_DIR
  • For a picked config (feat(settings): let the Ghostty import read a config file you pick #37353), a themes/ folder next to it is also checked: after the user themes dir, before the bundled themes.
  • If no theme file exists (for example on Windows, or with a config copied from another machine), Orca's built-in catalog is matched by name, ignoring case, -/_ and a .conf suffix.

What happens with a resolved theme file:

  • If its palette is identical to Orca's built-in of the same name (Dracula, Rose Pine, Gruvbox Dark, …), the built-in is selected.
  • Otherwise it is imported as a custom terminal theme with source ghostty. If Orca has a built-in with the same name but a different palette, the import is labelled "(Ghostty)". Catppuccin is an example: Ghostty ships a newer palette.
  • Re-importing the same config is a no-op.

Unresolved names and incomplete pairs (light:X with no dark half) show in the preview's unsupported list. The preview shows theme names, not internal IDs.

Closes #22640
Refs #36581

Stacked on #37353. This PR will be retargeted to main once that PR lands.

Visual proof

The config is theme = light:Catppuccin Latte,dark:Catppuccin Mocha, on a throwaway HOME/XDG_CONFIG_HOME with the real Ghostty.app bundled themes.

Before (origin/main) After
Preview, dark before dark after dark
Preview, light before light after light

After Apply: Settings → Terminal Themes, dark slot and light slot.

Dark slot (app in dark mode) Light slot (app in light mode)
applied dark applied light

Merge-risk assessment: Low

  • Blast radius: the Ghostty import preview/apply path, which the user starts by clicking Import, plus the onboarding Ghostty step through the same shared apply helper. Nothing runs at startup or while idle.
  • Back-compat: no new settings keys. terminalThemeDark/Light, terminalUseSeparateLightTheme, terminalColorOverrides(Light) and terminalCustomThemes with source ghostty all exist already, and older Orca versions read them the same way. An older client syncing these settings sees a custom theme it already knows how to render.
  • Shared code touched additively:
    • inferTerminalThemeMode now lives in terminal-custom-themes.ts, and the Warp parser reuses it with identical math.
    • TERMINAL_ANSI_COLOR_KEYS is now exported.
    • ghosttyImportSettingsUpdate is new in ghostty-import-preview.ts.
    • withImportedTerminalColorOverrides is unchanged.

Negative user-facing tradeoffs

  • Importing a config that has theme now changes the selected terminal theme, and clears that slot's existing color overrides. Before, the theme colors were merged into the overrides on top of the current theme. The preview lists both changes before you apply.
  • A single theme = X turns on "Match dark mode", so a separate light terminal theme you had chosen is no longer used. This matches Ghostty's single-theme behaviour.
  • A light/dark pair follows Orca's appearance setting, not the OS directly, unless Orca's theme is "System". The import does not change the app theme.
  • Ghostty themes that differ from an Orca built-in of the same name appear as extra "(Ghostty)" entries in the theme picker.
  • Without a Ghostty install, only the ~31 Orca built-ins can be matched by name. Any other name is reported as not found.
  • Theme files that set only some colors get the rest from Orca's Ghostty-default palette.

Validation

  • pnpm tc:node, pnpm tc:web: clean. The only error, a pre-existing one from Show agent sign-in notices before the first chat message #37191, is fixed on main by test: fix main's typecheck after the conversation view module moved #37346.
  • pnpm test src/main/ghostty src/main/warp-themes src/renderer/src/components/onboarding src/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.ts: 275 passed. The rewritten theme-import.test.ts covers:
    • a theme file becoming a custom theme, with explicit colors replacing stale overrides;
    • a light/dark pair with a built-in fallback;
    • an unresolved name and a half pair reported as unsupported;
    • an unchanged re-import being a no-op;
    • an absolute theme path.
  • oxlint and oxfmt on changed files; verify:localization-extraction.
  • Real app checks: dev build, ORCA_BACKGROUND_LAUNCH=1, CDP port 9365, throwaway HOME, XDG_CONFIG_HOME and user-data dir.
    • The preview shows both slots.
    • Apply persisted terminalThemeDark=custom:ghostty:catppuccin-mocha-ghostty, terminalThemeLight=custom:ghostty:catppuccin-latte-ghostty and terminalUseSeparateLightTheme=true.
    • The terminal previews paint Mocha in dark and Latte in light.
    • Re-opening the import shows "No new settings to import".
  • A probe against the real Ghostty.app themes: Dracula, Rose Pine and Gruvbox Dark select the identical Orca built-ins. Nord and Catppuccin differ, so they import as "(Ghostty)" custom themes.
  • Reviews:
    • One Opus sub-agent. Fixed all of these: key-order-unstable re-import, explicit colors lost when the dark half is missing, an over-counted theme limit, Windows LOCALAPPDATA, Ghostty's :-only pair syntax with quoted values, the separate-light flag being cleared when the light half is missing, extra Linux install prefixes, returning a patch instead of mutating, and listing only imported names.
    • Codex (gpt-6.1-sol, xhigh) took longer than 5 minutes, but it finished, and I acted on its report. Beyond the items above, I fixed:
      • two different theme files with the same basename no longer overwrite each other (the light one gets a "(Light)" suffix);
      • a theme's split-divider-color imports again, with explicit config keys winning;
      • a picked config's sibling themes/ folder now ranks below the user themes dir, so lookup precedence matches Ghostty's.

Perf

  • Scanned: the diff against feat(settings): let the Ghostty import read a config file you pick #37353, using the perf-scan questions. Every new path runs only when the user opens the Ghostty import. Nothing runs at startup, while idle, or per render.
  • Filesystem work per preview: at most one stat per theme search dir per theme name (two names for a pair), stopping at the first hit. Each hit is one readFile, capped at 256 KB. Orca's catalog lookup map is built lazily, once.
  • Measured in the dev build, with real Ghostty.app themes and 30 runs: the preview with a light/dark pair took p50 0.70 ms / p95 0.90 ms. That is the same order as a preview with no theme (PR feat(settings): let the Ghostty import read a config file you pick #37353: p50 0.60 ms).
  • Findings: none.

@nwparker
nwparker force-pushed the nwparker/theme-ghostty-pick-file branch from e23ca9b to 141de79 Compare November 2, 2026 06:41
@nwparker
nwparker force-pushed the nwparker/theme-ghostty-theme-pairs branch from af13425 to 8f70fb6 Compare November 2, 2026 06:41
@nwparker
nwparker changed the base branch from nwparker/theme-ghostty-pick-file to main November 2, 2026 08:12
@nwparker
nwparker force-pushed the nwparker/theme-ghostty-theme-pairs branch from bec3d72 to ce5696c Compare November 2, 2026 08:13
@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: b872141c-fa04-46fe-a546-fea6395b7319
Commits

Reviewing files that changed from the base of the PR and between ce5696c and 2e3ddd8.

Files selected for processing: 1
  • src/renderer/src/i18n/locales/en.json
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/i18n/locales/en.json

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

Walkthrough

Ghostty theme references now resolve to built-in or custom terminal themes, including light/dark pairs. Theme lookup includes platform-specific directories and an optional selected-config directory. The importer combines theme settings with other config changes and includes resolved theme names in its preview. The renderer displays theme-aware preview values and uses the updated settings flow. Shared theme-mode inference is also used by the Warp theme parser.

Merge Risk: Minimal · up to 2e3dd

No merge-blocking issue is identified in the selected change; it is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 52.38% 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 clearly and concisely describes the primary change: importing Ghostty themes, including light/dark pairs, into per-mode terminal themes.
Description check Passed The description is mostly complete. It explains the user impact, implementation, motivation, linked issues, visual changes, testing, risk, performance, compatibility, and review validation. Several te…
Linked Issues check Passed The PR satisfies the coding requirements in #22640. theme-mapping.ts parses single themes and light/dark pairs, resolves built-in names and theme files, creates per-mode custom themes, and applies t…
Out of Scope Changes check Passed The changes remain within #22640. The shared inferTerminalThemeMode helper and Warp parser update support consistent theme-mode behavior. Onboarding, preview formatting, labels, localization, and sh…
Full details: Description check

Explanation

The description is mostly complete. It explains the user impact, implementation, motivation, linked issues, visual changes, testing, risk, performance, compatibility, and review validation. Several template headings and checklist items are not reproduced verbatim, but the required information is substantially covered.

Full details: Linked Issues check

Explanation

The PR satisfies the coding requirements in #22640. theme-mapping.ts parses single themes and light/dark pairs, resolves built-in names and theme files, creates per-mode custom themes, and applies theme and color settings. theme-resolution.ts adds the required user, picked-config, bundled, and platform-specific lookup paths. GhosttyImportModal previews resolved theme names and unsupported references. theme-import.test.ts covers custom themes, built-in fallback, pairs, unresolved and incomplete values, divider colors, absolute paths, and repeat imports.

Full details: Out of Scope Changes check

Explanation

The changes remain within #22640. The shared inferTerminalThemeMode helper and Warp parser update support consistent theme-mode behavior. Onboarding, preview formatting, labels, localization, and shared apply logic update existing Ghostty import consumers for the new per-mode result. The added tests support the feature behavior. No demonstrated unrelated change is present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 52.38% 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 21 functions across 11 files. (1 skipped: 1 unsupported.)

Resolution

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

  • 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-ghostty-theme-pairs branch from ce5696c to 2e3ddd8 Compare November 2, 2026 08:32
@nwparker
nwparker merged commit 3fa4a05 into main Nov 2, 2026
57 checks passed
@nwparker
nwparker deleted the nwparker/theme-ghostty-theme-pairs branch November 2, 2026 08:50
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.

[Feature]: Ghostty import should map theme (incl. light:/dark: pairs that follow system appearance)

1 participant