Revert "Merge pull request #59 from netz39/auto-darkmode"

This reverts commit 0df7b9dd96, reversing
changes made to c01b9d499c.
This commit is contained in:
MG-5 2023-11-01 14:34:55 +01:00
parent 0df7b9dd96
commit 665949d7c1

View file

@ -6,21 +6,12 @@
{% if site.color_theme == 'auto' %}
<script>
const isAutoTheme = true;
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
const storedTheme = localStorage.getItem('theme');
if (storedTheme) {
document.documentElement.setAttribute('data-theme', storedTheme);
} else if (prefersDarkMode) {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
}
document.documentElement.setAttribute('data-theme', sessionStorage.getItem('theme'))
</script>
{% else %}
<script>
const isAutoTheme = false;
document.documentElement.setAttribute('data-theme', "{{ site.color_theme | default: 'light' }}");
document.documentElement.setAttribute('data-theme', "{{ site.color_theme | default: 'light' }}")
</script>
{% endif %}