Skip to content

feat(console): manual appearance toggle (System / Light / Dark) - #76

Merged
brettchien merged 1 commit into
mainfrom
feat/theme-toggle
Aug 18, 2026
Merged

feat(console): manual appearance toggle (System / Light / Dark)#76
brettchien merged 1 commit into
mainfrom
feat/theme-toggle

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

What

Studio already rendered light + dark via prefers-color-scheme (auto-follows the OS), but the operator had no way to override it. Adds a toolbar toggle that cycles System → Light → Dark, persisted.

How

  • styles.css — the dark palette now applies on :root[data-theme="dark"] (forced) as well as @media (prefers-color-scheme: dark) :root:not([data-theme]) (OS default when no explicit choice). data-theme="light" keeps the :root defaults, so forced-light wins over a dark OS. (Two dark blocks kept in sync — commented.)
  • theme.tsdata-theme on <html> is the source of truth; the choice persists in localStorage (oab-studio.theme). Pure cycleTheme (unit-tested); initThemeToggle owns the button label + persist + apply.
  • index.html — a no-FOUC head script applies the saved choice before first paint; the toggle button sits in the toolbar next to Check for updates.
  • main.ts — inits the toggle at startup.

"System" removes data-theme so the OS media query decides again.

Verification

console: tsc --noEmit clean · 89 vitest (theme +2 — the pure cycle) · vite build OK. Visual pass (three states + reload persistence) wants eyes on the running app.

🤖 Generated with Claude Code

Studio already rendered light + dark via `prefers-color-scheme` (auto-follows
the OS) but gave the operator no way to override it. Add a toolbar toggle.

- styles.css: the dark palette now applies on `:root[data-theme="dark"]`
  (forced) as well as `@media (prefers-color-scheme: dark) :root:not([data-theme])`
  (OS default when no explicit choice). `data-theme="light"` keeps the `:root`
  defaults, so a forced-light choice wins over a dark OS.
- theme.ts: `data-theme` is the source of truth; the choice persists in
  localStorage (`oab-studio.theme`). Pure `cycleTheme` (System → Light → Dark)
  is unit-tested; `initThemeToggle` wires the button (label + persist + apply).
- index.html: a no-FOUC head script applies the saved choice before first
  paint, plus the toolbar button next to "Check for updates".
- main.ts: init the toggle at startup.

Verification: `tsc --noEmit` clean · 89 vitest (theme +2) · `vite build` OK.
@brettchien
brettchien merged commit dc44549 into main Aug 18, 2026
2 checks passed
@brettchien
brettchien deleted the feat/theme-toggle branch August 18, 2026 14:10
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