forked from phc/website
feat: first draft for dark mode support
This commit is contained in:
+17
-1
@@ -30,6 +30,19 @@
|
||||
]
|
||||
});
|
||||
});
|
||||
<!-- [> WIP: Dark Mode <]
|
||||
- document.documentElement.classList.toggle(
|
||||
- 'dark',
|
||||
- localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
- );
|
||||
- document.addEventListener('DOMContentLoaded', () =>
|
||||
- document.querySelectorAll('[toggle-dark-mode]').forEach((item) =>
|
||||
- item.addEventListener('click', () => {
|
||||
- localStorage.setItem('theme', localStorage.theme == 'dark' ? 'light' : 'dark');
|
||||
- document.documentElement.classList.toggle('dark');
|
||||
- })
|
||||
- )
|
||||
- ); -->
|
||||
</script>
|
||||
|
||||
|
||||
@@ -88,6 +101,9 @@
|
||||
<a href="/login">Accedi</a>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="nav-item toggle-dark-mode">
|
||||
<a href=""><i class="fa-moon"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -103,4 +119,4 @@
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user