24 lines
578 B
Vue
24 lines
578 B
Vue
<script setup>
|
|
const colorMode = useColorMode();
|
|
|
|
const isDark = computed({
|
|
get() {
|
|
return colorMode.value === "dark";
|
|
},
|
|
set(_isDark) {
|
|
colorMode.preference = _isDark ? "dark" : "light";
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<ClientOnly v-if="!colorMode?.forced">
|
|
<div class="flex h-8 w-8 cursor-pointer items-center justify-center">
|
|
<i @click="isDark = !isDark" :class="['uil text-[35px] cursor-pointer', isDark ? 'uil-moon' : 'uil-sun']"></i>
|
|
</div>
|
|
<template #fallback>
|
|
<div class="size-20" />
|
|
</template>
|
|
</ClientOnly>
|
|
</template>
|