Commit 0728316a authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Significantly increase contrast for inactive tabs

This changes tab text color from ~GG200 and GG700 to white and GG800
which makes inactive tabs in both incognito and default theme easier to
read. It's especially important for themed-frame windows though where
very light grey on white provided significantly worse contrast.

This also increases tab-separator opacity to better match the increased
contrast.

Bug: chromium:855091
Change-Id: I0ec7208d6b1158e4abbb361acd119d3a48020f10
Reviewed-on: https://chromium-review.googlesource.com/1109271
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569343}
parent 4cff45c0
...@@ -104,8 +104,11 @@ SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { ...@@ -104,8 +104,11 @@ SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const {
SkColor BrowserNonClientFrameView::GetTabSeparatorColor() const { SkColor BrowserNonClientFrameView::GetTabSeparatorColor() const {
DCHECK(MD::IsRefreshUi()); DCHECK(MD::IsRefreshUi());
constexpr SkAlpha kTabSeparatorAlpha = 0x59; // 35% constexpr SkAlpha kTabSeparatorAlpha = 0x6E; // 43%
return GetContrastingColorAgainstFrame(kTabSeparatorAlpha); const SkColor frame_color = GetFrameColor();
const SkColor base_color =
color_utils::BlendTowardOppositeLuma(frame_color, SK_AlphaOPAQUE);
return color_utils::AlphaBlend(base_color, frame_color, kTabSeparatorAlpha);
} }
SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const { SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const {
...@@ -118,8 +121,11 @@ SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const { ...@@ -118,8 +121,11 @@ SkColor BrowserNonClientFrameView::GetTabBackgroundColor(TabState state) const {
} }
SkColor BrowserNonClientFrameView::GetTabForegroundColor(TabState state) const { SkColor BrowserNonClientFrameView::GetTabForegroundColor(TabState state) const {
if (MD::IsRefreshUi() && state == TAB_INACTIVE && ShouldPaintAsThemed()) if (MD::IsRefreshUi() && state == TAB_INACTIVE && ShouldPaintAsThemed()) {
return GetContrastingColorAgainstFrame(gfx::kGoogleGreyAlpha700); return color_utils::IsDark(GetFrameColor()) ? SK_ColorWHITE
: gfx::kGoogleGrey800;
}
const auto color_id = state == TAB_ACTIVE const auto color_id = state == TAB_ACTIVE
? ThemeProperties::COLOR_TAB_TEXT ? ThemeProperties::COLOR_TAB_TEXT
: ThemeProperties::COLOR_BACKGROUND_TAB_TEXT; : ThemeProperties::COLOR_BACKGROUND_TAB_TEXT;
...@@ -552,11 +558,3 @@ SkColor BrowserNonClientFrameView::GetThemeOrDefaultColor(int color_id) const { ...@@ -552,11 +558,3 @@ SkColor BrowserNonClientFrameView::GetThemeOrDefaultColor(int color_id) const {
: ThemeProperties::GetDefaultColor( : ThemeProperties::GetDefaultColor(
color_id, browser_view_->IsIncognito()); color_id, browser_view_->IsIncognito());
} }
SkColor BrowserNonClientFrameView::GetContrastingColorAgainstFrame(
SkAlpha alpha) const {
const SkColor frame_color = GetFrameColor();
const SkColor base_color =
color_utils::BlendTowardOppositeLuma(frame_color, SK_AlphaOPAQUE);
return color_utils::AlphaBlend(base_color, frame_color, alpha);
}
...@@ -189,9 +189,6 @@ class BrowserNonClientFrameView : public views::NonClientFrameView, ...@@ -189,9 +189,6 @@ class BrowserNonClientFrameView : public views::NonClientFrameView,
// default theme properties. // default theme properties.
SkColor GetThemeOrDefaultColor(int color_id) const; SkColor GetThemeOrDefaultColor(int color_id) const;
// Returns a color that contrasts well with the frame.
SkColor GetContrastingColorAgainstFrame(SkAlpha alpha) const;
// The frame that hosts this view. // The frame that hosts this view.
BrowserFrame* frame_; BrowserFrame* frame_;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "third_party/skia/include/pathops/SkPathOps.h" #include "third_party/skia/include/pathops/SkPathOps.h"
#include "ui/base/default_theme_provider.h" #include "ui/base/default_theme_provider.h"
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/scoped_canvas.h" #include "ui/gfx/scoped_canvas.h"
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
#include "ui/views/animation/ink_drop_impl.h" #include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_mask.h" #include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#include "ui/gfx/win/hwnd_util.h" #include "ui/gfx/win/hwnd_util.h"
...@@ -518,7 +518,10 @@ SkColor NewTabButton::GetButtonFillColor() const { ...@@ -518,7 +518,10 @@ SkColor NewTabButton::GetButtonFillColor() const {
void NewTabButton::InitButtonIcons() { void NewTabButton::InitButtonIcons() {
DCHECK(MD::IsNewerMaterialUi()); DCHECK(MD::IsNewerMaterialUi());
const SkColor icon_color = tab_strip_->GetTabForegroundColor(TAB_INACTIVE); const SkColor icon_color =
color_utils::IsDark(tab_strip_->GetTabForegroundColor(TAB_INACTIVE))
? gfx::kChromeIconGrey
: SK_ColorWHITE;
// TODO(b/851041): is there a better source for these icon sizes? // TODO(b/851041): is there a better source for these icon sizes?
const int size = MD::IsTouchOptimizedUiEnabled() ? 14 : 12; const int size = MD::IsTouchOptimizedUiEnabled() ? 14 : 12;
plus_icon_ = gfx::CreateVectorIcon(kNewTabButtonPlusIcon, size, icon_color); plus_icon_ = gfx::CreateVectorIcon(kNewTabButtonPlusIcon, size, icon_color);
......
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