From cc8bf1235179dd33edb29b335b3646448b652143 Mon Sep 17 00:00:00 2001 From: liulun Date: Wed, 18 Dec 2019 07:13:35 +0800 Subject: [PATCH] docs: replace systemPreferences.isDarkMode() with nativeTheme.shouldUseDarkColors (#21480) --- docs/tutorial/mojave-dark-mode-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/mojave-dark-mode-guide.md b/docs/tutorial/mojave-dark-mode-guide.md index c1ca37c0cf5d..bc48a0847d75 100644 --- a/docs/tutorial/mojave-dark-mode-guide.md +++ b/docs/tutorial/mojave-dark-mode-guide.md @@ -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. ```js -const { systemPreferences } = require('electron') +const { nativeTheme } = require('electron') systemPreferences.subscribeNotification( 'AppleInterfaceThemeChangedNotification', function theThemeHasChanged () { - updateMyAppTheme(systemPreferences.isDarkMode()) + updateMyAppTheme(nativeTheme.shouldUseDarkColors) } ) ```