feat: support systemPreferences.isDarkMode()
on Windows (#19217)
* add support for isDarkMode on Windows * use NativeTheme for darkmode detection
This commit is contained in:
parent
4439249617
commit
da672a3b5c
2 changed files with 3 additions and 2 deletions
|
@ -43,7 +43,7 @@ Returns:
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
### `systemPreferences.isDarkMode()` _macOS_
|
### `systemPreferences.isDarkMode()` _macOS_ _Windows_
|
||||||
|
|
||||||
Returns `Boolean` - Whether the system is in Dark Mode.
|
Returns `Boolean` - Whether the system is in Dark Mode.
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "shell/common/node_includes.h"
|
#include "shell/common/node_includes.h"
|
||||||
#include "ui/gfx/animation/animation.h"
|
#include "ui/gfx/animation/animation.h"
|
||||||
#include "ui/gfx/color_utils.h"
|
#include "ui/gfx/color_utils.h"
|
||||||
|
#include "ui/native_theme/native_theme.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ SystemPreferences::~SystemPreferences() {
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
bool SystemPreferences::IsDarkMode() {
|
bool SystemPreferences::IsDarkMode() {
|
||||||
return false;
|
return ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue