Implement proper dark mode

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
hossainemruz 2023-09-30 04:53:27 +06:00
parent 6dc9d1d33d
commit 1913cf1e9d
38 changed files with 1136 additions and 353 deletions

View file

@ -17,6 +17,17 @@
<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
theme = localStorage.getItem('darkmode:color-scheme') || 'system';
if (theme == 'system') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
} else {
theme = 'light';
}
}
document.documentElement.setAttribute('data-theme', theme);
</script>
</head>
<body data-spy="scroll" data-target="#top-navbar" data-offset="100">