feat(console): manual appearance toggle (System / Light / Dark) - #76
Merged
Conversation
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.
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.
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:rootdefaults, so forced-light wins over a dark OS. (Two dark blocks kept in sync — commented.)theme.ts—data-themeon<html>is the source of truth; the choice persists inlocalStorage(oab-studio.theme). PurecycleTheme(unit-tested);initThemeToggleowns 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-themeso the OS media query decides again.Verification
console:tsc --noEmitclean · 89 vitest (theme +2 — the pure cycle) ·vite buildOK. Visual pass (three states + reload persistence) wants eyes on the running app.🤖 Generated with Claude Code