Add "system" theme setting for MacOS
This commit is contained in:
parent
089a232a60
commit
fd36720079
13 changed files with 174 additions and 35 deletions
|
@ -8,6 +8,14 @@
|
|||
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
function resolveTheme() {
|
||||
const theme = storage.get('theme-setting') || 'light';
|
||||
if (window.platform === 'darwin' && theme === 'system') {
|
||||
return window.systemTheme;
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
|
||||
Whisper.AppView = Backbone.View.extend({
|
||||
initialize() {
|
||||
this.inboxView = null;
|
||||
|
@ -15,14 +23,18 @@
|
|||
|
||||
this.applyTheme();
|
||||
this.applyHideMenu();
|
||||
|
||||
window.subscribeToSystemThemeChange(() => {
|
||||
this.applyTheme();
|
||||
});
|
||||
},
|
||||
events: {
|
||||
'click .openInstaller': 'openInstaller', // NetworkStatusView has this button
|
||||
openInbox: 'openInbox',
|
||||
},
|
||||
applyTheme() {
|
||||
const theme = resolveTheme();
|
||||
const iOS = storage.get('userAgent') === 'OWI';
|
||||
const theme = storage.get('theme-setting') || 'light';
|
||||
this.$el
|
||||
.removeClass('light-theme')
|
||||
.removeClass('dark-theme')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue