fixed app startup background color

vibrancy
antelle 2020-12-19 16:39:18 +01:00
parent 6c7b99af58
commit 1617cae518
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 9 additions and 3 deletions

View File

@ -33,6 +33,7 @@ const SettingsManager = {
hc: 'setGenThemeHc'
},
// changing something here? don't forget about desktop/app.js
autoSwitchedThemes: [
{
name: 'setGenThemeDefault',

View File

@ -68,7 +68,11 @@ const themeBgColors = {
};
const darkLightThemes = {
dark: 'light',
sd: 'sl'
sd: 'sl',
fb: 'bl',
db: 'lb',
te: 'lt',
dc: 'hc'
};
const defaultBgColor = '#282C34';
@ -85,7 +89,7 @@ const settingsPromise = loadSettingsEncryptionKey().then((key) => {
logProgress('loading settings key');
return loadConfig('app-settings').then((settings) => {
appSettings = settings ? JSON.parse(settings) : { autoSwitchTheme: true };
appSettings = settings ? JSON.parse(settings) : {};
logProgress('reading app settings');
});
});
@ -244,7 +248,8 @@ function selectDarkOrLightTheme(theme) {
function createMainWindow() {
let theme = checkSettingsTheme(appSettings.theme) || getDefaultTheme();
if (appSettings.autoSwitchTheme) {
const autoSwitchTheme = appSettings.autoSwitchTheme ?? true;
if (autoSwitchTheme) {
theme = selectDarkOrLightTheme(theme);
}
const bgColor = themeBgColors[theme] || defaultBgColor;