2022-12-28 00:03:50 +01:00
|
|
|
<script setup lang="ts">
|
2023-01-12 18:52:52 +01:00
|
|
|
import type { ColorMode } from '~/composables/settings'
|
2022-12-28 02:06:54 +01:00
|
|
|
|
2022-12-29 13:26:08 +01:00
|
|
|
const colorMode = useColorMode()
|
2022-12-28 02:06:54 +01:00
|
|
|
|
|
|
|
function setColorMode(mode: ColorMode) {
|
2022-12-29 13:26:08 +01:00
|
|
|
colorMode.preference = mode
|
2022-12-28 00:03:50 +01: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 20:27:11 +01:00
|
|
|
:tabindex="colorMode.value === 'dark' ? 0 : -1"
|
2022-12-29 13:26:08 +01:00
|
|
|
:class="colorMode.value === 'dark' ? 'pointer-events-none' : 'filter-saturate-0'"
|
2022-12-28 02:06:54 +01:00
|
|
|
@click="setColorMode('dark')"
|
2022-12-28 00:03:50 +01:00
|
|
|
>
|
|
|
|
<div i-ri:moon-line />
|
2022-12-29 20:27:11 +01:00
|
|
|
{{ $t('settings.interface.dark_mode') }}
|
2022-12-28 00:03:50 +01:00
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base
|
2022-12-29 20:27:11 +01:00
|
|
|
:tabindex="colorMode.value === 'light' ? 0 : -1"
|
2022-12-29 13:26:08 +01:00
|
|
|
:class="colorMode.value === 'light' ? 'pointer-events-none' : 'filter-saturate-0'"
|
2022-12-28 02:06:54 +01:00
|
|
|
@click="setColorMode('light')"
|
2022-12-28 00:03:50 +01:00
|
|
|
>
|
|
|
|
<div i-ri:sun-line />
|
2022-12-29 20:27:11 +01:00
|
|
|
{{ $t('settings.interface.light_mode') }}
|
2022-12-28 00:03:50 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|