テーマの切り替えをなめらかに

This commit is contained in:
syuilo 2019-03-03 08:43:51 +09:00
parent e8ef8f0004
commit 4de75448b6
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 14 additions and 2 deletions

View file

@ -43,6 +43,12 @@ export const builtinThemes = [
];
export function applyTheme(theme: Theme, persisted = true) {
document.documentElement.classList.add('change-theme');
setTimeout(() => {
document.documentElement.classList.remove('change-theme');
}, 500);
// Deep copy
const _theme = JSON.parse(JSON.stringify(theme));