Commit eba855f2 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Try to improve toolbar separator coloration for themed browser windows.

Particularly noticeable for dark themes.

Bug: 628312
Change-Id: I16dd1634a063202c6ea1d640a1d80e5c35e8fe56
Reviewed-on: https://chromium-review.googlesource.com/534833
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#480275}
parent 917d8817
...@@ -90,9 +90,8 @@ constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; ...@@ -90,9 +90,8 @@ constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75};
// Defaults for properties which are not stored in the browser theme pack. // Defaults for properties which are not stored in the browser theme pack.
constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE; constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE;
const SkColor kDefaultDetachedBookmarkBarSeparator = const SkColor kDefaultToolbarBottomSeparator = SkColorSetRGB(0xB6, 0xB4, 0xB6);
SkColorSetRGB(0xB6, 0xB4, 0xB6); const SkColor kDefaultToolbarBottomSeparatorIncognito =
const SkColor kDefaultDetachedBookmarkBarSeparatorIncognito =
SkColorSetRGB(0x28, 0x28, 0x28); SkColorSetRGB(0x28, 0x28, 0x28);
const SkColor kDefaultToolbarTopSeparator = SkColorSetA(SK_ColorBLACK, 0x40); const SkColor kDefaultToolbarTopSeparator = SkColorSetA(SK_ColorBLACK, 0x40);
...@@ -262,13 +261,17 @@ SkColor ThemeProperties::GetDefaultColor(int id, bool incognito) { ...@@ -262,13 +261,17 @@ SkColor ThemeProperties::GetDefaultColor(int id, bool incognito) {
case COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT: case COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT:
return incognito ? kDefaultColorBookmarkInstructionsTextIncognito return incognito ? kDefaultColorBookmarkInstructionsTextIncognito
: kDefaultColorBookmarkInstructionsText; : kDefaultColorBookmarkInstructionsText;
case COLOR_TOOLBAR_BOTTOM_SEPARATOR:
case COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR: case COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR:
return incognito ? kDefaultDetachedBookmarkBarSeparatorIncognito // We shouldn't reach this case because the color is calculated from
: kDefaultDetachedBookmarkBarSeparator; // others.
NOTREACHED();
return gfx::kPlaceholderColor;
case COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND: case COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND:
return incognito ? kDefaultDetachedBookmarkBarBackgroundIncognito return incognito ? kDefaultDetachedBookmarkBarBackgroundIncognito
: kDefaultDetachedBookmarkBarBackground; : kDefaultDetachedBookmarkBarBackground;
case COLOR_TOOLBAR_BOTTOM_SEPARATOR:
return incognito ? kDefaultToolbarBottomSeparatorIncognito
: kDefaultToolbarBottomSeparator;
case COLOR_TOOLBAR_TOP_SEPARATOR: case COLOR_TOOLBAR_TOP_SEPARATOR:
case COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE: case COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE:
return kDefaultToolbarTopSeparator; return kDefaultToolbarTopSeparator;
......
...@@ -472,16 +472,18 @@ SkColor ThemeService::GetDefaultColor(int id, bool incognito) const { ...@@ -472,16 +472,18 @@ SkColor ThemeService::GetDefaultColor(int id, bool incognito) const {
if (UsingDefaultTheme()) if (UsingDefaultTheme())
break; break;
return GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito); return GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito);
case ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR:
if (UsingDefaultTheme())
break;
return GetColor(ThemeProperties::COLOR_LOCATION_BAR_BORDER, incognito);
case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND: case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND:
if (UsingDefaultTheme()) if (UsingDefaultTheme())
break; break;
return GetColor(ThemeProperties::COLOR_TOOLBAR, incognito); return GetColor(ThemeProperties::COLOR_TOOLBAR, incognito);
case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR: case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR:
if (UsingDefaultTheme()) // Use a faint version of the text color as the separator color.
break;
// Use 50% of bookmark text color as separator color.
return SkColorSetA( return SkColorSetA(
GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito), 128); GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito), 0x20);
case ThemeProperties::COLOR_NTP_TEXT_LIGHT: case ThemeProperties::COLOR_NTP_TEXT_LIGHT:
return IncreaseLightness(GetColor(kNtpText, incognito), 0.40); return IncreaseLightness(GetColor(kNtpText, incognito), 0.40);
case ThemeProperties::COLOR_TAB_THROBBER_SPINNING: case ThemeProperties::COLOR_TAB_THROBBER_SPINNING:
......
...@@ -896,8 +896,6 @@ void GtkUi::LoadGtkValues() { ...@@ -896,8 +896,6 @@ void GtkUi::LoadGtkValues() {
colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = tab_border; colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = tab_border;
// Separates entries in the downloads bar. // Separates entries in the downloads bar.
colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = tab_border; colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = tab_border;
// Separates the bookmark bar from the web content.
colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = tab_border;
// These colors represent the border drawn around tabs and between // These colors represent the border drawn around tabs and between
// the tabstrip and toolbar. // the tabstrip and toolbar.
......
...@@ -207,18 +207,10 @@ void PaintDetachedBookmarkBar(gfx::Canvas* canvas, ...@@ -207,18 +207,10 @@ void PaintDetachedBookmarkBar(gfx::Canvas* canvas,
fill_rect, fill_rect,
tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND));
// Draw the separators above and below bookmark bar; // Draw the separator below the detached bookmark bar.
// if animating, these are fading in/out.
SkColor separator_color =
tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR);
// For the bottom separator, increase the luminance. Either double it or halve
// the distance to 1.0, whichever is less of a difference.
color_utils::HSL hsl;
color_utils::SkColorToHSL(separator_color, &hsl);
hsl.l = std::min((hsl.l + 1) / 2, hsl.l * 2);
BrowserView::Paint1pxHorizontalLine( BrowserView::Paint1pxHorizontalLine(
canvas, color_utils::HSLToSkColor(hsl, SK_AlphaOPAQUE), canvas,
tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR),
view->GetLocalBounds(), true); view->GetLocalBounds(), true);
} }
......
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