mirror of https://github.com/keeweb/keeweb.git
default theme on macOS
This commit is contained in:
parent
c3b55cd7fa
commit
e5073eb65f
|
@ -11,6 +11,7 @@ const extraThemes = Features.isMac || Features.isiOS ? appleThemes : {};
|
||||||
const SettingsManager = {
|
const SettingsManager = {
|
||||||
neutralLocale: null,
|
neutralLocale: null,
|
||||||
activeLocale: 'en',
|
activeLocale: 'en',
|
||||||
|
activeTheme: null,
|
||||||
|
|
||||||
allLocales: {
|
allLocales: {
|
||||||
'en': 'English',
|
'en': 'English',
|
||||||
|
@ -32,9 +33,7 @@ const SettingsManager = {
|
||||||
customLocales: {},
|
customLocales: {},
|
||||||
|
|
||||||
setBySettings(settings) {
|
setBySettings(settings) {
|
||||||
if (settings.theme) {
|
this.setTheme(settings.theme);
|
||||||
this.setTheme(settings.theme);
|
|
||||||
}
|
|
||||||
this.setFontSize(settings.fontSize);
|
this.setFontSize(settings.fontSize);
|
||||||
const locale = settings.locale;
|
const locale = settings.locale;
|
||||||
try {
|
try {
|
||||||
|
@ -46,7 +45,17 @@ const SettingsManager = {
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultTheme() {
|
||||||
|
return Features.isMac ? 'macdark' : 'fb';
|
||||||
|
},
|
||||||
|
|
||||||
setTheme(theme) {
|
setTheme(theme) {
|
||||||
|
if (!theme) {
|
||||||
|
if (this.activeTheme) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
theme = this.getDefaultTheme();
|
||||||
|
}
|
||||||
for (const cls of document.body.classList) {
|
for (const cls of document.body.classList) {
|
||||||
if (/^th-/.test(cls)) {
|
if (/^th-/.test(cls)) {
|
||||||
document.body.classList.remove(cls);
|
document.body.classList.remove(cls);
|
||||||
|
@ -57,6 +66,7 @@ const SettingsManager = {
|
||||||
if (metaThemeColor) {
|
if (metaThemeColor) {
|
||||||
metaThemeColor.content = window.getComputedStyle(document.body).backgroundColor;
|
metaThemeColor.content = window.getComputedStyle(document.body).backgroundColor;
|
||||||
}
|
}
|
||||||
|
this.activeTheme = theme;
|
||||||
},
|
},
|
||||||
|
|
||||||
getThemeClass(theme) {
|
getThemeClass(theme) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const DefaultAppSettings = {
|
const DefaultAppSettings = {
|
||||||
theme: 'fb', // UI theme
|
theme: null, // UI theme
|
||||||
locale: null, // user interface language
|
locale: null, // user interface language
|
||||||
expandGroups: true, // show entries from all subgroups
|
expandGroups: true, // show entries from all subgroups
|
||||||
listViewWidth: null, // width of the entry list representation
|
listViewWidth: null, // width of the entry list representation
|
||||||
|
|
|
@ -71,7 +71,7 @@ class SettingsGeneralView extends View {
|
||||||
|
|
||||||
super.render({
|
super.render({
|
||||||
themes: mapObject(SettingsManager.allThemes, theme => Locale[theme]),
|
themes: mapObject(SettingsManager.allThemes, theme => Locale[theme]),
|
||||||
activeTheme: AppSettingsModel.theme,
|
activeTheme: SettingsManager.activeTheme,
|
||||||
locales: SettingsManager.allLocales,
|
locales: SettingsManager.allLocales,
|
||||||
activeLocale: SettingsManager.activeLocale,
|
activeLocale: SettingsManager.activeLocale,
|
||||||
fontSize: AppSettingsModel.fontSize,
|
fontSize: AppSettingsModel.fontSize,
|
||||||
|
|
|
@ -188,7 +188,13 @@ function setSystemAppearance() {
|
||||||
perfTimestamps?.push({ name: 'setting system appearance', ts: process.hrtime() });
|
perfTimestamps?.push({ name: 'setting system appearance', ts: process.hrtime() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultTheme() {
|
||||||
|
return process.platform === 'darwin' ? 'macdark' : 'fb';
|
||||||
|
}
|
||||||
|
|
||||||
function createMainWindow() {
|
function createMainWindow() {
|
||||||
|
const theme = appSettings.theme || getDefaultTheme();
|
||||||
|
const bgColor = themeBgColors[theme] || defaultBgColor;
|
||||||
const windowOptions = {
|
const windowOptions = {
|
||||||
show: false,
|
show: false,
|
||||||
width: 1000,
|
width: 1000,
|
||||||
|
@ -196,7 +202,7 @@ function createMainWindow() {
|
||||||
minWidth: 700,
|
minWidth: 700,
|
||||||
minHeight: 400,
|
minHeight: 400,
|
||||||
titleBarStyle: appSettings.titlebarStyle,
|
titleBarStyle: appSettings.titlebarStyle,
|
||||||
backgroundColor: themeBgColors[appSettings.theme] || defaultBgColor,
|
backgroundColor: bgColor,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
backgroundThrottling: false,
|
backgroundThrottling: false,
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
|
|
@ -6,6 +6,7 @@ Release notes
|
||||||
`+` #1503: ARM64 Windows support
|
`+` #1503: ARM64 Windows support
|
||||||
`+` #1480: option to create a portable installation
|
`+` #1480: option to create a portable installation
|
||||||
`+` #1400: auto-apply tag when creating new entry in tag view
|
`+` #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
|
`+` #1342: hint that the data will be stored in unencrypted form after exporting
|
||||||
`*` #1471: WebDAV url validation, only HTTPS is allowed
|
`*` #1471: WebDAV url validation, only HTTPS is allowed
|
||||||
`+` #1350: clearing master password after auto lock period
|
`+` #1350: clearing master password after auto lock period
|
||||||
|
|
Loading…
Reference in New Issue