diff --git a/src/App.vue b/src/App.vue index 5044bf4..f40f23a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -24,15 +24,28 @@ import { ref, provide, watch } from 'vue'; const { getColorScheme, updateColorScheme } = useColorScheme(); const colorScheme = ref(getColorScheme()); provide('colorScheme', colorScheme); -watch(colorScheme, val => updateColorScheme(val)) +watch(colorScheme, (newValue) => { + updateColorScheme(newValue); + document.body.style.setProperty(colorScheme, { + auto: 'normal', + dark: 'dark', + light: 'light' + }); + if (newValue === 'dark') { + document.body.classList.add('dark'); + } else { + document.body.classList.remove('dark'); + } + if (newValue === 'auto') { + document.body.classList.add('color-scheme-auto'); + } else { + document.body.classList.remove('color-scheme-auto'); + } +});