mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 14:16:44 -06:00
テーマの切り替えをなめらかに
This commit is contained in:
parent
e8ef8f0004
commit
4de75448b6
3 changed files with 14 additions and 2 deletions
|
@ -389,7 +389,7 @@ export default (callback: (launch: (router: VueRouter) => [Vue, MiOS], os: MiOS)
|
|||
});
|
||||
//#endregion
|
||||
|
||||
// Reapply current theme
|
||||
/*// Reapply current theme
|
||||
try {
|
||||
const themeName = os.store.state.device.darkmode ? os.store.state.device.darkTheme : os.store.state.device.lightTheme;
|
||||
const themes = os.store.state.device.themes.concat(builtinThemes);
|
||||
|
@ -399,7 +399,7 @@ export default (callback: (launch: (router: VueRouter) => [Vue, MiOS], os: MiOS)
|
|||
}
|
||||
} catch (e) {
|
||||
console.log(`Cannot reapply theme. ${e}`);
|
||||
}
|
||||
}*/
|
||||
|
||||
//#region line width
|
||||
document.documentElement.style.setProperty('--lineWidth', `${os.store.state.device.lineWidth}px`);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ html, body
|
|||
text-size-adjust 100%
|
||||
font-family sans-serif
|
||||
|
||||
html.change-theme
|
||||
&, *
|
||||
transition-property all
|
||||
transition-duration 0.5s
|
||||
transition-timing-function ease
|
||||
|
||||
a
|
||||
text-decoration none
|
||||
color var(--link)
|
||||
|
|
Loading…
Reference in a new issue