color cookie

This commit is contained in:
2025-12-30 17:11:28 +00:00
parent 22d24e0f7b
commit 5a536e34d4
2 changed files with 11 additions and 4 deletions

View File

@@ -7,9 +7,12 @@ export function ui_color_cookie(): CookieRef<string> {
});
watch(c, (newVal, oldVal) => {
document.body.classList.remove(oldVal);
document.body.classList.add(newVal);
})
// remove old class (if it's been put)
if (oldVal != undefined) document.body.classList.remove("ui-" + oldVal);
// add new class
document.body.classList.add("ui-" + newVal);
}, { immediate: true})
return c;