2022-12-28 08:03:50 +09:00
|
|
|
<script setup lang="ts">
|
2022-12-28 10:06:54 +09:00
|
|
|
import type { ColorMode } from '~/types'
|
|
|
|
|
2022-12-29 21:26:08 +09:00
|
|
|
const colorMode = useColorMode()
|
2022-12-28 10:06:54 +09:00
|
|
|
|
|
|
|
function setColorMode(mode: ColorMode) {
|
2022-12-29 21:26:08 +09:00
|
|
|
colorMode.preference = mode
|
2022-12-28 08:03:50 +09:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div flex="~ gap4" w-full>
|
|
|
|
<button
|
|
|
|
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base
|
2022-12-29 21:26:08 +09:00
|
|
|
:class="colorMode.value === 'dark' ? 'pointer-events-none' : 'filter-saturate-0'"
|
2022-12-28 10:06:54 +09:00
|
|
|
@click="setColorMode('dark')"
|
2022-12-28 08:03:50 +09:00
|
|
|
>
|
|
|
|
<div i-ri:moon-line />
|
|
|
|
Dark Mode
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base
|
2022-12-29 21:26:08 +09:00
|
|
|
:class="colorMode.value === 'light' ? 'pointer-events-none' : 'filter-saturate-0'"
|
2022-12-28 10:06:54 +09:00
|
|
|
@click="setColorMode('light')"
|
2022-12-28 08:03:50 +09:00
|
|
|
>
|
|
|
|
<div i-ri:sun-line />
|
|
|
|
Light Mode
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|