Skip to content

Commit 6d107be

Browse files
Refactor history page loading indicator
Co-authored-by: randerson <[email protected]>
1 parent 0b20737 commit 6d107be

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

special-pages/pages/history/public/index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22
<html lang="en">
33
<head>
44
<style>
5-
body {
6-
/* Token is replaced by native browser so background isn't white while History initializes */
7-
--loading-color: $LOADING_COLOR$;
8-
background: var(--loading-color);
5+
html, body {
6+
background: #fafafa;
7+
}
8+
@media screen and (prefers-color-scheme: dark) {
9+
html, body {
10+
background: #333;
11+
}
912
}
1013
</style>
14+
<script>
15+
// $LOADING_COLOR$ is replaced by native via string interpolation.
16+
// This script must be in <head> to block rendering and prevent flash of wrong color.
17+
const loadingColor = "$LOADING_COLOR$";
18+
const hasLoadingColor = !!loadingColor && !loadingColor.startsWith("$");
19+
if (hasLoadingColor) {
20+
document.documentElement.style.background = loadingColor;
21+
}
22+
</script>
1123
<title>History</title>
1224
<meta name="robots" content="noindex,nofollow">
1325
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

0 commit comments

Comments
 (0)