Commit 65e6f9e6 authored by Tommy Steimel's avatar Tommy Steimel Committed by Commit Bot

GMC: Update minimum contrast ratio

This CL updates the Global Media Controls dialog to use 7 as the
minimum contrast ratio between the foreground and background colors
instead of using the default of 4.5.

Bug: 1049242
Change-Id: I81538040993cdd555cd1e6173554b9021018d18e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2039894
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738688}
parent 3f2dc544
...@@ -35,6 +35,8 @@ constexpr double kMediaNotificationForegroundColorMostPopularMinSaturation = ...@@ -35,6 +35,8 @@ constexpr double kMediaNotificationForegroundColorMostPopularMinSaturation =
// The ratio for the more vibrant foreground color to use. // The ratio for the more vibrant foreground color to use.
constexpr double kMediaNotificationForegroundColorMoreVibrantRatio = 1.0; constexpr double kMediaNotificationForegroundColorMoreVibrantRatio = 1.0;
constexpr float kMediaNotificationMinimumContrastRatio = 7.0;
bool IsNearlyWhiteOrBlack(SkColor color) { bool IsNearlyWhiteOrBlack(SkColor color) {
color_utils::HSL hsl; color_utils::HSL hsl;
color_utils::SkColorToHSL(color, &hsl); color_utils::SkColorToHSL(color, &hsl);
...@@ -356,7 +358,9 @@ SkColor MediaNotificationBackground::GetForegroundColor( ...@@ -356,7 +358,9 @@ SkColor MediaNotificationBackground::GetForegroundColor(
? *foreground_color_ ? *foreground_color_
: views::style::GetColor(owner, views::style::CONTEXT_LABEL, : views::style::GetColor(owner, views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY); views::style::STYLE_PRIMARY);
return color_utils::BlendForMinContrast(foreground, GetBackgroundColor(owner)) return color_utils::BlendForMinContrast(
foreground, GetBackgroundColor(owner), base::nullopt,
kMediaNotificationMinimumContrastRatio)
.color; .color;
} }
......
...@@ -817,7 +817,7 @@ TEST_F(MAYBE_MediaNotificationViewImplTest, UpdateArtworkFromItem) { ...@@ -817,7 +817,7 @@ TEST_F(MAYBE_MediaNotificationViewImplTest, UpdateArtworkFromItem) {
SkBitmap image; SkBitmap image;
image.allocN32Pixels(10, 10); image.allocN32Pixels(10, 10);
image.eraseColor(SK_ColorMAGENTA); image.eraseColor(SK_ColorGREEN);
EXPECT_TRUE(GetArtworkImage().isNull()); EXPECT_TRUE(GetArtworkImage().isNull());
......
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