diff --git a/components/ThemeSwitcher.vue b/components/ThemeSwitcher.vue index 2f9b91a..c96d59a 100644 --- a/components/ThemeSwitcher.vue +++ b/components/ThemeSwitcher.vue @@ -3,14 +3,14 @@ const colorMode = useColorMode(); const theme = computed(_ => { switch (colorMode.preference){ case "system": - return window?.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; + return window?.matchMedia("[preferred-color-scheme: dark]") ? "dark" : "light"; default: return colorMode.preference; } }); function toggleTheme(){ - colorMode.preference = colorMode.preference === "dark" ? "light" : "dark"; + colorMode.preference = theme.value === "light" ? "dark" : "light"; }