Menu

#437 dash: a manual light/dark toggle

open
nobody
2026-08-20
2026-08-20
Anonymous
No

Originally created by: fu351

The dashboard switches palette only through @media (prefers-color-scheme: light) (src/doberman/dash/app.py:116). Someone whose OS is set one way but who is sharing a screen, or just prefers the other look, has no override.

What to do

  1. Keep the media query for the default, and add :root[data-theme="light"] / :root[data-theme="dark"] blocks carrying the same custom-property values, so an explicit choice wins in both directions.
  2. Add a small toggle button in the Recent decisions header row (not in .topbar-right; see heads-up). On click set document.documentElement.dataset.theme to the other value and store it in localStorage inside a try/catch (the file already guards sessionStorage that way, lines 306-314).
  3. On load, read localStorage and apply data-theme before the first paint (a tiny inline script at the top of <body>).
  4. Test in tests/unit/test_dash_polish.py: the shell contains data-theme and the toggle markup.

Cosmetic, client-side only. Heads-up: [#401] and [#415] are in flight against dash/app.py's top bar; branch from a fresh main and expect a small rebase if they land mid-way.

Related

Tickets: #401
Tickets: #415

Discussion


Log in to post a comment.