Fix flash of white in some configurations

This commit is contained in:
Thomas Weber committed 2021-08-27 21:57:45 -05:00
1 parent a52f7de22e
commit 490db9fb3c
1 file changed
+13 -4
+13 -4
View File
@@ -8,14 +8,23 @@
<title><%= appName %></title>
<meta name="description" content="Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux.">
<style>
@media (prefers-color-scheme: dark) {
body:not([p4-loaded]) {
background-color: #111;
}
body[p4-splash-theme="dark"]:not([p4-loaded]) {
background-color: #111;
}
</style>
</head>
<body>
<div id="app"></div>
<script>
(function() {
var theme = 'system';
try {
var local = localStorage.getItem('P4.theme')
if (typeof local === 'string') theme = local;
} catch (e) { /* ignore */ }
if (theme === 'system') theme = window.matchMedia('(prefers-color-scheme: dark)') ? 'dark' : 'light';
document.body.setAttribute('p4-splash-theme', theme);
})();
</script>
</body>
</html>