Commit 0f9a46f9 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Set frame and active_tab color same for non-tabbed apps

Non-tabbed apps (such as settings) now have the same
themepack color for frame and active_tab.  Previousley,
autogenerated theme pack colors always force these colors
to have some contrast.  In the case of settings, the contrast
color is light grey, and it is the color used for
NTP_BACKGROUND (bg shown until page loads).  Given that there
is no need for frame/active_tab contrast for a non-tabbed app,
it is better to have them both the same color.

Bug: 1053823
Bug: 1059696
Change-Id: Iaf2e6cbf6f3db9fe2c1d98c32692e3e74e8a7ef3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094484
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748429}
parent b3e4b447
...@@ -405,30 +405,31 @@ void AppBrowserController::UpdateThemePack() { ...@@ -405,30 +405,31 @@ void AppBrowserController::UpdateThemePack() {
} }
theme_pack_ = base::MakeRefCounted<BrowserThemePack>( theme_pack_ = base::MakeRefCounted<BrowserThemePack>(
CustomThemeSupplier::AUTOGENERATED); CustomThemeSupplier::AUTOGENERATED);
// AutogeneratedThemeColors will generally make the frame color match the
// theme color, but often adjusts it.
// We will use a similar approach to generate a main color and alt color
// with a 1.6 contrast. If we have tabs, we use the theme for tabs, else
// we use the theme for the frame.
AutogeneratedThemeColors colors; AutogeneratedThemeColors colors;
SkColor theme_text_color = color_utils::GetColorWithMaxContrast(*theme_color); SkColor theme_text_color = color_utils::GetColorWithMaxContrast(*theme_color);
SkColor alt_color = color_utils::BlendForMinContrast(
*theme_color, *theme_color, base::nullopt,
kAutogeneratedThemeActiveTabPreferredContrast)
.color;
SkColor alt_text_color = color_utils::GetColorWithMaxContrast(alt_color);
if (has_tab_strip_) { if (has_tab_strip_) {
// AutogeneratedThemeColors will generally make the frame color match the
// theme color, but often adjusts it.
// We will use a similar approach to generate a main color and alt color
// with a 1.6 contrast ensuring that the active tab is exactly the theme.
colors.active_tab_color = *theme_color; colors.active_tab_color = *theme_color;
colors.active_tab_text_color = theme_text_color; colors.active_tab_text_color = theme_text_color;
colors.frame_color = alt_color; colors.frame_color = color_utils::BlendForMinContrast(
colors.frame_text_color = alt_text_color; *theme_color, *theme_color, base::nullopt,
kAutogeneratedThemeActiveTabPreferredContrast)
.color;
colors.frame_text_color =
color_utils::GetColorWithMaxContrast(colors.frame_color);
} else { } else {
// Tab colors are used for tooltips. // Set frame and active_tab to the same color when there are no tabs.
// TODO(crbug.com/1053823): Add tests for theme properties being set in this branch. // Tab colors are used for tooltips and NTP background (bg shown until page
// loads).
// TODO(crbug.com/1053823): Add tests for theme properties being set in this
// branch.
colors.frame_color = *theme_color; colors.frame_color = *theme_color;
colors.frame_text_color = theme_text_color; colors.frame_text_color = theme_text_color;
colors.active_tab_color = alt_color; colors.active_tab_color = *theme_color;
colors.active_tab_text_color = alt_text_color; colors.active_tab_text_color = theme_text_color;
} }
BrowserThemePack::BuildFromColors(colors, theme_pack_.get()); BrowserThemePack::BuildFromColors(colors, theme_pack_.get());
} }
......
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