feat: dark mode switch

This commit is contained in:
2024-11-23 19:33:23 +01:00
parent 3c9f28c5fd
commit b3c786847b
6 changed files with 46 additions and 26 deletions
+2 -14
View File
@@ -10,20 +10,6 @@
<script src="https://unpkg.com/htmx.org@2.0.3"></script>
<script>
function switchTheme() {
const theme = localStorage.getItem('theme')
if (theme === 'dark') {
document.documentElement.classList.remove('dark')
localStorage.setItem('theme', 'light')
} else {
document.documentElement.classList.add('dark')
localStorage.setItem('theme', 'dark')
}
}
</script>
{% tailwind_css %}
{% block extra_js %}
{% endblock %}
@@ -35,4 +21,6 @@
{% endblock %}
</main>
</body>
<script src="{% static 'theme/js/theme.js' %}"></script>
</html>