Skip to content

Website: a theme button for system, light or dark - #13

Merged
hyorman merged 1 commit into
mainfrom
website-theme-toggle
Dec 2, 2026
Merged

hyorman merged 1 commit into
mainfrom
website-theme-toggle

Conversation

@hyorman

@hyorman hyorman commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

theagenthub.app followed only the OS setting, so there was no way to pick light or dark yourself.

  • A button in the top bar cycles through system, light and dark. Its icon shows the current mode, and its label and tooltip are kept up to date for screen readers.
  • The choice is saved in localStorage. A one-line script in <head> applies it before the page paints, so there's no flash.
  • The CSS now lets the chosen theme override the OS setting: :root[data-theme=dark], plus the OS dark rules for :root:not([data-theme=light]). The browser's theme-color follows the choice.
  • The privacy and 404 pages use the saved choice too.

Checked in a browser:

  • Each click goes to the next mode and saves it.
  • Reloading keeps the choice.
  • With the OS set to dark, choosing light wins.
  • The privacy page uses the saved choice.
  • On a 400px-wide screen the button sits next to Get started.

🤖 Generated with Claude Code

The site followed only the system setting. A button in the nav cycles
system, light and dark and keeps the choice in localStorage; a small head
script applies it before paint, and the privacy and 404 pages honour it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying theagenthub with  Cloudflare Pages  Cloudflare Pages

Latest commit: d2066df
Status: ✅  Deploy successful!
Preview URL: https://bbcb4654.theagenthub.pages.dev
Branch Preview URL: https://website-theme-toggle.theagenthub.pages.dev

View logs

@hyorman
hyorman merged commit 6693f00 into main Dec 2, 2026
3 checks passed
@hyorman
hyorman deleted the website-theme-toggle branch December 2, 2026 23:44
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