Skip to content

Conversation

nginx-jack
Copy link
Collaborator

Relies on https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark and :root[data-theme="dark"] / :root[data-theme="light"] to handle theme switches without needing to add a "dark" class throughout the code.

The js for this is directly in the <head> so it should trigger as early as possible during bootstrap.
I tried to make this work with zero js, but from what I understand there's no way to "save" your selected theme without it triggering a flash. It is possible if we only rely on system theme... but at least in my use, I often pick light/dark on a site by site basis.

The non-js version will always be light theme.

@nginx-jack nginx-jack requested a review from a team as a code owner August 29, 2025 15:24
Copy link

Deploy Preview will be available once build job completes!

Name Link
😎 Deploy Preview https://frontdoor-test-docs.nginx.com/previews/nginx-hugo-theme/371/

@nginx-jack nginx-jack marked this pull request as draft August 29, 2025 16:03
Base automatically changed from mainframe to main September 2, 2025 16:27
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