-
-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script setup lang="ts"> | ||
import type { ColorMode } from '~/composables/settings' | ||
const colorMode = useColorMode() | ||
function setColorMode(mode: ColorMode) { | ||
colorMode.preference = mode | ||
} | ||
const modes = [ | ||
{ | ||
icon: 'i-ri-moon-line', | ||
label: 'settings.interface.dark_mode', | ||
mode: 'dark', | ||
}, | ||
{ | ||
icon: 'i-ri-sun-line', | ||
label: 'settings.interface.light_mode', | ||
mode: 'light', | ||
}, | ||
{ | ||
icon: 'i-ri-computer-line', | ||
label: 'settings.interface.system_mode', | ||
mode: 'system', | ||
}, | ||
] as const | ||
</script> | ||
|
||
<template> | ||
<div flex="~ gap4 wrap" w-full> | ||
<button | ||
v-for="{ icon, label, mode } in modes" | ||
:key="mode" | ||
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap | ||
:tabindex="colorMode.preference === mode ? 0 : -1" | ||
:class="colorMode.preference === mode ? 'pointer-events-none' : 'filter-saturate-0'" | ||
@click="setColorMode(mode)" | ||
> | ||
<span :class="`${icon}`" /> | ||
{{ $t(label) }} | ||
</button> | ||
</div> | ||
</template> |