Skip to content

Commit

Permalink
🐛 Fix theme selector behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Jun 29, 2024
1 parent 23a8d57 commit 4c4e18f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/ThemeSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
</script>

Expand Down

0 comments on commit 4c4e18f

Please sign in to comment.