diff --git a/app/scripts/comp/settings/settings-manager.js b/app/scripts/comp/settings/settings-manager.js index 64c03031..c17c8d2a 100644 --- a/app/scripts/comp/settings/settings-manager.js +++ b/app/scripts/comp/settings/settings-manager.js @@ -11,6 +11,7 @@ const extraThemes = Features.isMac || Features.isiOS ? appleThemes : {}; const SettingsManager = { neutralLocale: null, activeLocale: 'en', + activeTheme: null, allLocales: { 'en': 'English', @@ -32,9 +33,7 @@ const SettingsManager = { customLocales: {}, setBySettings(settings) { - if (settings.theme) { - this.setTheme(settings.theme); - } + this.setTheme(settings.theme); this.setFontSize(settings.fontSize); const locale = settings.locale; try { @@ -46,7 +45,17 @@ const SettingsManager = { } catch (ex) {} }, + getDefaultTheme() { + return Features.isMac ? 'macdark' : 'fb'; + }, + setTheme(theme) { + if (!theme) { + if (this.activeTheme) { + return; + } + theme = this.getDefaultTheme(); + } for (const cls of document.body.classList) { if (/^th-/.test(cls)) { document.body.classList.remove(cls); @@ -57,6 +66,7 @@ const SettingsManager = { if (metaThemeColor) { metaThemeColor.content = window.getComputedStyle(document.body).backgroundColor; } + this.activeTheme = theme; }, getThemeClass(theme) { diff --git a/app/scripts/const/default-app-settings.js b/app/scripts/const/default-app-settings.js index 43ee5b66..5508267b 100644 --- a/app/scripts/const/default-app-settings.js +++ b/app/scripts/const/default-app-settings.js @@ -1,5 +1,5 @@ const DefaultAppSettings = { - theme: 'fb', // UI theme + theme: null, // UI theme locale: null, // user interface language expandGroups: true, // show entries from all subgroups listViewWidth: null, // width of the entry list representation diff --git a/app/scripts/views/settings/settings-general-view.js b/app/scripts/views/settings/settings-general-view.js index 922002cc..ae2db8b0 100644 --- a/app/scripts/views/settings/settings-general-view.js +++ b/app/scripts/views/settings/settings-general-view.js @@ -71,7 +71,7 @@ class SettingsGeneralView extends View { super.render({ themes: mapObject(SettingsManager.allThemes, theme => Locale[theme]), - activeTheme: AppSettingsModel.theme, + activeTheme: SettingsManager.activeTheme, locales: SettingsManager.allLocales, activeLocale: SettingsManager.activeLocale, fontSize: AppSettingsModel.fontSize, diff --git a/desktop/app.js b/desktop/app.js index 29a90011..21c175fc 100644 --- a/desktop/app.js +++ b/desktop/app.js @@ -188,7 +188,13 @@ function setSystemAppearance() { perfTimestamps?.push({ name: 'setting system appearance', ts: process.hrtime() }); } +function getDefaultTheme() { + return process.platform === 'darwin' ? 'macdark' : 'fb'; +} + function createMainWindow() { + const theme = appSettings.theme || getDefaultTheme(); + const bgColor = themeBgColors[theme] || defaultBgColor; const windowOptions = { show: false, width: 1000, @@ -196,7 +202,7 @@ function createMainWindow() { minWidth: 700, minHeight: 400, titleBarStyle: appSettings.titlebarStyle, - backgroundColor: themeBgColors[appSettings.theme] || defaultBgColor, + backgroundColor: bgColor, webPreferences: { backgroundThrottling: false, nodeIntegration: true, diff --git a/release-notes.md b/release-notes.md index df08cddc..346c57b4 100644 --- a/release-notes.md +++ b/release-notes.md @@ -6,6 +6,7 @@ Release notes `+` #1503: ARM64 Windows support `+` #1480: option to create a portable installation `+` #1400: auto-apply tag when creating new entry in tag view +`*` default theme on macOS is now macOS-Dark `+` #1342: hint that the data will be stored in unencrypted form after exporting `*` #1471: WebDAV url validation, only HTTPS is allowed `+` #1350: clearing master password after auto lock period