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');
}