Skip to content

feat(web): optional wallpaper on theme files (#5661) - #5911

Closed
Williawar wants to merge 2 commits into
pingdotgg:mainfrom
Williawar:theme-wallpaper
Closed

Williawar wants to merge 2 commits into
pingdotgg:mainfrom
Williawar:theme-wallpaper

Conversation

@Williawar

@Williawar Williawar commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Implements #5661 as the minimal slice offered there — a pure theme-JSON feature with no editor UI.

What it does

A theme file may carry an optional wallpaper:

{
  "version": 1,
  "name": "Misty",
  "appearance": "light",
  "colors": { "...": "..." },
  "wallpaper": { "image": "data:image/jpeg;base64,...", "opacity": 0.15 }
}

When the active theme carries one, applyThemePalette sets data-wallpaper plus two CSS variables on the root, and index.css paints the image into the body's chrome as a background-image stack — a scrim of --app-chrome-background on top ghosts it down to the chosen opacity, so there is no extra element and no z-index juggling. The only other CSS is standing down the canvas's duplicate bg-background coats (scoped under html[data-wallpaper], so nothing changes for themes without the field). Theme authors control how much the wallpaper reads through the sidebar and other surfaces with the 8-digit hex roles the palette already supports.

Design choices

  • Follows the sidebarArtwork pattern: an optional ThemeFile field, threaded through parseThemeFile, the tolerant localStorage parse, and serializeThemeFile. No new UI — import/export already round-trips the JSON. The theme editor preserves an imported wallpaper across saves (it rebuilds themes through parseThemeFile literals, which would otherwise drop it).
  • Storage budget (the question from Feature request: wallpaper (background image) support in the new theme system #5661): the image is capped at 192 KB of base64, so any valid wallpapered theme file stays inside the existing MAX_THEME_FILE_BYTES (256 KB) import limit with room for the palette. No limits change.
  • data:image/* URIs only — themes stay one portable file; no network fetches, and the validated charset can't escape the url().
  • Minimal on purpose: no fit/position knobs (cover/center); easy to add later if wanted.

Testing

  • 4 new unit tests: file round-trip, rejection (remote URLs / oversized / bad opacity), and apply/clear of the root hook incl. the tolerant stored parse.
  • vp test run --project unit in apps/web: 220 files, 1998 tests green; tsgo --noEmit and vp lint clean.
  • The mechanism (embedded image + chrome-color scrim + transparent canvas coats) matches what I've been running locally as a CSS override for some weeks.

Happy to adjust scope or drop it if this isn't wanted (#5661 has the original request). Both findings from the Macroscope review round are addressed and confirmed resolved.

🤖 Generated with Claude Code

Note

Add optional wallpaper support to theme files

  • Introduces a ThemeWallpaper type (base64 data URI + opacity) and adds it as an optional field on ThemeDefinition and ThemeFile in themePalette.ts.
  • Adds applyThemeWallpaper to set/clear a data-wallpaper attribute and CSS variables (--theme-wallpaper-image, --theme-wallpaper-opacity) on the document root; applyThemePalette and applyThemeColorPreview now call it.
  • CSS in index.css renders the wallpaper as a fixed, scrimmed background image when data-wallpaper is present, with sidebar-inset backgrounds made transparent to reveal it.
  • ThemeEditorPanel.tsx preserves and propagates wallpapers through merge, edit, and save flows.
  • Wallpapers are validated on import (max 192 KB, canonical base64 data URI, opacity 0–1) and serialized into exported theme files; malformed stored wallpapers are silently dropped.

Macroscope summarized 0377846.


Note

Low Risk
Additive theme JSON and presentation-only DOM/CSS changes; images are embedded data URIs with validation and no network fetch. Main risk is visual regressions when data-wallpaper is active, not security or data integrity.

Overview
Adds an optional wallpaper field to theme JSON (data:image/* base64 + optional opacity), wired through parse/serialize and tolerant localStorage reads with strict import validation (≤192 KB, allowed formats, opacity 0–1).

When a theme has a wallpaper, applyThemePalette and applyThemeColorPreview set data-wallpaper and CSS variables; index.css paints a fixed cover image on the body with a chrome-color scrim and makes the main sidebar inset transparent so the wallpaper shows through.

ThemeEditorPanel keeps imported wallpapers on save/merge (no editor controls) and previews the wallpaper that would be kept after save. New unit tests cover round-trip, rejection cases, and apply/clear behavior.

Reviewed by Cursor Bugbot for commit 0377846. Bugbot is set up for automated code reviews on this repo. Configure here.

Themes may carry an optional wallpaper: a small embedded data: image
ghosted into the window chrome at a chosen opacity. Pure theme-JSON
feature: no editor UI, import/export round-trips it, themes without
the field are untouched, and the image cap (192 KB) keeps any
wallpapered file inside the existing 256 KB import budget.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 346daecc-78d4-4810-a2dc-02d7e7ecefad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 9, 2026
Comment thread apps/web/src/themePalette.ts Resolved
Comment thread apps/web/src/themePalette.ts Resolved
The image pattern now requires canonical padded base64 (full quads,
correct final-group padding) so accepted wallpapers always decode.
applyThemeColorPreview takes the wallpaper the save would keep —
merges the target's, edits the edited theme's, new drafts none —
and clears a lingering one from the previously applied theme.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Williawar
Williawar marked this pull request as ready for review August 9, 2026 23:47
@macroscopeapp

macroscopeapp Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR adds a new feature (optional wallpaper support for themes) introducing new user-facing visual behavior through CSS rendering changes and type definitions. New capabilities from external contributors warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@pranav100000 pranav100000 mentioned this pull request Aug 12, 2026
2 of 4 tasks
@Williawar

Copy link
Copy Markdown
Contributor Author

Closing this from my side. I built it for a wallpapered theme setup I've since retired, so I'm not going to keep carrying the branch. If wallpaper support lands on ThemeFile some other way, great, and anyone is welcome to pick this diff up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant