Fix ultramarine flash when closing Settings window

This commit is contained in:
Fedor Indutny 2024-08-05 11:48:15 -07:00 committed by GitHub
parent 1a87989f94
commit c4f0db0307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -365,13 +365,18 @@ async function getResolvedThemeSetting(
return ThemeType[theme]; return ThemeType[theme];
} }
type GetBackgroundColorOptionsType = GetThemeSettingOptionsType &
Readonly<{
signalColors?: boolean;
}>;
async function getBackgroundColor( async function getBackgroundColor(
options?: GetThemeSettingOptionsType options?: GetBackgroundColorOptionsType
): Promise<string> { ): Promise<string> {
const theme = await getResolvedThemeSetting(options); const theme = await getResolvedThemeSetting(options);
if (theme === 'light') { if (theme === 'light') {
return '#3a76f0'; return options?.signalColors ? '#3a76f0' : '#ffffff';
} }
if (theme === 'dark') { if (theme === 'dark') {
@ -695,7 +700,7 @@ async function createWindow() {
titleBarStyle: mainTitleBarStyle, titleBarStyle: mainTitleBarStyle,
backgroundColor: isTestEnvironment(getEnvironment()) backgroundColor: isTestEnvironment(getEnvironment())
? '#ffffff' // Tests should always be rendered on a white background ? '#ffffff' // Tests should always be rendered on a white background
: await getBackgroundColor(), : await getBackgroundColor({ signalColors: true }),
webPreferences: { webPreferences: {
...defaultWebPrefs, ...defaultWebPrefs,
nodeIntegration: false, nodeIntegration: false,
@ -1347,7 +1352,7 @@ async function showAbout() {
title: getResolvedMessagesLocale().i18n('icu:aboutSignalDesktop'), title: getResolvedMessagesLocale().i18n('icu:aboutSignalDesktop'),
titleBarStyle: nonMainTitleBarStyle, titleBarStyle: nonMainTitleBarStyle,
autoHideMenuBar: true, autoHideMenuBar: true,
backgroundColor: await getBackgroundColor(), backgroundColor: await getBackgroundColor({ signalColors: true }),
show: false, show: false,
webPreferences: { webPreferences: {
...defaultWebPrefs, ...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 // 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 // never wait for the database to be initialized. Thus the theme setting
// lookup should be done only in ephemeral config. // lookup should be done only in ephemeral config.
const backgroundColor = await getBackgroundColor({ ephemeralOnly: true }); const backgroundColor = await getBackgroundColor({
ephemeralOnly: true,
signalColors: true,
});
drop( drop(
// eslint-disable-next-line more/no-then // eslint-disable-next-line more/no-then