Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanxiaobei/hugo-paper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtagcat <git-514635f7@jtag.cat>2020-08-12 17:49:35 +0300
committerjtagcat <git-514635f7@jtag.cat>2020-08-12 17:49:35 +0300
commit0540f3cfdef4a21edacdb56078ee1251ebb2322f (patch)
treeffed77debd4b2b9b16a3d5cfd92ab33bc95218a3 /layouts
parent4330c8b12aa48bfdecbcad6ad66145f679a430b3 (diff)
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
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/header.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index dd941ec..fbc0e4a 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -45,7 +45,7 @@
let sunset;
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');
}