mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
feat: ✨ Add keyboard shortcut to swap color scheme
This commit is contained in:
parent
14c1dea7a5
commit
38c2ed37ec
|
|
@ -38,7 +38,9 @@ import { SettingIds } from "~/settings";
|
|||
|
||||
const appData = useAppData();
|
||||
const signInAction = () => signIn(appData);
|
||||
const { n } = useMagicKeys();
|
||||
const colorMode = useColorMode();
|
||||
const themeSetting = useSetting(SettingIds.Theme);
|
||||
const { n, d } = useMagicKeys();
|
||||
const activeElement = useActiveElement();
|
||||
const notUsingInput = computed(
|
||||
() =>
|
||||
|
|
@ -57,5 +59,16 @@ watchEffect(async () => {
|
|||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
useEvent("composer:open");
|
||||
}
|
||||
|
||||
if (d?.value && !colorMode.forced) {
|
||||
// Swap theme from dark to light or vice versa
|
||||
if (colorMode.value === "dark") {
|
||||
colorMode.preference = "light";
|
||||
themeSetting.value.value = "light";
|
||||
} else {
|
||||
colorMode.preference = "dark";
|
||||
themeSetting.value.value = "dark";
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue