From 7b45ecbd63176661d1c99e2df845d7644a74fd3c Mon Sep 17 00:00:00 2001 From: Pedro Luiz da Costa Date: Fri, 22 Oct 2021 12:44:00 -0300 Subject: [PATCH 1/2] add background color to mainWindow --- src/electron-main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/electron-main.ts b/src/electron-main.ts index c82e3463b..162a8005c 100644 --- a/src/electron-main.ts +++ b/src/electron-main.ts @@ -925,7 +925,7 @@ app.on('ready', async () => { const preloadScript = path.normalize(`${__dirname}/preload.js`); mainWindow = global.mainWindow = new BrowserWindow({ // https://www.electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do - backgroundColor: '#fff', + backgroundColor: '#16191e', icon: iconPath, show: false, @@ -1015,7 +1015,9 @@ app.on('window-all-closed', () => { }); app.on('activate', () => { - mainWindow.show(); + mainWindow.once('ready-to-show', () => { + mainWindow.show(); + }); }); function beforeQuit() { From 91e1bbcfd2d28058e6de183178dedcf776a6193b Mon Sep 17 00:00:00 2001 From: Pedro Luiz da Costa Date: Fri, 22 Oct 2021 13:10:46 -0300 Subject: [PATCH 2/2] set background color based on nativeTheme --- src/electron-main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/electron-main.ts b/src/electron-main.ts index 162a8005c..1084a4b6c 100644 --- a/src/electron-main.ts +++ b/src/electron-main.ts @@ -19,7 +19,7 @@ limitations under the License. // Squirrel on windows starts the app with various flags as hooks to tell us when we've been installed/uninstalled etc. import "./squirrelhooks"; -import { app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol, dialog } from "electron"; +import { app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol, dialog, nativeTheme } from "electron"; import AutoLaunch from "auto-launch"; import path from "path"; import windowStateKeeper from 'electron-window-state'; @@ -925,7 +925,7 @@ app.on('ready', async () => { const preloadScript = path.normalize(`${__dirname}/preload.js`); mainWindow = global.mainWindow = new BrowserWindow({ // https://www.electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do - backgroundColor: '#16191e', + backgroundColor: nativeTheme.shouldUseDarkColors ? '#16191e' : '#fff', icon: iconPath, show: false,