See the title
Add light mode
Today the app has no way to pick a theme: app/globals.css is light by default and flips to the black dark palette purely via @media (prefers-color-scheme: dark), so anyone on a dark OS is stuck in dark mode. I read "Add light mode" as: let the user choose.
Plan:
- Theme switcher — a small
System / Light / Darkcontrol (components/theme-toggle.tsx, reusing the existing.segsegmented-control styles) rendered in the header next to the user menu, so it's reachable in all three header layouts (sidebar / top bar / ☰ phone). - Persistence without flash — choice saved in
localStorage("theme"); a tiny inline script in<head>(app/layout.tsx) setsdata-themeon<html>before first paint, so there's no light→dark flicker. "System" removes the attribute and falls back to the media query. - CSS — move the dark token block into a shared selector so both
html[data-theme="dark"]and@media (prefers-color-scheme: dark) html:not([data-theme="light"])apply it, pluscolor-scheme: light|darkso native form controls match. - Screenshot the header in forced light and dark, push, open a PR.
threadide@01b7b41Done — PR #52 adds a theme switcher. Before, the palette was chosen only by prefers-color-scheme, so a dark OS meant dark app, full stop.
What changed
components/theme-toggle.tsx(new): a compact System / Light / Dark control with inline-SVG icons (no font glyphs — see the ☰ gotcha). It's the last item inside the header nav, so it appears in all three header layouts: under the links in the desktop sidebar, inline in the 561–900px top bar, and at the bottom of the phone ☰ panel. The choice is kept inlocalStorage("theme")and applied ashtml[data-theme="light"|"dark"]; System removes the attribute and the OS media query takes over. Follows changes made in another tab via thestorageevent.app/layout.tsx: a tiny inline<head>script applies the saved choice before first paint, so there's no flash of the OS palette on load;<html suppressHydrationWarning>because of that attribute.app/globals.css: dark tokens now apply viahtml[data-theme="dark"]plus, as the OS fallback,@media (prefers-color-scheme: dark) html:not([data-theme="light"]). The two token blocks must stay identical (plain duplication; Next's default PostCSS doesn't flatten nested@media).color-scheme: light|darkis set alongside so native selects/scrollbars match. Which segment looks selected is pure CSS keyed onhtml[data-theme], so the server-rendered markup needs no knowledge of the user's choice and nothing flickers during hydration.
Verified with static mockups of the real stylesheet under emulated OS colour schemes (screenshot attached): forced Light on a dark OS, forced Dark on a light OS, and System on a phone. tsc --noEmit is clean. The app itself can't run in the sandbox (Postgres + OAuth), so please give the toggle a quick click on the preview deploy — the preference is per browser, not per account (no DB change).
