fix startup flash

This commit is contained in:
Arjun 2026-02-04 22:45:51 +05:30
parent 53bbd3b76d
commit f03a00d2af
2 changed files with 23 additions and 0 deletions

View file

@ -64,6 +64,8 @@ function createWindow() {
const win = new BrowserWindow({
width: 1280,
height: 800,
show: false, // Don't show until ready
backgroundColor: "#252525", // Prevent white flash (matches dark mode)
webPreferences: {
// IMPORTANT: keep Node out of renderer
nodeIntegration: false,
@ -73,6 +75,11 @@ function createWindow() {
},
});
// Show window when content is ready to prevent blank screen
win.once("ready-to-show", () => {
win.show();
});
// Open external links in system browser (not sandboxed Electron window)
// This handles window.open() and target="_blank" links
win.webContents.setWindowOpenHandler(({ url }) => {

View file

@ -5,6 +5,22 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rowboat</title>
<style>
/* Prevent flash of white background before CSS loads */
html, body { margin: 0; padding: 0; }
html.dark, html.dark body { background-color: #252525; }
html.light, html.light body { background-color: #fff; }
</style>
<script>
// Apply theme class immediately before render
(function() {
var stored = localStorage.getItem('rowboat-theme');
var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
var theme = stored || 'system';
var resolved = theme === 'system' ? (prefersDark ? 'dark' : 'light') : theme;
document.documentElement.classList.add(resolved);
})();
</script>
</head>
<body>
<div id="root"></div>