added theme checking if localstorage is empty
11ty build and deploy for ${{ gitea.repository }} / build-deploy (push) Successful in 21s Details

This commit is contained in:
suroh 2024-02-08 17:01:30 +01:00
parent dff1fa475b
commit 9055bf392f
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,9 @@ customElements.define('theme-switcher', class extends HTMLElement {
} else if (this.currentTheme == 'light') { } else if (this.currentTheme == 'light') {
checkbox.checked = false checkbox.checked = false
document.body.classList.toggle('light') document.body.classList.toggle('light')
} else {
console.log(this.preferDark)
checkbox.checked = this.preferDark
} }
checkbox.addEventListener('click', () => { checkbox.addEventListener('click', () => {