Skip to content

Customizable app theme (built-in palettes + CLI custom stylesheet)#282

Merged
SawyerHood merged 1 commit into
mainfrom
bb/customizable-app-theme-thr_wipij6tc9z
Jun 20, 2026
Merged

Customizable app theme (built-in palettes + CLI custom stylesheet)#282
SawyerHood merged 1 commit into
mainfrom
bb/customizable-app-theme-thr_wipij6tc9z

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Summary

Makes the app's color palette customizable — server-stored and applied live to every open window, orthogonal to the per-client light/dark mode.

  • Backend: single-row app_theme table + appThemeSchema; surfaced on GET /system/config and a new PUT /settings/appearance; broadcast via config-changed (migration 0042).
  • CLI: bb theme list | set <id> | set-custom --file <css> | show [--css] | reset (new @bb/sdk theme area).
  • Frontend: built-in palettes (nord, dracula, solarized, gruvbox) as a CSS-string registry; useAppTheme injects a trailing <style> (wins the cascade); pre-paint cache avoids a flash; Settings → Appearance palette picker.

Make existing chrome follow the tokens

  • --surface-scrim derives from --canvas, so the frosted header bar tracks the palette (was hardcoded white).
  • PullRequestStatusPill: GitHub status hexes → text-success/-destructive/-pr-merged/-muted-foreground.
  • Mermaid diagrams resolve their palette from live CSS vars (probe + canvas rasterize to sRGB) and re-render on palette change via a new useAppThemeEpoch; the terminal re-themes on the same signal.
  • Built-in themes set --ansi-bg-fg-* contrast colors.

Docs

  • bb-cli skill gains references/theming.md (token model, what each variable drives, colors, fonts), pointed to from SKILL.md.

Tests

  • New apps/server/test/system/appearance.test.ts (default, set built-in, set custom, reject unknown id, reject custom-without-css).
  • migrate.test.ts rewind helper updated to drop app_theme.
  • Local: typecheck 7/7 touched packages; server (17), db migrate (22), app theme (16) tests pass.
  • Verified live in the dev app: all 5 built-ins in light + dark (headers coordinate, text contrast AA+); Mermaid re-renders live on theme switch.

Risks / notes

  • Custom CSS is injected raw (capped 256 KB), no sanitizer — acceptable for a local single-user tool.
  • Solarized dark is intentionally low-contrast (still AA).

🤖 Generated with Claude Code

Make the app color palette customizable: server-stored and applied live to all
open windows, orthogonal to the per-client light/dark mode.

Feature:
- Domain/DB/contract/server: single-row app_theme table + appThemeSchema,
  exposed on GET /system/config and a new PUT /settings/appearance, broadcast
  via config-changed (migration 0042).
- SDK + CLI: `bb theme list|set|set-custom --file|show|reset`.
- Frontend: built-in palettes (nord, dracula, solarized, gruvbox) as a CSS
  registry; useAppTheme injects a trailing <style>; pre-paint cache avoids a
  flash; Settings -> Appearance palette picker.

Make existing chrome follow the tokens so themes render correctly:
- theme.css: --surface-scrim derives from --canvas, so the frosted header bar
  tracks the palette instead of staying white.
- PullRequestStatusPill: GitHub status hexes -> text-success / -destructive /
  -pr-merged / -muted-foreground tokens.
- Mermaid: resolve the diagram palette from live CSS vars (probe + canvas
  rasterize to sRGB) and re-render on palette change via useAppThemeEpoch; the
  xterm terminal re-themes on the same signal.
- Built-in themes set --ansi-bg-fg-* contrast colors.

Docs: bb-cli skill gains references/theming.md (token model, what each variable
drives, colors, fonts) with a pointer from SKILL.md.

Tests: appearance route tests; migrate rewind helper also drops app_theme.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SawyerHood SawyerHood force-pushed the bb/customizable-app-theme-thr_wipij6tc9z branch from 2eb21d7 to f8367d4 Compare June 20, 2026 02:58
@SawyerHood SawyerHood merged commit d8bc662 into main Jun 20, 2026
6 checks passed
@SawyerHood SawyerHood deleted the bb/customizable-app-theme-thr_wipij6tc9z branch June 20, 2026 03:05
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