mirror of
https://github.com/PrivSec-dev/privsec.dev.git
synced 2025-07-22 06:08:47 -04:00
handle theme switching without inline js
This commit is contained in:
parent
87c3fcf949
commit
c672ce9026
2 changed files with 127 additions and 0 deletions
9
assets/js/theme.js
Normal file
9
assets/js/theme.js
Normal 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();
|
Loading…
Add table
Add a link
Reference in a new issue