Commit 36b6211a authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Use a single native theme color ID for menu item alerts.

This makes it clearer (everywhere) that the animation is simply animating the
alpha value of a single alert color.

Bug: none
Change-Id: Iad30d326dd3af811cc0e065d10ef637d32e5a94b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914963
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715100}
parent 6558626b
......@@ -125,8 +125,7 @@ SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) {
// Fallback to the same colors as Aura.
case ui::NativeTheme::kColorId_HighlightedMenuItemBackgroundColor:
case ui::NativeTheme::kColorId_HighlightedMenuItemForegroundColor:
case ui::NativeTheme::kColorId_MenuItemAlertBackgroundColorMax:
case ui::NativeTheme::kColorId_MenuItemAlertBackgroundColorMin:
case ui::NativeTheme::kColorId_MenuItemAlertBackgroundColor:
return ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor(
color_id);
......
......@@ -89,10 +89,8 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
0.04f);
case NativeTheme::kColorId_HighlightedMenuItemBackgroundColor:
return SkColorSetRGB(0x32, 0x36, 0x39);
case NativeTheme::kColorId_MenuItemAlertBackgroundColorMax:
return SkColorSetA(gfx::kGoogleGrey100, 0x1A);
case NativeTheme::kColorId_MenuItemAlertBackgroundColorMin:
return SkColorSetA(gfx::kGoogleGrey100, 0x4D);
case NativeTheme::kColorId_MenuItemAlertBackgroundColor:
return gfx::kGoogleGrey100;
// Label
case NativeTheme::kColorId_LabelEnabledColor:
......@@ -231,10 +229,8 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
return gfx::kGoogleGrey050;
case NativeTheme::kColorId_HighlightedMenuItemForegroundColor:
return kPrimaryTextColor;
case NativeTheme::kColorId_MenuItemAlertBackgroundColorMax:
return SkColorSetA(gfx::kGoogleBlue600, 0x1A);
case NativeTheme::kColorId_MenuItemAlertBackgroundColorMin:
return SkColorSetA(gfx::kGoogleBlue600, 0x4D);
case NativeTheme::kColorId_MenuItemAlertBackgroundColor:
return gfx::kGoogleBlue600;
// Label
case NativeTheme::kColorId_LabelEnabledColor:
......
......@@ -345,10 +345,7 @@ class NATIVE_THEME_EXPORT NativeTheme {
kColorId_MenuBorderColor,
kColorId_HighlightedMenuItemBackgroundColor,
kColorId_HighlightedMenuItemForegroundColor,
kColorId_MenuItemAlertBackgroundColorMax, // Animation color at max
// intensity
kColorId_MenuItemAlertBackgroundColorMin, // Animation color at min
// intensity
kColorId_MenuItemAlertBackgroundColor,
// Label
kColorId_LabelEnabledColor,
kColorId_LabelDisabledColor,
......
......@@ -1044,14 +1044,10 @@ void MenuItemView::PaintBackground(gfx::Canvas* canvas,
: ui::NativeTheme::kColorId_HighlightedMenuItemBackgroundColor;
color = GetNativeTheme()->GetSystemColor(color_id);
} else {
const SkColor color_max = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_MenuItemAlertBackgroundColorMax);
const SkColor color_min = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_MenuItemAlertBackgroundColorMin);
color = color_utils::AlphaBlend(
color_max, color_min,
static_cast<float>(
GetMenuController()->GetAlertAnimation()->GetCurrentValue()));
color = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_MenuItemAlertBackgroundColor);
const auto* animation = GetMenuController()->GetAlertAnimation();
color = SkColorSetA(color, animation->CurrentValueBetween(0x4D, 0x1A));
}
DCHECK_NE(color, gfx::kPlaceholderColor);
......
......@@ -107,9 +107,7 @@ std::unique_ptr<View> CreateAllColorsView() {
InsertColorRow(layout,
COLOR_LABEL_ARGS(kColorId_HighlightedMenuItemForegroundColor));
InsertColorRow(layout,
COLOR_LABEL_ARGS(kColorId_MenuItemAlertBackgroundColorMax));
InsertColorRow(layout,
COLOR_LABEL_ARGS(kColorId_MenuItemAlertBackgroundColorMin));
COLOR_LABEL_ARGS(kColorId_MenuItemAlertBackgroundColor));
InsertColorRow(layout, COLOR_LABEL_ARGS(kColorId_LabelEnabledColor));
InsertColorRow(layout, COLOR_LABEL_ARGS(kColorId_LabelDisabledColor));
InsertColorRow(layout, COLOR_LABEL_ARGS(kColorId_LabelTextSelectionColor));
......
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