1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-02 20:15:55 +02:00

enhance(frontend): テーマ切り替えのアニメーションをView Transitionに変更 (#15974)

* enhance(frontend): テーマ切り替えのアニメーションをView Transitionに変更

* fix lint

* fix: 切り替え時間を0.5sに
This commit is contained in:
かっこかり
2025-05-21 14:19:34 +09:00
committed by GitHub
parent bd7633c70e
commit 2619f69238
3 changed files with 86 additions and 19 deletions

View File

@@ -31,9 +31,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onMounted, ref, useTemplateRef, watch } from 'vue';
import { onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue';
import { miLocalStorage } from '@/local-storage.js';
import { prefer } from '@/preferences.js';
import { globalEvents } from '@/events.js';
import { getBgColor } from '@/utility/get-bg-color.js';
const miLocalStoragePrefix = 'ui:folder:' as const;
@@ -83,8 +84,19 @@ function afterLeave(el: Element) {
el.style.height = '';
}
function updateBgColor() {
if (rootEl.value) {
parentBg.value = getBgColor(rootEl.value.parentElement);
}
}
onMounted(() => {
parentBg.value = getBgColor(rootEl.value?.parentElement);
updateBgColor();
globalEvents.on('themeChanging', updateBgColor);
});
onBeforeUnmount(() => {
globalEvents.off('themeChanging', updateBgColor);
});
</script>