Repository navigation
feat(themes): background images for app themes - #36589
Merged
Merged
Conversation
nwparker
force-pushed
the
nwparker/theme-window-material
branch
from
October 31, 2026 04:52
29c953c to
4edcb65
Compare
nwparker
force-pushed
the
nwparker/theme-window-background-image
branch
from
October 31, 2026 04:53
66aa369 to
1cfc503
Compare
nwparker
force-pushed
the
nwparker/theme-window-material
branch
from
October 31, 2026 05:04
4edcb65 to
040af97
Compare
nwparker
force-pushed
the
nwparker/theme-window-background-image
branch
2 times, most recently
from
October 31, 2026 05:17
f7f115b to
9a730d4
Compare
Contributor
Author
Phase 2: background image on a real Linux desktopOn openclaw (Ubuntu, GNOME/Mutter X11, visible window), I built a fresh clone of this branch and loaded a dev theme plugin with
(screenshot removed: contained real product data) |
nwparker
force-pushed
the
nwparker/theme-window-background-image
branch
from
October 31, 2026 23:52
9a730d4 to
9fdf1db
Compare
Contributor
nwparker
force-pushed
the
nwparker/theme-window-background-image
branch
from
November 1, 2026 00:24
9fdf1db to
1df4268
Compare
An app theme may declare one validated raster image (png/jpeg/webp, <=2 MB, >=640x360, inside the plugin) served through orca-plugin-image, painted as one static body layer under translucent terminals. Older Orca ignores the field; a bad image drops only the image.
nwparker
force-pushed
the
nwparker/theme-window-background-image
branch
from
November 1, 2026 02:23
1df4268 to
80dd005
Compare
This was referenced Nov 1, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ported from #36580
These are keyed only on
data-theme-background; #36580 re-adds the window material when it rebases.terminal-appearance.ts: paint-once xterm layering ([Bug]: Background Opacity and Window Blur have no visible effect on Linux #36196). The deadpaneBackgroundoption is dropped frompane-manager-types.ts.config/patches/@[email protected]andxterm-src/…src.patch, plus thepnpm-lock.yamlhash: the transparent WebGL frame clear andblendFuncSeparate([Bug]: Terminal background flickers on every redraw when background transparency is enabled #6491).main.css: opaque base for non-terminal tab bodies, split gutters and the sidebar seam.TabGroupPanel.tsx:data-translucent-tab-bodyand the unfocused-split dim skip.TabGroupSplitLayout.tsx: theworkspace-sidebar-seamclass.hooks/use-media-query.tsand theusePrefersReducedMotionrefactor onto it.Left in #36580: the window material itself, the Reduce Visual Effects setting and hook, and the modal-blur and floating-surface changes.
Summary
App theme files can now declare one background image:
{ "base": "dark", "tokens": { "--background": "#14161c", "--foreground": "#e8e6f0" }, "background": { "path": "images/dusk.webp", "opacity": 0.6, "size": "cover", "position": "center" } }Root cause: plugin themes could only set color tokens. The value check refuses
url(), and nothing in the paint path could place an image under translucent surfaces. This PR adds both halves. The first is a validated and safely served image. The second, taken from #36580, is that terminals paint their translucent background exactly once over whatever is behind them.Design
plugin-theme-background.ts):pathmust be inside the plugin (pluginRelativePathSchema).opacityis 0–1, default 1.sizeiscover,containortile.positioniscenter,top,bottom,leftorright.validate:pluginis strict and refuses unknown keys.backgroundis dropped and the theme still applies. Older Orca already strips the unknown key, so the theme loads without the image.theme-backgroundkind inPLUGIN_IMAGE_RULES: PNG/JPEG/WebP only (no SVG), static, at least 640×360, at most 2 MB.orca-plugin-image://installed/<key>/<contentHash|dev>/theme-<index>URL.theme-<index>back to the theme file and checks the bytes on every serve. It goes through the same contained read and header and rule check, now shared asreadCheckedPluginImage; the protocol's own inline copy was removed. A bad image simply 404s and the theme still applies.validate:pluginreports a missing image file.no-storeso authors see image edits. Legacy 32-character install hashes are accepted, and a malformed registration background drops only the image.lib/theme-background.tssets four custom properties plusdata-theme-background.main.csspaints the image as the body's background, with a--backgroundveil sized byopacity. No extra element, nobackdrop-filter, no animation.data-theme-background.useThemeBackgroundStoreflag re-runs the terminal appearance when the image arrives (plugin themes load after first paint).Closes #7714
Refs #19301 (background imagery; app-wide transparency is not in scope)
Builds on #8870 by @chldbwnstm, #15836 by @cunicopia-dev, #17596 by @chris-albert, #27485 by @mark22013333 and #15525 by @Sylen00 (and the #15524 discussion). Unlike those, the image comes from a theme plugin with validated bytes rather than an arbitrary user file path, and it is one static layer rather than a per-pane or blurred texture.
Visual proof
The dev theme plugin
Dusk(image opacity 0.6 dark / 0.45 light). Background Opacity is 0.75, the window material is off (opaque window), and the split shows a terminal next to a markdown editor. The image shows only under the terminal; the editor, sidebars and chrome stay opaque. Before this PR the same theme file renders with no image (the field is ignored).Dark

Light

Layers painting the terminal background, from DOM inspection: the split root at
rgba(40,44,52,0.75). The xterm layers arergba(…, 0), and the body is--backgroundplus the image.Review
One Opus review and Codex (
gpt-6.1-sol, xhigh). Fixed:validate:pluginnow checks that the image file exists.no-store.theme-007slot aliases are refused.lib/window-backdrop.ts, and a type alias was dropped.Not changed:
indexOf(contribution)relies on the registry passing the manifest's own contribution objects (it does); image bytes are not checked byvalidate:plugin(its reader is text-only).Merge-risk assessment
Low (was Low–medium). Phase 2 rendered it on a real Linux desktop (GNOME/Mutter X11, comment): the image appears under translucent terminals only, the chrome stays opaque, and the protocol serves the
theme-<index>slot. Combined with the earlier macOS CDP run and the unit tests for strict/tolerant parsing and the protocol, the remaining risk was in the restack itself, and it has been re-verified (see Restack).orca-plugin-image, so it simply shows no image.immutableper content hash; dev plugins usedev, as other plugin images already do.data-theme-backgroundand the backdrop rules (which feat(window): working background opacity and blur on macOS, Windows and Linux #36580 will extend todata-window-material).plugin-theme-artifact.ts: one optional field each in the strict, tolerant and registration schemas, plus the parse output.main.css: one rule, and the backdrop selectors now also matchdata-theme-background.Negative user-facing tradeoffs
validate:plugin(missing file) or by noticing the image doesn't appear.Validation
pnpm tcpasses.oxlintandoxfmtpass on the changed files.pnpm generate:plugin-schemaswas run; the hand-writtendocs/reference/plugin-themes.mdhas a new "Background image" section.pnpm testcovers:plugin-theme-artifact.test.ts, extended: strict acceptance and rejection, and runtime drop without failing the theme;plugin-image-protocol.test.ts, extended: thetheme-<index>slot is served and an undersized image or missing slot returns 404;src/main/plugins/contributions/,src/shared/plugins/images/andcomponents/tab-group/;document-theme.test.ts,use-document-appearance.test.tsxandterminal-appearance.test.ts.ORCA_BACKGROUND_LAUNCH=1, CDP port 9317, throwaway profile, folder workspace). A local dev theme plugin was consented throughwindow.api.plugins, and its dark and light slots were selected:orca-plugin-image://installed/wswindow.dusk/dev/theme-0.data-theme-backgroundand the alpha-0 xterm background live.url(…).Restack (onto main, without #36580)
#36580 depended on nothing from this PR, but this PR used five small pieces of #36580. They now live here, cut down to the theme image:
terminal-appearance.ts: with a backdrop, xterm gets the theme at opacity 0 and the split root is the only translucent paint ([Bug]: Background Opacity and Window Blur have no visible effect on Linux #36196). The deadpaneBackgroundstyle option is dropped.main.css: non-terminal tab bodies, split gutters and the sidebar seam keep--backgroundunder:root[data-theme-background].TabGroupPanel.tsx:data-translucent-tab-bodyon terminal bodies, and unfocused split groups skip their dim over the image.TabGroupSplitLayout.tsx: theworkspace-sidebar-seamclass.config/patches/@xterm__addon-webgl…and the.src.patch, plus the lockfile hash): taken verbatim from feat(window): working background opacity and blur on macOS, Windows and Linux #36580. WithallowTransparency, each frame clears the transparent framebuffer, and alpha blends withblendFuncSeparate. Without it, a zero-alpha theme background never clears stale glyph and cursor pixels, and translucent alpha is squared. This also fixes the accumulation flicker ([Bug]: Terminal background flickers on every redraw when background transparency is enabled #6491) for anyone already using Background Opacity below 1 without an image.use-media-query.ts, identical to feat(window): working background opacity and blur on macOS, Windows and Linux #36580's.usePrefersReducedMotionuses it, as in feat(window): working background opacity and blur on macOS, Windows and Linux #36580. The image gate reads(prefers-reduced-transparency: reduce)directly; the Reduce Visual Effects setting and hook come with feat(window): working background opacity and blur on macOS, Windows and Linux #36580.lib/window-backdrop.tsstays as the single place that answers "does something paint under terminals"; today the answer is the theme image only. When #36580 rebases, it addsactiveWindowMaterial() !== 'off'there and[data-window-material]to the three CSS selectors. Its expected conflicts aremain.css,TabGroupPanel.tsx,terminal-appearance.tsanduse-document-appearance.ts. The patches and hooks are identical, so they apply cleanly. All conflicts are mechanical.Re-verified on the restacked head in the real app: e2e build,
ORCA_BACKGROUND_LAUNCH=1, hidden.rgba(40, 44, 52, 0.7)and the xterm viewport isrgba(0, 0, 0, 0)(one paint); chrome stays opaque.data-theme-backgroundand no--orca-theme-background-*property.Perf
Measured in the hidden app with CDP
Performance.getMetricsand adevtools.timelinetrace, alternating image and no-image runs on the same build (e2e build, macOS, hidden window)::root[data-theme-background].seq 1 40000, 6 s window): main-thread TaskDuration was 0.15 s / 0.06 s with the image and 0.05 s / 0.05 s without. DOM paint was 1.4–1.7 ms with the image and 0.3 ms without. Both are negligible; xterm draws on its own canvas.immutableper content hash; dev plugins useno-store.backdrop-filter, no animation: the image is one static body layer.Review of the restack (Opus + Codex
gpt-6.1-sol, xhigh)Fixed:
size: "stretch"or a non-plugin URL could reachapplyThemeBackgroundand CSS.use-document-appearance.tsnow re-parses throughtolerantPluginThemeBackgroundRegistration, so anything this build can't paint becomes "no image".data-reduce-effectshook was dropped, and the duplicated media-query logic was folded intouseMediaQuery.Known, not changed:
devURL stays the same. This affects authoring only.Re-measured on the final head: zero cost with no image (no attribute, no properties). With the image, terminal streaming main-thread time was 0.11 s / 0.04 s; without it, 0.06 s / 0.04 s.