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

@ -32,8 +32,14 @@ Returns:
Returns:
* `event` Event
* `invertedColorScheme` Boolean - `true` if an inverted color scheme, such as
a high contrast theme, is being used, `false` otherwise.
* `invertedColorScheme` Boolean - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, `false` otherwise.
### Event: 'high-contrast-color-scheme-changed' _Windows_
Returns:
* `event` Event
* `highContrastColorScheme` Boolean - `true` if a high contrast theme is being used, `false` otherwise.
### Event: 'appearance-changed' _macOS_
@ -276,12 +282,15 @@ const alpha = color.substr(6, 2) // "dd"
Returns `String` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
See the [Windows docs][windows-colors] for more details.
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
### `systemPreferences.isInvertedColorScheme()` _Windows_
Returns `Boolean` - `true` if an inverted color scheme, such as a high contrast
theme, is active, `false` otherwise.
Returns `Boolean` - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, `false` otherwise.
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
### `systemPreferences.isHighContrastColorScheme()` _Windows_
Returns `Boolean` - `true` if a high contrast theme is active, `false` otherwise.
### `systemPreferences.getEffectiveAppearance()` _macOS_