Repository navigation
Support detecting inverted color scheme on Windows - #7518
Conversation
|
Should we also listen for |
Yeah, events for this would be great too, I think Chrome already has a custom listener wrapper for these, will explore. |
|
Here is the Chrome helper for these: https://cs.chromium.org/chromium/src/ui/gfx/sys_color_change_listener.h Will update this pull request to use it as well and see how it goes. |
|
Or, looking at what you just implemented we could use |
|
Ahhaha, you beat me by like 45 seconds... 😆 |
eaabd23 to
979728d
Compare
fe2ed99 to
e55d64f
Compare
Updated this pull request to emit an |
e55d64f to
214038e
Compare
|
I give this PR full marks, if you want extra credit, give a way to get the High Contrast colors by asking for COLOR_WINDOWTEXT and COLOR_WINDOW colors, https://msdn.microsoft.com/en-us/library/dd318443(vs.85).aspx has some more info |
Would these be the Looks like that is what Chrome uses to detect high contrast colors: https://cs.chromium.org/chromium/src/ui/gfx/sys_color_change_listener.cc?l=25 |
|
@kevinsawicki Yeah, fixed my typo |
Awesome, yeah, that sounds good 👍 |
|
|
||
| namespace api { | ||
|
|
||
| class SystemPreferencesColorChangeListener |
There was a problem hiding this comment.
SystemPreferences can inherit gfx::SysColorChangeListener directly.
|
|
||
| bool invertered_color_scheme_ = false; | ||
|
|
||
| std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_; |
There was a problem hiding this comment.
Since color_change_listener_ is initialized in constructor, there is no need to put gfx::ScopedSysColorChangeListener in a unique_ptr.
|
|
||
| std::string current_color_; | ||
|
|
||
| bool invertered_color_scheme_ = false; |
There was a problem hiding this comment.
invertered_color_scheme_ should be initialized with IsInvertedColorScheme().
b1c08a6 to
c7b9e51
Compare
After thinking about this a bit more, I'd like to do this in a separate PR that adds something like |
c7b9e51 to
38281f3
Compare
|
👍 |
This API allows app's to determine if a high contrast theme is active on Windows in case they want to adjust their styles at startup or when the value is changed.
Chrome currently uses this API to show a popover about installing a dark theme and high contrast extension.
isInvertedColorSchemehelperinverted-color-scheme-changedevent for when the theme/colors switched into and out of an inverted color scheme.Closes #7469