Skip to content

Commit

Permalink
Add inverted colour scheme listener for Windows, closes #77
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanlesage committed Apr 13, 2019
1 parent 60163bf commit 57a1060
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

## GUI and Functionality

- **New Feature**: Zettlr can now automatically switch between light and dark mode either based on a fixed schedule or, if you are using macOS, based on the appearance of the operating system.
- **New Feature**: Zettlr can now automatically switch between light and dark mode either based on a fixed schedule or, if you are using macOS or Windows, based on the appearance of the operating system.
- **New Feature**: Add words to the user defined dictionary.
- Display contributors tab on the about dialog containing the names of all authors of the translation files.
- The dictionary loading mechanism works far more reliably now.
Expand Down
8 changes: 8 additions & 0 deletions source/main/providers/appearance-provider.js
Expand Up @@ -53,6 +53,14 @@ class AppearanceProvider extends EventEmitter {
// Set the var accordingly
global.config.set('darkTheme', systemPreferences.isDarkMode())
})
} else if (process.platform === 'win32') {
// On Windows, we achieve the same effect by listening for inverted colour
// scheme changes.
systemPreferences.on('inverted-color-scheme-changed', (event, invertedColorScheme) => {
if (this._mode !== 'system') return
// Also set the var accordingly
global.config.set('darkTheme', invertedColorScheme)
})
}

// Subscribe to configuration updates
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/dialog/preferences.js
Expand Up @@ -36,7 +36,7 @@ class PreferencesDialog extends ZettlrDialog {
data.attachmentExtensions = data.attachmentExtensions.join(', ')

// Determine the ability of the OS to switch to dark mode
data.hasOSDarkMode = (process.platform === 'darwin')
data.hasOSDarkMode = ['darwin', 'win32'].includes(process.platform)
return data
}

Expand Down

0 comments on commit 57a1060

Please sign in to comment.