Add a systemPreferences API method to fetch the system ColorizationColor

This is useful for automatical app theming

* Fetches the color from the registry
* Returns an empty string if the fetch fails (a falsey value)
This commit is contained in:
Samuel Attard 2016-09-17 02:00:22 +10:00
parent b05254807b
commit 5dd5dbb3d8
No known key found for this signature in database
GPG key ID: 273DC1869D8F13EF
4 changed files with 128 additions and 10 deletions

View file

@ -9,27 +9,20 @@
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
#endif
namespace atom {
namespace api {
SystemPreferences::SystemPreferences(v8::Isolate* isolate) {
Init(isolate);
#if defined(OS_WIN)
InitializeWindow();
#endif
}
SystemPreferences::~SystemPreferences() {
}
#if defined(OS_WIN)
bool SystemPreferences::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}
#endif
#if !defined(OS_MACOSX)
bool SystemPreferences::IsDarkMode() {
return false;
@ -49,6 +42,7 @@ void SystemPreferences::BuildPrototype(
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
#if defined(OS_WIN)
.SetMethod("isAeroGlassEnabled", &SystemPreferences::IsAeroGlassEnabled)
.SetMethod("getAccentColor", &SystemPreferences::GetAccentColor)
#elif defined(OS_MACOSX)
.SetMethod("postNotification",
&SystemPreferences::PostNotification)