Skip to content

Add custom theme support via CSS plugin - #1

Merged
sgjholt merged 2 commits into
mainfrom
claude/clever-brattain
Mar 27, 2026
Merged

Add custom theme support via CSS plugin#1
sgjholt merged 2 commits into
mainfrom
claude/clever-brattain

Conversation

@sgjholt

@sgjholt sgjholt commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a + CSS button to the theme bar that opens a .css file picker (File System Access API)
  • The loaded CSS is injected into a <style> tag and persisted to localStorage (mb-custom-css) — no re-picking needed on reload
  • A Custom button (dashed border) appears once a theme is loaded; clicking it re-activates the theme after switching to a built-in one
  • clearCustomTheme() is available in the console to reset back to dark
  • Missing CSS variables fall back to the dark theme via normal CSS cascade — no validation required
  • + CSS button is hidden alongside other File API controls on non-Chrome browsers

CSS plugin format

[data-theme="custom"] {
  --bg: #1e1e2e;
  --accent: #a6e3a1;
  /* any variables — omitted ones fall back to dark theme */
}

Test plan

  • Click + CSS, load a .css file with [data-theme="custom"] { --accent: hotpink; } — confirm accent changes
  • Reload page — confirm custom theme persists
  • Switch to a built-in theme, click Custom — confirm it re-activates
  • npm test passes (20 unit tests)
  • npm run test:e2e passes (updated theme button count assertion)

🤖 Generated with Claude Code

Users can load any .css file as a custom theme via the new "+ CSS" button
in the theme bar. The CSS is injected into a <style> tag and persisted to
localStorage so the theme survives page reloads without re-picking the file.
The "Custom" button (dashed border) appears once a theme is loaded and can
re-activate it after switching to a built-in theme. clearCustomTheme() resets
to dark. Missing variables fall back to the dark theme via CSS cascade.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sgjholt
sgjholt merged commit 7b26bec into main Mar 27, 2026
2 checks passed
Documents the new + CSS button and plugin format in README, updates the
CONTRIBUTING guide to reference the CSS plugin system, and adds the three
new theme functions to the CLAUDE.md key functions table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant