improve theme toggle transition (#5387)

This commit is contained in:
Michael Geers 2022-12-06 08:39:56 +01:00 • committed by GitHub
parent 8e6ef69716
commit 5a630fc5c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -79,7 +79,7 @@ html {
}
html.no-transitions * {
transition-duration: 0ms !important;
transition: none !important;
}
body {

View file

@ -49,9 +49,9 @@ function updateTheme() {
const $html = document.querySelector("html");
$html.classList.add("no-transitions");
$html.classList.toggle("dark", theme === THEME_DARK);
window.requestAnimationFrame(function () {
window.setTimeout(function () {
$html.classList.remove("no-transitions");
});
}, 100);
}
export function watchThemeChanges() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/index.html vendored
View file

@ -20,8 +20,8 @@
<meta name="theme-color" content="#020318" />
<title>evcc</title>
<script type="module" crossorigin src="./assets/index.fc7dad78.js"></script>
<link rel="stylesheet" href="./assets/index.8ba2569b.css">
<script type="module" crossorigin src="./assets/index.a61ffbf5.js"></script>
<link rel="stylesheet" href="./assets/index.c173ebc0.css">
</head>
<body>