From 1a6059072a11fcf3529b644998fbaae24a9eefdc Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Mon, 19 May 2025 14:55:22 -0700 Subject: [PATCH] Desktop: Make default window color match system theme (#12303) --- packages/app-desktop/ElectronAppWrapper.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/app-desktop/ElectronAppWrapper.ts b/packages/app-desktop/ElectronAppWrapper.ts index 9a76cab9e9..e4f8937826 100644 --- a/packages/app-desktop/ElectronAppWrapper.ts +++ b/packages/app-desktop/ElectronAppWrapper.ts @@ -6,7 +6,7 @@ const shim: typeof ShimType = require('@joplin/lib/shim').default; import { isCallbackUrl } from '@joplin/lib/callbackUrlUtils'; import { FileLocker } from '@joplin/utils/fs'; import { IpcMessageHandler, IpcServer, Message, newHttpError, sendMessage, SendMessageOptions, startServer, stopServer } from '@joplin/utils/ipc'; -import { BrowserWindow, Tray, WebContents, screen, App } from 'electron'; +import { BrowserWindow, Tray, WebContents, screen, App, nativeTheme } from 'electron'; import bridge from './bridge'; const url = require('url'); const path = require('path'); @@ -215,7 +215,10 @@ export default class ElectronAppWrapper { height: windowState.height, minWidth: 100, minHeight: 100, - backgroundColor: '#fff', // required to enable sub pixel rendering, can't be in css + // A backgroundColor is needed to enable sub-pixel rendering. + // Based on https://www.electronjs.org/docs/latest/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do, + // this needs to be a non-transparent color: + backgroundColor: nativeTheme.shouldUseDarkColors ? '#333' : '#fff', webPreferences: { nodeIntegration: true, contextIsolation: false,