1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-16 15:48:00 +09:00
elk/components/settings/SettingsColorMode.vue

42 lines
1.4 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import type { ColorMode } from '~/composables/settings'
const colorMode = useColorMode()
function setColorMode(mode: ColorMode) {
colorMode.preference = mode
}
</script>
<template>
2023-01-14 03:26:31 +09:00
<div flex="~ gap4 wrap" w-full>
<button
2023-01-14 03:26:31 +09:00
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap
:tabindex="colorMode.preference === 'dark' ? 0 : -1"
:class="colorMode.preference === 'dark' ? 'pointer-events-none' : 'filter-saturate-0'"
@click="setColorMode('dark')"
>
<div i-ri:moon-line />
2022-12-30 04:27:11 +09:00
{{ $t('settings.interface.dark_mode') }}
</button>
<button
2023-01-14 03:26:31 +09:00
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap
:tabindex="colorMode.preference === 'light' ? 0 : -1"
:class="colorMode.preference === 'light' ? 'pointer-events-none' : 'filter-saturate-0'"
@click="setColorMode('light')"
>
<div i-ri:sun-line />
2022-12-30 04:27:11 +09:00
{{ $t('settings.interface.light_mode') }}
</button>
<button
2023-01-14 03:26:31 +09:00
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap
:tabindex="colorMode.preference === 'system' ? 0 : -1"
:class="colorMode.preference === 'system' ? 'pointer-events-none' : 'filter-saturate-0'"
@click="setColorMode('system')"
>
<div i-ri:computer-line />
{{ $t('settings.interface.system_mode') }}
</button>
</div>
</template>