color cookie
This commit is contained in:
16
app/composables/ui_color.ts
Normal file
16
app/composables/ui_color.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import type {CookieRef} from "#app";
|
||||||
|
|
||||||
|
export function ui_color_cookie(): CookieRef<string> {
|
||||||
|
|
||||||
|
const c = useCookie("ui_color",{
|
||||||
|
default: () => "green",
|
||||||
|
|
||||||
|
});
|
||||||
|
watch(c, (newVal, oldVal) => {
|
||||||
|
document.body.classList.remove(oldVal);
|
||||||
|
document.body.classList.add(newVal);
|
||||||
|
})
|
||||||
|
|
||||||
|
return c;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user