diff options
Diffstat (limited to 'templates/header.html')
-rw-r--r-- | templates/header.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/templates/header.html b/templates/header.html index b7260a5..1bf6219 100644 --- a/templates/header.html +++ b/templates/header.html @@ -11,3 +11,15 @@ <link rel="apple-touch-icon" sizes="152x152" href="/static/icons/icon-152x152.png"> <link rel="apple-touch-icon" sizes="167x167" href="/static/icons/icon-167x167.png"> <link href="/static/v0/css/light.min.css" id="theme" rel="stylesheet"> + +<script> + function addStyleSheet(name, id) { + const path = "/static/v0/css/" + name + ".min.css"; + const old = document.getElementById(id); + if (old && (old.href != path)) { + old.href = path; + } + } + const currentTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; + addStyleSheet(currentTheme, 'theme'); +</script> |