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];
}
type GetBackgroundColorOptionsType = GetThemeSettingOptionsType &
Readonly<{
signalColors?: boolean;
}>;
async function getBackgroundColor(
options?: GetThemeSettingOptionsType
options?: GetBackgroundColorOptionsType
): Promise<string> {
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