2018-11-08 00:16:47 +00:00
# Mojave Dark Mode
In macOS 10.14 Mojave, Apple introduced a new [system-wide dark mode ](https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/ )
2019-07-15 08:23:12 +00:00
for all macOS computers. If your app does have a dark mode, you can make your Electron app
2020-01-31 05:49:48 +00:00
follow the system-wide dark mode setting using [the nativeTheme api ](../api/native-theme.md ).
2018-11-08 00:16:47 +00:00
2019-07-15 08:23:12 +00:00
In macOS 10.15 Catalina, Apple introduced a new "automatic" dark mode option for all macOS computers. In order
2020-01-31 05:49:48 +00:00
for the `nativeTheme.shouldUseDarkColors` and `Tray` APIs to work correctly in this mode on Catalina you need to either have `NSRequiresAquaSystemAppearance` set to `false` in your `Info.plist` file or be on Electron `>=7.0.0` .
2018-11-08 00:16:47 +00:00
## Automatically updating the native interfaces
"Native Interfaces" include the file picker, window border, dialogs, context menus and more; basically anything where
2019-07-15 08:23:12 +00:00
the UI comes from macOS and not your app. The default behavior as of Electron 7.0.0 is to opt in to this automatic
theming from the OS. If you wish to opt out you must set the `NSRequiresAquaSystemAppearance` key in the `Info.plist` file
2019-07-24 17:20:25 +00:00
to `true` . Please note that once Electron starts building against the 10.14 SDK it will not be possible for you to opt
2019-07-15 08:23:12 +00:00
out of this theming.
2018-12-01 01:02:36 +00:00
2018-11-08 00:16:47 +00:00
## Automatically updating your own interfaces
If your app has its own dark mode you should toggle it on and off in sync with the system's dark mode setting. You can do
2020-01-31 05:49:48 +00:00
this by listening for the theme updated event on Electron's `nativeTheme` module. E.g.
2018-11-08 00:16:47 +00:00
```js
2019-12-17 23:13:35 +00:00
const { nativeTheme } = require('electron')
2018-11-08 00:16:47 +00:00
2020-01-31 05:49:48 +00:00
nativeTheme.on('updated', function theThemeHasChanged () {
updateMyAppTheme(nativeTheme.shouldUseDarkColors)
})
2018-11-08 00:16:47 +00:00
```