Skip to content

Furo should switch to dark theme if @media(prefers-color-scheme: dark) #844

Closed Answered by dgw
jrief asked this question in Potential Issue
Discussion options

You must be logged in to vote

A first time visitor of a Furo site always ends up in the light theme. Furo only queries the media type prefers-color-scheme if the user clicks on the provided button.

No, I don't think that's true. It sets a theme mode data attribute at load, defaulting to "auto":

<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>

Media queries in the CSS take it from there.

I've run into some browser/OS combinations where this kind of thing doesn't work properly, but that isn't Furo's fault.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pradyunsg
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
2 participants