Fix theme switcher showing wrong value

This commit is contained in:
Zerebos 2024-06-08 14:32:06 -04:00
parent a7ed566645
commit 3dc3f1579b
No known key found for this signature in database
GPG Key ID: 79BE50E3D28D5686

View File

@ -12,6 +12,7 @@ if (preference) {
export default function setupThemeSelector() {
const themeSwitch: HTMLInputElement = document.querySelector(".theme-selection input")!;
themeSwitch.checked = preference ? preference === "dark" : true;
themeSwitch?.addEventListener("change", () => {
if (themeSwitch.checked) {
document.body.classList.add("theme-dark");