mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 00:06:15 -04:00
feat(enhancement): use system dark mode (#458)
* Use prefers-color-scheme * Remove theme store
This commit is contained in:
parent
1e2a35b892
commit
cf7b1f000a
4 changed files with 8 additions and 35 deletions
|
@ -1,18 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { BrandGithub, BrandTwitter, InfoCircle, Moon, Sun } from '@vicons/tabler';
|
||||
import { useStyleStore } from '@/stores/style.store';
|
||||
import { useThemeStore } from '@/ui/theme/theme.store';
|
||||
|
||||
const styleStore = useStyleStore();
|
||||
const { isDarkTheme } = toRefs(styleStore);
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
|
||||
function toggleDarkTheme() {
|
||||
isDarkTheme.value = !isDarkTheme.value;
|
||||
|
||||
themeStore.toggleTheme();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -58,7 +49,7 @@ function toggleDarkTheme() {
|
|||
</n-tooltip>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<c-button circle variant="text" aria-label="Toggle dark/light mode" @click="toggleDarkTheme">
|
||||
<c-button circle variant="text" aria-label="Toggle dark/light mode" @click="() => styleStore.toggleDark()">
|
||||
<n-icon v-if="isDarkTheme" size="25" :component="Sun" />
|
||||
<n-icon v-else size="25" :component="Moon" />
|
||||
</c-button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue