komga/next-ui/src/composables/themeWatcher.ts
2025-11-28 16:05:21 +08:00

19 lines
449 B
TypeScript

import { useTheme } from 'vuetify'
import { useAppStore } from '@/stores/app'
export function useThemeWatcher() {
const appStore = useAppStore()
const theme = useTheme()
function updateTheme(selectedTheme: string) {
theme.change(selectedTheme)
}
watch(
() => appStore.theme,
(selectedTheme) => updateTheme(selectedTheme),
)
// trigger an update on startup to get the proper theme loaded
updateTheme(appStore.theme)
}