You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(themes): Match Terminal becomes a real app theme for the whole window - #36567
Based on main (daa11df4062), after #36561 and #36578 merged. Main includes #36581 (per-mode terminal color overrides).
Files
Added
Deleted
Net
Test
5
$\color{#1a7f37}{\Huge{\mathbf{+}}}$178
$\color{#cf222e}{\Huge{\mathbf{−}}}$8
$\color{#1a7f37}{\Huge{\mathbf{+}}}$170
Prod
43
$\color{#1a7f37}{\Huge{\mathbf{+}}}$741
$\color{#cf222e}{\Huge{\mathbf{−}}}$360
$\color{#1a7f37}{\Huge{\mathbf{+}}}$381
Summary
"Match Terminal" is now a real app theme. It is built from the active terminal palette and painted at :root through the same pipeline as plugin themes, so the whole window follows it: tab bar, titlebar, both sidebars, status bar, menus, popovers, dialogs, the Monaco editor and native chat. It no longer stops at the left sidebar.
Root cause
leftSidebarAppearanceMode: 'match-terminal' was an inline CSS-variable override on three elements only: the left sidebar, its titlebar header and the Settings sidebar. Everything else kept the built-in palette, which is why the window looked two-toned (#10864, #16936, #31165, #7417) and why editors ignored it (#17199). It also mixed text at fixed ratios (a 62% muted mix, for example) with no contrast check, so low-contrast palettes like Solarized became unreadable (#16999).
What changed
One theme source per mode. The Light theme and Dark theme pickers under Settings → Appearance → Interface now offer Built-in / Match Terminal / any plugin theme. They are always shown now, not only when a plugin theme is installed. The value is stored in the existing slots (pluginAppThemeLight/Dark = 'match-terminal'), so Match Terminal and a plugin theme can't both be active in one mode, and each mode can pick differently.
Background comes from the terminal background, composited opaque. The foreground is the terminal foreground, pushed just far enough toward black or white to reach WCAG AA (4.5:1) on every surface it sits on. Muted text gets the same treatment.
Surfaces are small foreground tints of the background. On a mid-tone background where those tints would leave no 4.5:1 text color (e.g. #757575 with white text), they tint away from the text instead, so the contrast gate never drops --background.
--primary/--ring use ANSI blue (or bright blue) only when it reaches 3:1 against the background and has a 4.5:1 label color. Charts use the ANSI colors.
Code colors come from ANSI roles: string → green, keyword → magenta, and so on.
The result goes through completePluginAppThemeTokens → the shared contrast gate (safePluginThemeTokens) → applyPluginAppTheme (including the startup cache, so there is no flash) → derivePluginMonacoTheme. Monaco drops any ANSI color below 3:1 and keeps the built-in color for it.
Light/dark follows the terminal. With Match Terminal selected, the document's dark/light class follows the terminal background, so a light terminal theme under a dark app setting gets light editors, markdown and Mermaid. The Appearance setting still decides which terminal theme and which slot are active, so this can't loop. useDocumentDarkTheme() now returns the painted mode. A new useSettingsDarkTheme() returns the requested mode, used for slot logic. Clicking the Theme buttons, onboarding's theme preview and its restore on close, the pop-out window and the Space window all apply the painted mode too.
Marked as dynamic. The Match Terminal option shows a muted (⚡ dynamic) label (lucide Zap, size-3, text-muted-foreground) in both the dropdown and the selected-value trigger, because unlike the other choices it follows the terminal live. Translated in all 11 locales. There's no app theme picker on mobile, so there's nothing to mirror there.
Native chat. When the app already matches the terminal, chat's "Match terminal interface" keeps its fonts and spacing but skips its own color remap (which had the same fixed 62% muted mix). It follows the contrast-checked app colors instead. It also now sees plugin terminal palettes and respects disabled plugins.
Old path deleted. The match-terminal branch of left-sidebar-appearance.ts is gone, along with its terminal inputs and systemPrefersDark at the three call sites. Tinted is unchanged and stays sidebar-scoped. It now tints over the active theme's background.
Back-compat.syncLegacyMatchTerminalSidebar runs on settings load and on every write that touches the slots or the sidebar mode, including the web client's localStorage settings. A legacy leftSidebarAppearanceMode: 'match-terminal' (from before this change, or written by an older client) fills each empty app theme slot; a slot that already holds a plugin theme keeps it. In the other direction, the sidebar value stays 'match-terminal' while either slot matches the terminal and goes back to default once neither does. An older Orca therefore still gets its sidebar match after a downgrade, and re-upgrading restores the slots. This version's sidebar treats 'match-terminal' as Default, and Tinted still wins when chosen.
Closes#10864 Closes#16936 Closes#31165 Closes#17199 Closes#7417 Closes#16999
Refs #15971 — the host pill is legible under Match Terminal because the gate keeps text pairs readable, but the pill's layering issue in Default/Tinted is WS-bugs' work.
Supersedes/builds on #7251 by @tofunori, #16768 by @seedotlee (chrome and editor parts), #17000 by @seedotlee (contrast-aware muted text) and #31166 by @thomas-seres. Their analyses (root-level variables, editor palette from ANSI slots, contrast-aware mixes, reaching the right panel and tab bar) shaped this design. This PR routes all of it through the shared plugin-theme pipeline instead of a parallel one.
Visual proof
Match Terminal (⚡ dynamic): trigger and open dropdown
The Light slot uses Solarized Light with a light override of #fbf1d8. The Dark slot uses Nord with a dark override of #1b2b34, so each screenshot also shows that mode's terminal override being painted.
Light
Dark
Trigger
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Open dropdown
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Whole window with the same per-mode overrides, after the rebase onto #36578 / #36581. Monaco uses the ANSI syntax colors and the tab bar follows the palette:
Light (#fbf1d8)
Dark (#1b2b34)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Before / after (earlier rounds)
Full window, same profile, terminal + editor split, right sidebar open. "Before" is origin/main with Left Sidebar → Match Terminal. "After" is this branch on the same profile; the setting migrated on launch.
Scene
Before (origin/main)
After
Dark · Nord
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Dark · Solarized Dark (low contrast)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Dark slot · Solarized Light (app follows the terminal to light)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Light · Solarized Light (low contrast)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Light · One Light
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Settings → Appearance, searched for "match terminal". The pickers offer Built-in / Match Terminal / plugin themes, and the Left Sidebar control keeps Default / Tinted:
(screenshot removed: contained real product data)
Terminal opacity 0.6 (Nord), origin/main vs this branch:
Before
After
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Clicking the already-selected Dark button with a light terminal theme keeps the light paint:
(screenshot removed: contained real product data)
Merge-risk assessment: Low (was Low–medium)
Phase-3 evidence (stack rebased onto main with #36581, code 1fb0e5725e4; final head 9c7e9f5c2ca adds the icon swap and the perf fix below):
Per-mode overrides reach the theme:
In the app with terminalColorOverrides (dark) #1b2b34 and terminalColorOverridesLight#fbf1d8, Dark mode paints --background: #1b2b34 and Light paints #fbf1d8.
A unit test pins it: each mode's overrides, plus opaque surfaces.
Both legacy migrations compose, in both directions, on real profiles:
Downgrade to that build and re-upgrade: the old build read the mirror and painted its sidebar match with the legacy override. It saved the slots as null. Back on this branch the slots were refilled, the per-mode overrides were intact, and the app painted #fbf1d8.
Web client:migrateStoredWebSettings converts the same legacy localStorage shape. I checked this with a scratch test, not committed: both slots, the mirror, the light override split and terminalColorOverridesSplit all come out right. Theme settings in the web client stay in browser storage, so mixed server versions don't affect them; the earlier round's web client vs orca serve 1.4.232 run still stands.
Review on the rebased delta (Opus ×2 + Codex). Fixed:
Mid-tone palettes lost their background to the contrast gate. Fixed, with a regression test that fails without the fix.
Onboarding restored, and previewed, the requested mode over a Match Terminal palette of the other mode. Fixed, and exercised in the app: with Dark mode and Solarized Light in the Dark slot, the document stays light (#fdf6e3) while onboarding is open and after it closes.
Native chat fell back to dark on an unreadable palette while the app kept the requested mode. Fixed.
Localized settings search couldn't find the theme pickers by the translated "Match Terminal". Fixed.
The sidebar hint was English-only. Now translated.
Phase-2 evidence that lowered it, all on the final code:
Downgrade round trip, real profile: origin/main → branch → origin/main → branch on one profile. Match Terminal was in the Dark slot and a plugin theme id in the Light slot.
Converted: Dark = match-terminal, Light plugin kept, mirror 'match-terminal'.
Back on main: the sidebar still matches the terminal (--worktree-sidebar: #2e3440). Dark is saved as null.
Re-upgraded: Dark refilled to match-terminal, and the plugin slot was untouched.
All useDocumentDarkTheme consumers under an opposite-mode terminal (Dark mode with Solarized Light in the Dark slot), each rendered light and readable:
Monaco editor, Monaco diff and combined diff
rich markdown, highlighted code block, Mermaid
notebook cells, ANSI outputs and notebook markdown
context menu, a dialog, Space window, dashboard pop-out
native chat (shown under Native chat below)
By code: the emoji pickers follow the same hook. Mobile and terminal-pane titles read the terminal palette for the requested mode, which this PR doesn't change.
Dashboard pop-out:openPopout() had reported "closed" because my harness evaluated in the Space window, an untrusted renderer. From the main window it opens and follows the painted mode.
Mixed-version web client and remote server: I ran this branch's web client (pnpm dev:web) against orca serve 1.4.232 on the Linux host omarchy, over an SSH tunnel, with an isolated profile. Results:
It paired and connected ("1 host").
Legacy browser settings { leftSidebarAppearanceMode: 'match-terminal' } converted, and the page painted Solarized Light (#fdf6e3).
Theme settings stay in browser storage and are never sent to the server, so the server's version doesn't matter for this feature.
One unrelated page error showed up: announcePluginUpdateReviews reading .length of undefined from the older server.
Native chat: opened a transcript-backed Claude session with the repo's e2e approach (seeded provider session + chat view toggle). It follows the app theme. With "Match terminal interface" on, it keeps the terminal font and uses the contrast-checked --muted-foreground (#5f6868).
Re-review on the delta (Opus + Codex) found one real bug, now fixed with a regression test: a full-settings write that clears both slots kept the mirror and was treated as a legacy write, which refilled the slots. A legacy write now only counts when the write carries the sidebar value without the slots.
Screens (Dark mode, Solarized Light in the Dark slot):
Markdown + Mermaid
Native chat (match terminal interface)
Notebook
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Dashboard pop-out
Downgraded to origin/main (sidebar mirror)
Web client vs serve 1.4.232
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Remaining risk:
Stacking: rebased onto feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578. Its new row, host-badge and tab tokens (--worktree-sidebar-active, --host-badge, --tab-*) aren't painted by this theme. They derive in main.css from the painted --card/--accent/--foreground/--muted-foreground, so they follow the terminal palette. feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578's initial resets for those tokens now live only on the Tinted sidebar path, and the per-element Match Terminal path that also reset them is deleted. Native chat keeps the --chat-user-message: initial reset in its own terminal remap. The contrast gate's new light/dark parameter is passed through.
Legacy "Default" write from an older client while a slot is Match Terminal: it is re-mirrored to 'match-terminal'. This version's own sidebar control writes the same shape, so the two can't be told apart. In practice no older client writes into this store: desktop main and renderer ship together, the web client keeps appearance in its own localStorage, and an older desktop build on a downgrade saves the slots as null, so choosing Default there does stick.
Blast radius: Match Terminal users get a whole-window repaint. useDocumentDarkTheme now returns the painted mode for 16 consumers, but it only differs from before when Match Terminal follows a terminal theme of the other mode. Built-in and plugin theme users see no change apart from the two pickers now always showing.
Migration: leftSidebarAppearanceMode: 'match-terminal' fills the empty slots and stays mirrored for older builds. Covered by unit tests (including the round trip, where choosing Built-in for both modes doesn't refill) and exercised in the app by restarting an origin/main profile on this branch.
Back-compat: older clients normalize the 'match-terminal' slot value to null, but they still read the mirrored leftSidebarAppearanceMode: 'match-terminal', so they keep their sidebar match. Newer builds translate legacy writes.
Perf: the theme is derived only when a slot selects it (useShallow over the terminal fields; memoized by settings identity for the dark-mode hook). It costs nothing when the feature is off and adds no new CSS effects.
Perf
Scope: I ran the perf-scan over this PR's diff against #36578 (ddda6cd7646). It covered the paths that run per store update or per settings write:
Main-process, host and streaming paths are not touched.
Finding (fixed in f286007e3a4):
Under Match Terminal, every unrelated settings write repainted the whole window. Settings writes hand out fresh terminalCustomThemes/disabledPlugins arrays, so useShallow saw new inputs and re-synthesized the theme. The fresh theme object then re-ran applyPluginAppTheme, the :root style recalc and the Monaco theme derivation.
Measured over 30 writes of an unused setting: 213 style recalcs / 725 ms. After the fix: 4 recalcs / 0.5 ms, the same as with the feature off.
Fix: synthesizeTerminalAppTheme returns the previous theme object when the serialized content (base, tokens, syntax colors) is unchanged. It compares the exact string, not a hash, so a hash collision can't serve a stale palette.
Measurements: Hidden dev build, same profile and workload: a workspace with a TypeScript file open in Monaco, Dark mode. CDP Performance.getMetrics deltas; latency is from the settings write to the second animation frame. Write latency is dominated by the settings IPC round trip, about 35 ms even when nothing repaints.
The remaining cost is the feature itself. On base, a terminal-palette change under Match Terminal repaints only the left sidebar. Here it repaints the whole window and re-derives the Monaco theme: about 35 ms of style recalc per palette change, against about 14 ms on base, and about 20 ms more to the next frame. This happens only on user actions (changing the terminal theme, an override or the mode), never in steady state.
Pure work (vitest, Node):
Synthesizing the theme: about 68 µs per palette.
resolvePaintedDark with the feature off: about 0.01 µs. With Match Terminal and cached settings: about 0.02 µs.
A settings-identity cache miss: about 2.8 µs. That's at most one per settings write per consumer, about 45 µs across all 16 consumers.
Zero cost when off:
resolvePaintedDark returns before touching the terminal palette.
useTerminalAppTheme selects null.
No new CSS effects, timers or listeners.
Not measured:
Packaged builds; all numbers above are from dev builds.
Windows and Linux.
Bundle size: the PR adds one module of about 230 lines and one lucide icon that's already in the bundle.
Negative user-facing tradeoffs
Changing the terminal theme under Match Terminal costs a whole-window style recalc, about 35 ms against 14 ms for the old sidebar-only repaint (see Perf).
Match Terminal now recolors the whole window and the editor, not just the left sidebar. Users who wanted only a terminal-colored sidebar have no direct equivalent; Tinted with the terminal color is the closest.
Primary buttons and focus rings turn ANSI blue when the palette's blue is readable. Otherwise they stay neutral.
On low-contrast palettes (Solarized), app text is slightly darker or lighter than the terminal's own foreground so it meets WCAG AA.
With a light terminal theme in the Dark slot (or the reverse), the app paints in light mode (or dark), following the terminal.
Terminal background opacity: on origin/main, at opacity 0.6 with Nord, the old Match Terminal sidebar composites to a darker #20232a, and the terminal pane renders lighter at #363c49, so they already didn't match. On this branch the chrome is the opaque theme color #2e3440 and the terminal pane renders #393f4e–#3e4554. Translucency still shows a small step between the terminal and the chrome, as it did before. The darker translucent tint of the old sidebar is gone, because app surfaces must be opaque for the contrast gate. The lighter terminal composite exists on main too; it comes from how the xterm layers stack (see [Bug]: Background Opacity and Window Blur have no visible effect on Linux #36196, WS-window's area). Screenshots are below.
If a slot already held a plugin theme, the migration keeps the plugin theme in that mode; the old terminal-colored sidebar doesn't come back there.
Downgrading to an older Orca shows the old left-sidebar-only Match Terminal (the mirrored value), not the whole-window theme. An older build saves the slots as null; upgrading again refills them from the mirrored value.
Pop-out and Space windows now use the painted light/dark mode but not the synthesized colors; they never applied app theme colors. The native window background and nativeTheme still follow the Appearance setting, so a mode flip can show one pre-paint frame of the other mode.
The Light/Dark theme pickers are always visible now, which adds two rows to Appearance.
The Match Terminal option and its trigger are wider because of the (⚡ dynamic) label. The parentheses are not part of the translated word, so CJK locales show ASCII parentheses.
On mid-tone terminal backgrounds, surfaces such as popovers and hover rows can tint darker than the background instead of lighter (or the reverse on light themes), so the text stays readable.
Round-trip edge cases (accepted):
Built-in in one slot and Match Terminal in the other, downgraded and then upgraded: both slots come back as Match Terminal. The older build stores both as null, so this version can't tell the user's Built-in apart.
Match Terminal combined with a Tinted sidebar: the mirror is 'tinted', so after a downgrade and upgrade Match Terminal isn't restored.
Pop-out and Space windows follow the painted light/dark mode but show built-in colors, not the terminal palette; plugin app themes behave the same there.
pnpm test on onboarding, settings, lib, app-shell, native-chat, main/persistence, web, src/shared: 31,457 passed. 4 failed, all in untouched WSL suites (wsl-host-deployment-store, wsl-move-guest-process-table-cost). They fail on their own in this nested worktree and have no diff in this PR.
In the app: hidden dev build, throwaway profiles, CDP 9315. I checked the trigger and dropdown in light and dark, per-mode overrides painting, Monaco syntax colors from ANSI, the onboarding open/close mode, and the upgrade/downgrade round trips above.
After rebasing onto feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578: pnpm tc ✅; focused tests (shared plugin settings/artifacts, web preload, native chat, settings, app-shell, lib, main/persistence, sidebar) 19,164 passed. In the app, the tab bar (active/inactive), selected workspace row and host badge follow the terminal palette in Nord and Solarized Light:
Nord
Solarized Light
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
pnpm tc ✅, oxlint on changed files ✅, oxfmt ✅, pnpm sync:localization-catalog. The Match Terminal label translations moved to the new key and stale keys were removed.
pnpm test on: terminal-app-theme.test.ts (new: Solarized Light survives the contrast gate with nothing dropped; overrides; opaque surfaces; painted-mode flip), plugin-theme-settings.test.ts (slot normalization + legacy migration), use-document-appearance.test.tsx (painted mode), AppearancePane, Sidebar, SettingsSidebar, NativeChatPaneHeader, native-chat appearance, plugin component tests, src/main/persistence/**. All pass except an unrelated WSL timing test that times out under load.
App (final code, commit after review fixes): launched dev builds hidden (ORCA_BACKGROUND_LAUNCH=1, throwaway profile, CDP port 9315).
Legacy conversion: I created the profile on origin/main and saved leftSidebarAppearanceMode: 'match-terminal' (Nord, opacity 0.6), then restarted it on this branch. Both slots were match-terminal and the mirrored sidebar value stayed 'match-terminal'. The startup cache entry was written with base dark.
Scenes: Nord, Solarized Dark, Solarized Light in the dark slot, Solarized Light and One Light, compared against origin/main.
Clicking the already-selected Theme button: with Theme = Dark and a Solarized Light terminal, I clicked the active Dark button in Settings. The document stayed light with --background: #fdf6e3.
Space window under Match Terminal: it followed the painted mode, light for Solarized Light in the dark slot and dark after switching to Nord. Like before, it keeps built-in colors.
Pop-out window: opens from the main window and follows the painted mode (light for Solarized Light in the Dark slot). An earlier attempt failed only because the harness was calling from the Space window.
Switched-off plugin palette: a plugin terminal palette (Solarized-like, light) in the dark slot painted the app light #fdf6e3. With the plugin system switched off, the app fell back to the default dark palette (dark #282c34). A single plugin can't be disabled in a throwaway profile, because disabledPlugins only keeps installed plugins, so I used the global switch, which goes through the same check. Native chat can't be opened without launching an agent, so its matching behavior is covered by the new unit test (native-chat-appearance-style.test.ts: the plugin palette gives light, switched off gives dark).
Files skipped from review as they are similar to previous changes: 6
src/renderer/src/i18n/locales/en.json
src/renderer/src/i18n/locales/de.json
src/renderer/src/i18n/locales/pt.json
src/renderer/src/i18n/locales/tr.json
src/renderer/src/i18n/locales/zh-Hant.json
src/renderer/src/i18n/locales/ru.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
App theme slots now support Match Terminal and can derive an app theme from terminal palette colors. Settings normalization and write paths synchronize legacy sidebar selections with those slots. The renderer resolves the painted light or dark mode and applies the selected theme to the document and Monaco. Appearance controls and localized labels move terminal matching from the sidebar appearance setting to the light and dark theme slots. Native chat and sidebar styling also use the updated appearance settings.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 7e273
Older clients continue to receive the intended terminal-matching appearance, and Spanish users can find the theme setting by its translated name. No identified issue blocks merging after normal checks.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Linked Issues check
The PR implements the Match Terminal objectives in [#10864, #16936, #7417]. The synthesized root theme reaches app chrome, side panels, tabs, and Monaco. Contrast-aware foreground and muted tokens are…
1. For [#31165], extend Tinted styling to the tab bar and right sidebar, and add automated coverage for whole-chrome Tinted behavior. 2. For [#17199], connect Markdown, rich-markdown, notebook, and related syntax styles to terminal-derived …
Docstring Coverage
Docstring coverage is 58.97% 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 checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly identifies the primary change: Match Terminal becomes an application-wide theme rather than a sidebar-only feature.
Out of Scope Changes check
The changes remain connected to the linked theme objectives. Settings migration, painted-mode resolution, Monaco integration, native chat handling, localization, sidebar cleanup, and performance cachi…
Description check
The description is comprehensive and covers the change, rationale, linked issues, visual proof, testing, performance, compatibility, risks, and validation results. It does not use every template headi…
Full details: Out of Scope Changes check
Explanation
The changes remain connected to the linked theme objectives. Settings migration, painted-mode resolution, Monaco integration, native chat handling, localization, sidebar cleanup, and performance caching support the Match Terminal app-theme implementation. The Tinted limitation is an unmet linked requirement, not an unrelated change.
Full details: Description check
Explanation
The description is comprehensive and covers the change, rationale, linked issues, visual proof, testing, performance, compatibility, risks, and validation results. It does not use every template heading or complete the checklist explicitly, but the required information is largely present and the omissions are non-critical.
Full details: Linked Issues check
Explanation
The PR implements the Match Terminal objectives in [#10864, #16936, #7417]. The synthesized root theme reaches app chrome, side panels, tabs, and Monaco. Contrast-aware foreground and muted tokens are present for [#16999].
The PR does not meet all direct requirements:
[#31165] The issue covers both Match Terminal and Tinted. The PR keeps Tinted sidebar-scoped. The tab bar and right sidebar therefore do not follow Tinted.
[#17199] The inspected terminal theme emits ANSI syntax colors as Monaco tokenColors. It does not emit the terminal-derived --syntax-* values or change the Markdown and rich-markdown stylesheets. Painted light/dark mode alone does not provide terminal-derived syntax colors for those editors.
[#16999] The contrast gate covers the generated foreground tokens. Sidebar descendants still use fixed worktree-sidebar-foreground alpha tiers. The PR does not establish a 4.5:1 contrast guarantee for those secondary labels and icons.
Resolution
For [#31165], extend Tinted styling to the tab bar and right sidebar, and add automated coverage for whole-chrome Tinted behavior.
For [#17199], connect Markdown, rich-markdown, notebook, and related syntax styles to terminal-derived colors, and add automated coverage for those paths.
For [#16999], replace or contrast-check the sidebar foreground alpha tiers so low-contrast terminal palettes keep affected labels and icons readable, and add regression coverage.
Full details: Docstring Coverage
Explanation
Docstring coverage is 58.97% 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 39 functions across 38 files. (6 skipped: 6 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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Localize the Match Terminal search keyword.
The Spanish picker label is present, but appearance search reads the separate auto.components.settings.appearance.search.matchTerminal key, which this locale does not define. The theme-slot rows also use English-only keywords. Because search filters on titles, descriptions, and keywords—not dropdown contents—searching “coincidir” hides the new setting. Add a Spanish keyword under the appearance search catalog. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
set -eu
printf'%s\n''--- popout imports and appearance flow ---'
nl -ba src/renderer/src/popout.tsx | sed -n '1,125p'printf'%s\n''--- document theme token APIs ---'
nl -ba src/renderer/src/lib/document-theme.ts | sed -n '1,110p;175,260p'printf'%s\n''--- main shared appearance hook ---'
nl -ba src/renderer/src/app-shell/use-document-appearance.ts | sed -n '1,125p'printf'%s\n''--- terminal app theme synthesis ---'
nl -ba src/renderer/src/lib/terminal-app-theme.ts | sed -n '70,175p'
Repository: stablyai/orca
Length of output: 24088
Paint app-theme tokens in the popout.
When a popout receives Match Terminal settings, applyPopoutAppearance updates only the light/dark classes. It does not call the shared token-paint path. The separate popout document therefore can miss the terminal-derived CSS tokens. Apply the same Match Terminal synthesis and applyPluginAppTheme flow used by the main window for popout settings updates.
Match Terminal used to be an inline override on three left-column
elements, so the tab bar, right sidebar, status bar, titlebar, menus and
editors kept the built-in palette, and its fixed color mixes became
unreadable on low-contrast palettes.
It is now a light/dark app theme slot value synthesized from the active
terminal palette (read through resolveTerminalPalette, so each mode's
color overrides apply) and painted through the plugin theme pipeline
(derivation, contrast gate, startup cache, Monaco theme). The document
mode follows the terminal background, including onboarding's restore.
The legacy leftSidebarAppearanceMode='match-terminal' value fills the
empty slots on load and on writes (desktop and web), and it is kept
mirrored while a slot matches the terminal so older Orca still matches
its sidebar. The pickers mark the option with a muted "(dynamic)" label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on main (
daa11df4062), after #36561 and #36578 merged. Main includes #36581 (per-mode terminal color overrides).Summary
"Match Terminal" is now a real app theme. It is built from the active terminal palette and painted at
:rootthrough the same pipeline as plugin themes, so the whole window follows it: tab bar, titlebar, both sidebars, status bar, menus, popovers, dialogs, the Monaco editor and native chat. It no longer stops at the left sidebar.Root cause
leftSidebarAppearanceMode: 'match-terminal'was an inline CSS-variable override on three elements only: the left sidebar, its titlebar header and the Settings sidebar. Everything else kept the built-in palette, which is why the window looked two-toned (#10864, #16936, #31165, #7417) and why editors ignored it (#17199). It also mixed text at fixed ratios (a 62% muted mix, for example) with no contrast check, so low-contrast palettes like Solarized became unreadable (#16999).What changed
pluginAppThemeLight/Dark = 'match-terminal'), so Match Terminal and a plugin theme can't both be active in one mode, and each mode can pick differently.src/renderer/src/lib/terminal-app-theme.ts):resolveTerminalPalette(fix(terminal): scope terminal color overrides to their light/dark theme slot #36581) for the mode being painted, so the Light and Dark slots each use their own terminal color overrides.#757575with white text), they tint away from the text instead, so the contrast gate never drops--background.--primary/--ringuse ANSI blue (or bright blue) only when it reaches 3:1 against the background and has a 4.5:1 label color. Charts use the ANSI colors.completePluginAppThemeTokens→ the shared contrast gate (safePluginThemeTokens) →applyPluginAppTheme(including the startup cache, so there is no flash) →derivePluginMonacoTheme. Monaco drops any ANSI color below 3:1 and keeps the built-in color for it.dark/lightclass follows the terminal background, so a light terminal theme under a dark app setting gets light editors, markdown and Mermaid. The Appearance setting still decides which terminal theme and which slot are active, so this can't loop.useDocumentDarkTheme()now returns the painted mode. A newuseSettingsDarkTheme()returns the requested mode, used for slot logic. Clicking the Theme buttons, onboarding's theme preview and its restore on close, the pop-out window and the Space window all apply the painted mode too.(⚡ dynamic)label (lucideZap,size-3,text-muted-foreground) in both the dropdown and the selected-value trigger, because unlike the other choices it follows the terminal live. Translated in all 11 locales. There's no app theme picker on mobile, so there's nothing to mirror there.match-terminalbranch ofleft-sidebar-appearance.tsis gone, along with its terminal inputs andsystemPrefersDarkat the three call sites. Tinted is unchanged and stays sidebar-scoped. It now tints over the active theme's background.syncLegacyMatchTerminalSidebarruns on settings load and on every write that touches the slots or the sidebar mode, including the web client's localStorage settings. A legacyleftSidebarAppearanceMode: 'match-terminal'(from before this change, or written by an older client) fills each empty app theme slot; a slot that already holds a plugin theme keeps it. In the other direction, the sidebar value stays'match-terminal'while either slot matches the terminal and goes back todefaultonce neither does. An older Orca therefore still gets its sidebar match after a downgrade, and re-upgrading restores the slots. This version's sidebar treats'match-terminal'as Default, and Tinted still wins when chosen.Closes #10864
Closes #16936
Closes #31165
Closes #17199
Closes #7417
Closes #16999
Refs #15971 — the host pill is legible under Match Terminal because the gate keeps text pairs readable, but the pill's layering issue in Default/Tinted is WS-bugs' work.
Supersedes/builds on #7251 by @tofunori, #16768 by @seedotlee (chrome and editor parts), #17000 by @seedotlee (contrast-aware muted text) and #31166 by @thomas-seres. Their analyses (root-level variables, editor palette from ANSI slots, contrast-aware mixes, reaching the right panel and tab bar) shaped this design. This PR routes all of it through the shared plugin-theme pipeline instead of a parallel one.
Visual proof
Match Terminal (⚡ dynamic): trigger and open dropdown
The Light slot uses Solarized Light with a light override of
#fbf1d8. The Dark slot uses Nord with a dark override of#1b2b34, so each screenshot also shows that mode's terminal override being painted.Whole window with the same per-mode overrides, after the rebase onto #36578 / #36581. Monaco uses the ANSI syntax colors and the tab bar follows the palette:
#fbf1d8)#1b2b34)Before / after (earlier rounds)
Full window, same profile, terminal + editor split, right sidebar open. "Before" is origin/main with Left Sidebar → Match Terminal. "After" is this branch on the same profile; the setting migrated on launch.
Settings → Appearance, searched for "match terminal". The pickers offer Built-in / Match Terminal / plugin themes, and the Left Sidebar control keeps Default / Tinted:
(screenshot removed: contained real product data)
Terminal opacity 0.6 (Nord), origin/main vs this branch:
Clicking the already-selected Dark button with a light terminal theme keeps the light paint:
(screenshot removed: contained real product data)
Merge-risk assessment: Low (was Low–medium)
Phase-3 evidence (stack rebased onto main with #36581, code
1fb0e5725e4; final head9c7e9f5c2caadds the icon swap and the perf fix below):terminalColorOverrides(dark)#1b2b34andterminalColorOverridesLight#fbf1d8, Dark mode paints--background: #1b2b34and Light paints#fbf1d8.97582248e79): that profile had a Light theme, a sidebar set tomatch-terminaland one single override. On this branch, both slots becamematch-terminal, the mirror stayed'match-terminal', and the single override split into the light slot (fix(terminal): scope terminal color overrides to their light/dark theme slot #36581's migration). The app painted the override (#203040, dark, following the terminal).null. Back on this branch the slots were refilled, the per-mode overrides were intact, and the app painted#fbf1d8.migrateStoredWebSettingsconverts the same legacy localStorage shape. I checked this with a scratch test, not committed: both slots, the mirror, the light override split andterminalColorOverridesSplitall come out right. Theme settings in the web client stay in browser storage, so mixed server versions don't affect them; the earlier round's web client vsorca serve1.4.232 run still stands.light(#fdf6e3) while onboarding is open and after it closes.derivePluginMonacoThemenow getspaintedfromapplyPluginAppTheme's return value. The tab utilities and the removed:root--tab-*/--text-linkdefaults work with the synthesized theme; see the window screenshots above.Phase-2 evidence (earlier round):
Phase-2 evidence that lowered it, all on the final code:
Downgrade round trip, real profile: origin/main → branch → origin/main → branch on one profile. Match Terminal was in the Dark slot and a plugin theme id in the Light slot.
match-terminal, Light plugin kept, mirror'match-terminal'.--worktree-sidebar: #2e3440). Dark is saved asnull.match-terminal, and the plugin slot was untouched.All
useDocumentDarkThemeconsumers under an opposite-mode terminal (Dark mode with Solarized Light in the Dark slot), each renderedlightand readable:By code: the emoji pickers follow the same hook. Mobile and terminal-pane titles read the terminal palette for the requested mode, which this PR doesn't change.
Dashboard pop-out:
openPopout()had reported "closed" because my harness evaluated in the Space window, an untrusted renderer. From the main window it opens and follows the painted mode.Mixed-version web client and remote server: I ran this branch's web client (
pnpm dev:web) againstorca serve1.4.232 on the Linux hostomarchy, over an SSH tunnel, with an isolated profile. Results:{ leftSidebarAppearanceMode: 'match-terminal' }converted, and the page painted Solarized Light (#fdf6e3).announcePluginUpdateReviewsreading.lengthof undefined from the older server.Native chat: opened a transcript-backed Claude session with the repo's e2e approach (seeded provider session + chat view toggle). It follows the app theme. With "Match terminal interface" on, it keeps the terminal font and uses the contrast-checked
--muted-foreground(#5f6868).Re-review on the delta (Opus + Codex) found one real bug, now fixed with a regression test: a full-settings write that clears both slots kept the mirror and was treated as a legacy write, which refilled the slots. A legacy write now only counts when the write carries the sidebar value without the slots.
Screens (Dark mode, Solarized Light in the Dark slot):
Remaining risk:
--worktree-sidebar-active,--host-badge,--tab-*) aren't painted by this theme. They derive inmain.cssfrom the painted--card/--accent/--foreground/--muted-foreground, so they follow the terminal palette. feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578'sinitialresets for those tokens now live only on the Tinted sidebar path, and the per-element Match Terminal path that also reset them is deleted. Native chat keeps the--chat-user-message: initialreset in its own terminal remap. The contrast gate's new light/dark parameter is passed through.resolveTerminalPalette, and fix(terminal): scope terminal color overrides to their light/dark theme slot #36581's edits to the deleted Match Terminal sidebar path dropped out in the rebase.'match-terminal'. This version's own sidebar control writes the same shape, so the two can't be told apart. In practice no older client writes into this store: desktop main and renderer ship together, the web client keeps appearance in its own localStorage, and an older desktop build on a downgrade saves the slots asnull, so choosing Default there does stick.useDocumentDarkThemenow returns the painted mode for 16 consumers, but it only differs from before when Match Terminal follows a terminal theme of the other mode. Built-in and plugin theme users see no change apart from the two pickers now always showing.leftSidebarAppearanceMode: 'match-terminal'fills the empty slots and stays mirrored for older builds. Covered by unit tests (including the round trip, where choosing Built-in for both modes doesn't refill) and exercised in the app by restarting an origin/main profile on this branch.'match-terminal'slot value tonull, but they still read the mirroredleftSidebarAppearanceMode: 'match-terminal', so they keep their sidebar match. Newer builds translate legacy writes.useShallowover the terminal fields; memoized by settings identity for the dark-mode hook). It costs nothing when the feature is off and adds no new CSS effects.Perf
Scope: I ran the perf-scan over this PR's diff against #36578 (
ddda6cd7646). It covered the paths that run per store update or per settings write:useDocumentDarkTheme/resolvePaintedDark: 16 consumers.useTerminalAppThemeand the:rootpaint effect.Main-process, host and streaming paths are not touched.
Finding (fixed in
f286007e3a4):terminalCustomThemes/disabledPluginsarrays, souseShallowsaw new inputs and re-synthesized the theme. The fresh theme object then re-ranapplyPluginAppTheme, the:rootstyle recalc and the Monaco theme derivation.synthesizeTerminalAppThemereturns the previous theme object when the serialized content (base, tokens, syntax colors) is unchanged. It compares the exact string, not a hash, so a hash collision can't serve a stale palette.Measurements: Hidden dev build, same profile and workload: a workspace with a TypeScript file open in Monaco, Dark mode. CDP
Performance.getMetricsdeltas; latency is from the settings write to the second animation frame. Write latency is dominated by the settings IPC round trip, about 35 ms even when nothing repaints.resolvePaintedDarkwith the feature off: about 0.01 µs. With Match Terminal and cached settings: about 0.02 µs.resolvePaintedDarkreturns before touching the terminal palette.useTerminalAppThemeselectsnull.Negative user-facing tradeoffs
Changing the terminal theme under Match Terminal costs a whole-window style recalc, about 35 ms against 14 ms for the old sidebar-only repaint (see Perf).
Match Terminal now recolors the whole window and the editor, not just the left sidebar. Users who wanted only a terminal-colored sidebar have no direct equivalent; Tinted with the terminal color is the closest.
Primary buttons and focus rings turn ANSI blue when the palette's blue is readable. Otherwise they stay neutral.
On low-contrast palettes (Solarized), app text is slightly darker or lighter than the terminal's own foreground so it meets WCAG AA.
With a light terminal theme in the Dark slot (or the reverse), the app paints in light mode (or dark), following the terminal.
Terminal background opacity: on origin/main, at opacity 0.6 with Nord, the old Match Terminal sidebar composites to a darker
#20232a, and the terminal pane renders lighter at#363c49, so they already didn't match. On this branch the chrome is the opaque theme color#2e3440and the terminal pane renders#393f4e–#3e4554. Translucency still shows a small step between the terminal and the chrome, as it did before. The darker translucent tint of the old sidebar is gone, because app surfaces must be opaque for the contrast gate. The lighter terminal composite exists on main too; it comes from how the xterm layers stack (see [Bug]: Background Opacity and Window Blur have no visible effect on Linux #36196, WS-window's area). Screenshots are below.If a slot already held a plugin theme, the migration keeps the plugin theme in that mode; the old terminal-colored sidebar doesn't come back there.
Downgrading to an older Orca shows the old left-sidebar-only Match Terminal (the mirrored value), not the whole-window theme. An older build saves the slots as
null; upgrading again refills them from the mirrored value.Pop-out and Space windows now use the painted light/dark mode but not the synthesized colors; they never applied app theme colors. The native window background and
nativeThemestill follow the Appearance setting, so a mode flip can show one pre-paint frame of the other mode.The Light/Dark theme pickers are always visible now, which adds two rows to Appearance.
The Match Terminal option and its trigger are wider because of the
(⚡ dynamic)label. The parentheses are not part of the translated word, so CJK locales show ASCII parentheses.On mid-tone terminal backgrounds, surfaces such as popovers and hover rows can tint darker than the background instead of lighter (or the reverse on light themes), so the text stays readable.
Round-trip edge cases (accepted):
null, so this version can't tell the user's Built-in apart.'tinted', so after a downgrade and upgrade Match Terminal isn't restored.Pop-out and Space windows follow the painted light/dark mode but show built-in colors, not the terminal palette; plugin app themes behave the same there.
Validation
Phase 3 (rebased onto feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578
cc96228de8b, now merged to main asdaa11df4062fix(theme): built-in color pairs meet WCAG AA and dark-mode surfaces stay themed #365614d713f16a24← mainee44140fb9b):pnpm tc✅,oxlint✅,oxfmt✅,pnpm sync:localization-catalog✅.pnpm teston onboarding, settings,lib, app-shell, native-chat,main/persistence, web,src/shared: 31,457 passed. 4 failed, all in untouched WSL suites (wsl-host-deployment-store,wsl-move-guest-process-table-cost). They fail on their own in this nested worktree and have no diff in this PR.After rebasing onto feat(themes): public tokens for diffs, git status, tabs, dividers, rows, links #36578:
pnpm tc✅; focused tests (shared plugin settings/artifacts, web preload, native chat, settings, app-shell,lib,main/persistence, sidebar) 19,164 passed. In the app, the tab bar (active/inactive), selected workspace row and host badge follow the terminal palette in Nord and Solarized Light:pnpm tc✅,oxlinton changed files ✅,oxfmt✅,pnpm sync:localization-catalog. The Match Terminal label translations moved to the new key and stale keys were removed.pnpm teston:terminal-app-theme.test.ts(new: Solarized Light survives the contrast gate with nothing dropped; overrides; opaque surfaces; painted-mode flip),plugin-theme-settings.test.ts(slot normalization + legacy migration),use-document-appearance.test.tsx(painted mode),AppearancePane,Sidebar,SettingsSidebar,NativeChatPaneHeader, native-chat appearance, plugin component tests,src/main/persistence/**. All pass except an unrelated WSL timing test that times out under load.ORCA_BACKGROUND_LAUNCH=1, throwaway profile, CDP port 9315).leftSidebarAppearanceMode: 'match-terminal'(Nord, opacity 0.6), then restarted it on this branch. Both slots werematch-terminaland the mirrored sidebar value stayed'match-terminal'. The startup cache entry was written with basedark.lightwith--background: #fdf6e3.lightfor Solarized Light in the dark slot anddarkafter switching to Nord. Like before, it keeps built-in colors.lightfor Solarized Light in the Dark slot). An earlier attempt failed only because the harness was calling from the Space window.light #fdf6e3. With the plugin system switched off, the app fell back to the default dark palette (dark #282c34). A single plugin can't be disabled in a throwaway profile, becausedisabledPluginsonly keeps installed plugins, so I used the global switch, which goes through the same check. Native chat can't be opened without launching an agent, so its matching behavior is covered by the new unit test (native-chat-appearance-style.test.ts: the plugin palette giveslight, switched off givesdark).