Fix white flash in dark mode (#6815)

This commit is contained in:
Bram Kragten 2020-09-07 18:19:28 +02:00 committed by GitHub
parent bb2462483e
commit e5c386c39a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -48,7 +48,7 @@
}
@media (prefers-color-scheme: dark) {
html {
background-color: var(--primary-background-color, #111111);
background-color: #111111;
}
#ha-init-skeleton::before {
background-color: #1c1c1c;

View File

@ -88,9 +88,15 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
}
const themeMeta = document.querySelector("meta[name=theme-color]");
const headerColor = getComputedStyle(
document.documentElement
).getPropertyValue("--app-header-background-color");
const computedStyles = getComputedStyle(document.documentElement);
const headerColor = computedStyles.getPropertyValue(
"--app-header-background-color"
);
document.documentElement.style.backgroundColor = computedStyles.getPropertyValue(
"--primary-background-color"
);
if (themeMeta) {
if (!themeMeta.hasAttribute("default-content")) {
themeMeta.setAttribute(