handle theme switching without inline js

This commit is contained in:
Wonderfall 2022-07-21 20:24:29 +02:00
parent 87c3fcf949
commit c672ce9026
2 changed files with 127 additions and 0 deletions

9
assets/js/theme.js Normal file
View file

@ -0,0 +1,9 @@
// for now this is assuming default theme is set to dark
// will probably refactor in the future for much better handling
function loadPreferredTheme() {
if (localStorage.getItem("pref-theme") === "light") {
document.body.classList.remove('dark')
}
}
loadPreferredTheme();