Skip to content

feat(theme): add light/dark mode toggle#253

Open
Hale730 wants to merge 1 commit into
cloudflare:mainfrom
Hale730:hporter/light-dark-mode
Open

feat(theme): add light/dark mode toggle#253
Hale730 wants to merge 1 commit into
cloudflare:mainfrom
Hale730:hporter/light-dark-mode

Conversation

@Hale730

@Hale730 Hale730 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Adds a light/dark mode toggle button to the nav.

Changes:

  • New ThemeToggle component (sun/moon icon, top-right of nav)
  • User choice persists in localStorage; first-time visitors get their OS preference as the starting point
  • Inline script in <head> sets data-theme on <html> before paint, so no flash of wrong theme
  • Color CSS refactored to react to [data-theme="dark"] selector. The @media (prefers-color-scheme: dark) blocks are kept as a fallback for users with JS disabled.
  • Nav logo and footer logo swap based on theme (previously tied to OS)
  • Home header keeps the white-text logo in both modes (blue background)

Decorative image swaps (connectors, background patterns) still follow OS preference — happy to extend if reviewers want that.

- New ThemeToggle component (sun/moon icon) in the nav and footer area
- User choice persists in localStorage; falls back to OS preference on first visit
- Inline script in <head> sets data-theme on <html> before paint (no FOUC)
- Refactor color CSS to react to [data-theme="dark"] selector; @media
  (prefers-color-scheme) blocks kept as JS-disabled fallback
- Swap nav and footer logos based on theme (was using <picture> tied to OS)
- Home header continues to force the white-text logo (blue background)
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