1
0
Fork 0

Add support for prefers-color-scheme: dark.

Light is ignored, since it can mean 'unset'.

https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
This commit is contained in:
jtagcat 2020-08-12 17:49:35 +03:00
parent 4330c8b12a
commit 0540f3cfde

View file

@ -45,7 +45,7 @@
let sunset; let sunset;
function setBodyClass() { function setBodyClass() {
if (now > sunrise && now < sunset) return; if (window.matchMedia("(prefers-color-scheme: dark)").matches || now > sunrise && now < sunset) return;
document.body.classList.add('dark'); document.body.classList.add('dark');
} }