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:
parent
4330c8b12a
commit
0540f3cfde
1 changed files with 1 additions and 1 deletions
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue