Set last known app theme background color until theme is loaded

This commit is contained in:
schroda
2025-07-28 00:20:16 +02:00
parent ff58dcc480
commit fb00f51107
2 changed files with 21 additions and 0 deletions

View File

@@ -28,6 +28,19 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="./src/index.tsx"></script>
<script>
const backgroundColor = (() => {
try {
return JSON.parse(window.localStorage.getItem("theme_background"))
} catch (e) {
return null
}
})();
if (backgroundColor) {
document.documentElement.style.backgroundColor = backgroundColor;
}
</script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.