feat: Add theme settings

This commit is contained in:
JY Hsu 2024-09-01 12:58:34 +08:00
parent dd1ede93d9
commit 17deb772cf
6 changed files with 37 additions and 18 deletions

View file

@ -12,7 +12,7 @@
<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
theme = localStorage.getItem('darkmode:color-scheme') || 'system';
theme = localStorage.getItem('theme-scheme') || localStorage.getItem('darkmode:color-scheme') || 'system';
if (theme == 'system') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';