mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
feat: 💫 Animate color scheme changes
This commit is contained in:
parent
53cd4fc57d
commit
14c1dea7a5
12
app.vue
12
app.vue
|
|
@ -39,7 +39,14 @@ const theme = useSetting(SettingIds.Theme) as Ref<EnumSetting>;
|
||||||
const colorMode = useColorMode();
|
const colorMode = useColorMode();
|
||||||
|
|
||||||
watch(theme.value, () => {
|
watch(theme.value, () => {
|
||||||
|
// Add theme-changing class to html to trigger transition
|
||||||
|
document.documentElement.classList.add("theme-changing");
|
||||||
colorMode.preference = theme.value.value;
|
colorMode.preference = theme.value.value;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// Remove theme-changing class after transition
|
||||||
|
document.documentElement.classList.remove("theme-changing");
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
|
|
@ -87,4 +94,9 @@ useCacheRefresh(client);
|
||||||
body {
|
body {
|
||||||
font-family: Inter, sans-serif;
|
font-family: Inter, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html.theme-changing * {
|
||||||
|
/* Stroke and fill aren't animatable */
|
||||||
|
transition: background 1s ease, border 1s ease, color 1s ease, box-shadow 1s ease;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in a new issue