feat: detect high contrast color mode (#15493)

* feat: add event and method to detect high contrast color mode

* docs: add docs for isHighContrastColorScheme and high-contrast-color-scheme-changed

* refactor: correct type of contrast
This commit is contained in:
Heilig Benedek 2018-10-31 15:22:18 +01:00 committed by John Kleinschmidt
parent aa6f7a5d9f
commit 6d2a088be9
4 changed files with 54 additions and 5 deletions

View file

@ -37,6 +37,12 @@ bool SystemPreferences::IsInvertedColorScheme() {
return color_utils::IsInvertedColorScheme();
}
#if !defined(OS_WIN)
bool SystemPreferences::IsHighContrastColorScheme() {
return false;
}
#endif // !defined(OS_WIN)
// static
mate::Handle<SystemPreferences> SystemPreferences::Create(
v8::Isolate* isolate) {
@ -86,6 +92,8 @@ void SystemPreferences::BuildPrototype(
#endif
.SetMethod("isInvertedColorScheme",
&SystemPreferences::IsInvertedColorScheme)
.SetMethod("isHighContrastColorScheme",
&SystemPreferences::IsHighContrastColorScheme)
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
}