From e8ae475b43a9dcc94b3619b0a786d73451e1a387 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Mon, 10 Jun 2024 13:02:22 +0900 Subject: [PATCH] Update update alert color from app menu for light theme fix https://github.com/brave/brave-browser/issues/38899 --- browser/ui/color/brave_color_mixer.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/browser/ui/color/brave_color_mixer.cc b/browser/ui/color/brave_color_mixer.cc index ec5738942fa6..51803b55ec40 100644 --- a/browser/ui/color/brave_color_mixer.cc +++ b/browser/ui/color/brave_color_mixer.cc @@ -457,16 +457,28 @@ void AddBravifiedChromeThemeColorMixer(ui::ColorProvider* provider, ui::kColorAlertLowSeverity, kColorToolbar); mixer[kColorAppMenuHighlightSeverityHigh] = { kColorAvatarButtonHighlightSyncError}; - mixer[kColorAppMenuHighlightSeverityMedium] = AdjustHighlightColorForContrast( - ui::kColorAlertMediumSeverityIcon, kColorToolbar); + + const bool is_dark = key.color_mode == ui::ColorProviderKey::ColorMode::kDark; + + // For dark, AdjustHighlightColorForContrast() gives proper colors but + // not for others. Instead, pick the contrast color for them. + if (key.custom_theme || !is_dark) { + mixer[kColorAppMenuHighlightSeverityMedium] = { + PickColorContrastingToToolbar(key, mixer, + SkColorSetRGB(0xBB, 0x88, 0x00), + SkColorSetRGB(0xE2, 0xA5, 0x00))}; + } else { + mixer[kColorAppMenuHighlightSeverityMedium] = + AdjustHighlightColorForContrast(ui::kColorAlertMediumSeverityIcon, + kColorToolbar); + } if (key.custom_theme) { return; } - key.color_mode == ui::ColorProviderKey::ColorMode::kDark - ? AddChromeDarkThemeColorMixer(provider, key) - : AddChromeLightThemeColorMixer(provider, key); + is_dark ? AddChromeDarkThemeColorMixer(provider, key) + : AddChromeLightThemeColorMixer(provider, key); } void AddBraveLightThemeColorMixer(ui::ColorProvider* provider,