Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detect high contrast color mode #15493

Merged
merged 3 commits into from Oct 31, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

refactor: correct type of contrast

  • Loading branch information...
brenca committed Oct 31, 2018
commit aef4baadd2f73f2794d325fc30b54ee730ce4960
@@ -38,7 +38,7 @@ bool SystemPreferences::IsInvertedColorScheme() {
}

#if !defined(OS_WIN)
bool SystemPreferences::IsHighContractColorScheme() {
bool SystemPreferences::IsHighContrastColorScheme() {
return false;
}
#endif // !defined(OS_WIN)
@@ -93,7 +93,7 @@ void SystemPreferences::BuildPrototype(
.SetMethod("isInvertedColorScheme",
&SystemPreferences::IsInvertedColorScheme)
.SetMethod("isHighContrastColorScheme",
&SystemPreferences::IsHighContractColorScheme)
&SystemPreferences::IsHighContrastColorScheme)
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
}

@@ -98,7 +98,7 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
#endif
bool IsDarkMode();
bool IsInvertedColorScheme();
bool IsHighContractColorScheme();
bool IsHighContrastColorScheme();

protected:
explicit SystemPreferences(v8::Isolate* isolate);
@@ -40,7 +40,7 @@ bool SystemPreferences::IsAeroGlassEnabled() {
return ui::win::IsAeroGlassEnabled();
}

bool SystemPreferences::IsHighContractColorScheme() {
bool SystemPreferences::IsHighContrastColorScheme() {
if (!g_is_high_contract_color_scheme_initialized)
UpdateHighContrastColorScheme();
return g_is_high_contract_color_scheme;
@@ -137,7 +137,7 @@ std::string SystemPreferences::GetColor(const std::string& color,

void SystemPreferences::InitializeWindow() {
invertered_color_scheme_ = IsInvertedColorScheme();
high_contrast_color_scheme_ = IsHighContractColorScheme();
high_contrast_color_scheme_ = IsHighContrastColorScheme();

// Wait until app is ready before creating sys color listener
// Creating this listener before the app is ready causes global shortcuts
@@ -202,7 +202,7 @@ void SystemPreferences::OnSysColorChange() {
Emit("inverted-color-scheme-changed", new_invertered_color_scheme);
}

bool new_high_contrast_color_scheme = IsHighContractColorScheme();
bool new_high_contrast_color_scheme = IsHighContrastColorScheme();
if (new_high_contrast_color_scheme != high_contrast_color_scheme_) {
high_contrast_color_scheme_ = new_high_contrast_color_scheme;
Emit("high-contrast-color-scheme-changed", new_high_contrast_color_scheme);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.