Files
ReZygisk/webroot/js/theme.js
T
ThePedroo dde0436fd9 fix: JS code indentation/syntax
This commit fixes the syntax and indentation of the JavaScript code to meet the organization standard.
2024-11-12 00:09:12 -03:00

23 lines
503 B
JavaScript

import { setDark } from './themes/dark.js'
import { setLight } from './themes/light.js'
const button = document.getElementById('theme_switcher')
let sys_theme = localStorage.getItem('/system/theme')
if (!sys_theme) sys_theme = setData('dark')
if (sys_theme === 'light') {
button.setAttribute('checked', '')
setLight()
}
button.addEventListener('click', () => {
button.checked ? setLight() : setDark()
})
function setData(mode) {
localStorage.setItem('/system/theme', mode)
return mode
}