proper fix for window background flashing

This commit is contained in:
Benjamin Pasero 2016-08-18 09:09:40 +02:00
parent 389ce73afa
commit d71df3b994

View file

@ -3,20 +3,33 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<style>.monaco-shell.vs-dark { background-color: #1E1E1E; }</style>
<script>
try {
const theme = window.localStorage.getItem('storage://global/workbench.theme');
const baseTheme = (theme || '').split(' ')[0];
if (baseTheme !== 'vs-dark') { <!-- Theming (do not remove, we want to early load it to avoid flashing background) -->
window.document.body.className = 'monaco-shell ' + baseTheme; <style>
} .monaco-shell.vs-dark {
} catch (error) { background-color: #1E1E1E;
console.error(error);
} }
</script> </style>
</head> </head>
<body class="monaco-shell vs-dark" aria-label=""></body> <body class="monaco-shell vs-dark" aria-label="">
<script>
(function() {
try {
var theme = window.localStorage.getItem('storage://global/workbench.theme');
if (theme) {
var baseTheme = theme.split(' ')[0];
if (baseTheme !== 'vs-dark') {
window.document.body.className = 'monaco-shell ' + baseTheme;
}
}
} catch (error) {
console.error(error);
}
})();
</script>
</body>
<!-- Startup via index.js -->
<script src="index.js"></script> <script src="index.js"></script>
</html> </html>