Skip to content

Add a light theme - #104

Open
mbino wants to merge 2 commits into
doctly:mainfrom
mbino:light-theme
Open

mbino wants to merge 2 commits into
doctly:mainfrom
mbino:light-theme

Conversation

@mbino

@mbino mbino commented Oct 28, 2026

Copy link
Copy Markdown

Summary

Adds an Appearance setting (Dark / Light / System) under Settings → Application. Dark stays the default, so nothing changes for existing users.

How it works

style.css hard-codes its ~350 colors. Rewriting it around CSS variables would touch nearly every line, so the light theme is generated from it instead:

  • scripts/generate-light-theme.js (npm run generate:light-theme) reads style.css and whats-new.css and writes public/theme-light.generated.css. Every rule that sets a color is re-emitted under :root[data-theme="light"], with the color mapped by how it is used: light text becomes dark text, dark surfaces become light surfaces, white veils become dark veils, and accent colors are darkened until they read on white. Background, border and outline declarations are re-emitted per family, so scoping doesn't change the cascade between shorthands and longhands.
  • style.css itself is untouched. After changing it, re-run the generator.
  • public/theme-light.css is the place for hand-tuned fixes (empty for now).

Other pieces:

  • public/app-theme.js loads in <head> and sets data-theme before first paint, so there's no dark flash at startup. The global settings remain the source of truth; localStorage only caches the choice. System follows prefers-color-scheme live.
  • The default Switchboard terminal theme now follows the appearance. Solarized Light and GitHub Light terminal themes are added.
  • CodeMirror editors and viewers switch between Dracula and GitHub Light live, through a shared compartment.
  • Project marks and track tags use darker hues in the light theme.

Testing

Checked in a dev instance (SWITCHBOARD_DATA_DIR): the session list, transcript viewer, settings, project overview, What's New dialog, editor and terminal colors. I also switched between themes at runtime, including saving through the settings form.

Not yet checked by eye: stats, grid view, Git tab, plans and schedules. They get the same generated mapping, but they may need a fix or two in theme-light.css.

mbino added 2 commits October 28, 2026 17:53
Adds an Appearance setting (Dark / Light / System) under Settings >
Application. Dark stays the default.

style.css hard-codes its colors, so instead of rewriting it around
variables, scripts/generate-light-theme.js derives
public/theme-light.generated.css from it: every rule that sets a color is
re-emitted under :root[data-theme="light"] with the color mapped by how
it is used (text, background, border, shadow). style.css itself is
untouched. Re-run `npm run generate:light-theme` after changing it;
hand-tuned fixes go in public/theme-light.css.

- app-theme.js applies the theme before first paint (cached in
  localStorage, settings remain the source of truth) and follows the OS
  for System.
- The default Switchboard terminal theme follows the appearance; adds
  Solarized Light and GitHub Light terminal themes.
- CodeMirror editors switch between Dracula and GitHub Light live.
- Project marks and track tags use darker hues in the light theme.
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