diff options
Diffstat (limited to 'src/themes/serene/templates/_base.html')
| -rw-r--r-- | src/themes/serene/templates/_base.html | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/themes/serene/templates/_base.html b/src/themes/serene/templates/_base.html index 0bd7b3b..d1f2d48 100644 --- a/src/themes/serene/templates/_base.html +++ b/src/themes/serene/templates/_base.html @@ -1,3 +1,4 @@ +{% set color_scheme = config.extra.color_scheme if config.extra.color_scheme is defined else "auto" %} <!DOCTYPE html> <html lang="{% block lang %}{% endblock lang %}"> @@ -18,15 +19,15 @@ {% include "_head_extend.html" %} </head> -<body class="{% block page %}{% endblock page%}{% if config.extra.force_theme == "dark" %} dark{% endif %}"> - {% if not config.extra.force_theme %} +<body class="{% block page %}{% endblock page%}{% if color_scheme == "dark" %} dark{% endif %}"> + {% if color_scheme == "auto" %} <script> const theme = sessionStorage.getItem('theme'); - const match = window.matchMedia("(prefers-color-scheme: dark)").matches + const match = window.matchMedia("(prefers-color-scheme: dark)").matches; if ((theme && theme == 'dark') || (!theme && match)) { document.body.classList.add('dark'); const hl = document.querySelector('link#hl'); - if (hl) hl.href = '{{ get_url(path="hl-dark.css") }}'; + if (hl) hl.href = '{{ get_url(path="giallo-dark.css") }}'; } </script> {% endif %} |
