3 ms·
Ah, you have a button for the toggle! Did you know that you can conform to the user's light/dark preference with CSS? Like this: :root { --varname: #FFE; }
by tasuki 7mo ago
Ah, you have a button for the toggle! Did you know that you can conform to the user's light/dark preference with CSS? Like this:
:root { --varname: #FFE; }
@media (prefers-color-scheme: dark) {
:root { --varname: #022; }
}
Edit: To expand on this, I dislike light/dark toggles. If I have dark mode on, seeing a bright screen and having to search for a toggle is jarring. Just show me the colours according to my preference!
- auraham 7mo agoHow can you detect the system preferences in the browser?
- tasuki 7mo agoI answered that in the comment you're replying to. If you want a more authoritative answer: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/A...