docs: replace systemPreferences.isDarkMode() with nativeTheme.shouldUseDarkColors (#21480)
This commit is contained in:
parent
f0d52eaf0c
commit
cc8bf12351
1 changed files with 2 additions and 2 deletions
|
@ -21,12 +21,12 @@ If your app has its own dark mode you should toggle it on and off in sync with t
|
||||||
this by listening for the theme changed event on Electron's `systemPreferences` module. E.g.
|
this by listening for the theme changed event on Electron's `systemPreferences` module. E.g.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { systemPreferences } = require('electron')
|
const { nativeTheme } = require('electron')
|
||||||
|
|
||||||
systemPreferences.subscribeNotification(
|
systemPreferences.subscribeNotification(
|
||||||
'AppleInterfaceThemeChangedNotification',
|
'AppleInterfaceThemeChangedNotification',
|
||||||
function theThemeHasChanged () {
|
function theThemeHasChanged () {
|
||||||
updateMyAppTheme(systemPreferences.isDarkMode())
|
updateMyAppTheme(nativeTheme.shouldUseDarkColors)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue