Showcase: I built a dark-mode toggle for my community

Used the theme's CSS variables and prefers-color-scheme to add a manual toggle that remembers the choice in localStorage. Took about 30 lines, no framework. Happy to share the snippet if anyone wants it.

2 replies

  • 0

    Clean. Does it fall back to the OS setting on first visit before they toggle?

    • 1

      Yep — no stored choice means it follows prefers-color-scheme, then the toggle overrides.