Commit bb950a88 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Windows dark mode: fix button typography, make exclusive with high contrast

Bug: 931359
Change-Id: Id017e32692583f81fb30709bf7d26bb6bd2d731a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1506560Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638729}
parent 6f58adaa
...@@ -35,11 +35,11 @@ constexpr char kDefaultMonospacedTypeface[] = "DejaVu Sans Mono"; ...@@ -35,11 +35,11 @@ constexpr char kDefaultMonospacedTypeface[] = "DejaVu Sans Mono";
#endif #endif
constexpr char kUnspecifiedTypeface[] = ""; constexpr char kUnspecifiedTypeface[] = "";
// If the default foreground color from the native theme isn't black, the rest // If the default foreground color from the native theme isn't black and dark
// of the Harmony spec isn't going to work. Also skip Harmony if a Windows // mode is not on the rest of the Harmony spec isn't going to work. Also skip
// High Contrast theme is enabled. One of the four standard High Contrast themes // Harmony if a Windows High Contrast theme is enabled. One of the four standard
// in Windows 10 still has black text, but (since the user wants high contrast) // High Contrast themes in Windows 10 still has black text, but (since the user
// the grey text shades in Harmony should not be used. // wants high contrast) the grey text shades in Harmony should not be used.
bool ShouldIgnoreHarmonySpec(const ui::NativeTheme& theme) { bool ShouldIgnoreHarmonySpec(const ui::NativeTheme& theme) {
// Mac provides users limited ways to customize the UI, including dark and // Mac provides users limited ways to customize the UI, including dark and
// high contrast modes; all these are addressed elsewhere, so there's no need // high contrast modes; all these are addressed elsewhere, so there's no need
...@@ -50,6 +50,8 @@ bool ShouldIgnoreHarmonySpec(const ui::NativeTheme& theme) { ...@@ -50,6 +50,8 @@ bool ShouldIgnoreHarmonySpec(const ui::NativeTheme& theme) {
#else #else
if (theme.UsesHighContrastColors()) if (theme.UsesHighContrastColors())
return true; return true;
if (theme.SystemDarkModeEnabled())
return false;
// TODO(pbos): Revisit this check. Both GG900 and black are considered // TODO(pbos): Revisit this check. Both GG900 and black are considered
// "default black" as the common theme uses GG900 as primary color. // "default black" as the common theme uses GG900 as primary color.
......
...@@ -587,6 +587,11 @@ bool NativeThemeWin::UsesHighContrastColors() const { ...@@ -587,6 +587,11 @@ bool NativeThemeWin::UsesHighContrastColors() const {
} }
bool NativeThemeWin::SystemDarkModeEnabled() const { bool NativeThemeWin::SystemDarkModeEnabled() const {
// Windows high contrast modes are entirely different themes,
// so let them take priority over dark mode.
// ...unless --force-dark-mode was specified in which case caveat emptor.
if (UsesHighContrastColors() && !NativeTheme::SystemDarkModeEnabled())
return false;
bool fDarkModeEnabled = false; bool fDarkModeEnabled = false;
if (hkcu_themes_regkey_.Valid()) { if (hkcu_themes_regkey_.Valid()) {
DWORD apps_use_light_theme = 1; DWORD apps_use_light_theme = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment