From c4f0db030746b2ac1f6765d48a2d1b704664542a Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:48:15 -0700 Subject: [PATCH] Fix ultramarine flash when closing Settings window --- app/main.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/main.ts b/app/main.ts index 4866c753f1..f01ac17735 100644 --- a/app/main.ts +++ b/app/main.ts @@ -365,13 +365,18 @@ async function getResolvedThemeSetting( return ThemeType[theme]; } +type GetBackgroundColorOptionsType = GetThemeSettingOptionsType & + Readonly<{ + signalColors?: boolean; + }>; + async function getBackgroundColor( - options?: GetThemeSettingOptionsType + options?: GetBackgroundColorOptionsType ): Promise { const theme = await getResolvedThemeSetting(options); if (theme === 'light') { - return '#3a76f0'; + return options?.signalColors ? '#3a76f0' : '#ffffff'; } if (theme === 'dark') { @@ -695,7 +700,7 @@ async function createWindow() { titleBarStyle: mainTitleBarStyle, backgroundColor: isTestEnvironment(getEnvironment()) ? '#ffffff' // Tests should always be rendered on a white background - : await getBackgroundColor(), + : await getBackgroundColor({ signalColors: true }), webPreferences: { ...defaultWebPrefs, nodeIntegration: false, @@ -1347,7 +1352,7 @@ async function showAbout() { title: getResolvedMessagesLocale().i18n('icu:aboutSignalDesktop'), titleBarStyle: nonMainTitleBarStyle, autoHideMenuBar: true, - backgroundColor: await getBackgroundColor(), + backgroundColor: await getBackgroundColor({ signalColors: true }), show: false, webPreferences: { ...defaultWebPrefs, @@ -2142,7 +2147,10 @@ app.on('ready', async () => { // This color is to be used only in loading screen and in this case we should // never wait for the database to be initialized. Thus the theme setting // lookup should be done only in ephemeral config. - const backgroundColor = await getBackgroundColor({ ephemeralOnly: true }); + const backgroundColor = await getBackgroundColor({ + ephemeralOnly: true, + signalColors: true, + }); drop( // eslint-disable-next-line more/no-then