Skip to content

Commit 6076b4f

Browse files
committed
Fix potential flash of wrong-colour bg on startup
1 parent 4719c93 commit 6076b4f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/index.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@
5959
height: 100%;
6060
}
6161
</style>
62+
63+
<script>
64+
const bgColor = localStorage.getItem('theme-background-color') || (
65+
// Use dark/light theme containerBackground
66+
window.matchMedia("(prefers-color-scheme: dark)")
67+
? '#1e2028'
68+
: '#e4e8ed'
69+
);
70+
document.querySelector('html').style.backgroundColor = bgColor;
71+
</script>
6272
</head>
6373
<body>
6474
<div id="app"></div>
@@ -70,14 +80,6 @@
7080
</div>
7181

7282
<script>
73-
const bgColor = localStorage.getItem('theme-background-color') || (
74-
// Use dark/light theme containerBackground
75-
window.matchMedia("(prefers-color-scheme: dark)")
76-
? '#1e2028'
77-
: '#e4e8ed'
78-
);
79-
document.querySelector('html').style.backgroundColor = bgColor;
80-
8183
let progressElement = document.getElementById('progress-logo');
8284
let errorElement = document.getElementById('app-loading-error');
8385
let errorDetailsElement = document.getElementById('app-loading-error-details');

0 commit comments

Comments
 (0)