Skip to content

Commit

Permalink
Fixes text color of the download shelf buttons.
Browse files Browse the repository at this point in the history
Fixes brave/brave-browser#20210

Chromium 97 change that caused this regression:

https://chromium.googlesource.com/chromium/src/+/4f653fca62670389f2d13571d1f64ddc34b5d88c

commit 4f653fca62670389f2d13571d1f64ddc34b5d88c
Author: Allen Bauer <kylixrd@chromium.org>
Date:   Mon Oct 18 21:02:26 2021 +0000

    Remove HasCustomColor from DownloadShelfView code.

    This also pushes the calculation of the colors into the ThemeHelper. It will slightly change the themed color calculations while keeping the colors the same for non-themed cases.

    Provided ColorProvider color mapping and calculation recipes.

    Bug: 1056953
  • Loading branch information
mkarolin committed Dec 27, 2021
1 parent f528612 commit 5c145e9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions browser/themes/theme_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ absl::optional<SkColor> MaybeGetDefaultColorForBraveLightUi(int id) {
return kLightToolbarIcon;
case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE:
return color_utils::AlphaBlend(kLightToolbarIcon, kLightToolbar, 0.3f);
case ThemeProperties::COLOR_DOWNLOAD_SHELF_BUTTON_TEXT:
return gfx::kBraveGrey800; // 0x3b, 0x3e, 0x4f
case BraveThemeProperties::COLOR_ICON_BASE:
return SkColorSetRGB(0x49, 0x50, 0x57);
case BraveThemeProperties::COLOR_TOGGLE_BUTTON_THUMB_ON_COLOR:
Expand Down Expand Up @@ -148,6 +150,8 @@ absl::optional<SkColor> MaybeGetDefaultColorForBraveDarkUi(int id) {
return kDarkToolbarIcon;
case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE:
return color_utils::AlphaBlend(kDarkToolbarIcon, kDarkToolbar, 0.3f);
case ThemeProperties::COLOR_DOWNLOAD_SHELF_BUTTON_TEXT:
return SK_ColorWHITE;
case BraveThemeProperties::COLOR_ICON_BASE:
return SkColorSetRGB(0xC2, 0xC4, 0xCF);
case BraveThemeProperties::COLOR_TOGGLE_BUTTON_THUMB_ON_COLOR:
Expand Down
1 change: 1 addition & 0 deletions browser/themes/theme_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum TestProperty {
enum ThemeProperties {
BRAVE_THEME_PROPERTIES_START = 10000,
COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT = BRAVE_THEME_PROPERTIES_START,
COLOR_DOWNLOAD_SHELF_BUTTON_TEXT,
COLOR_ICON_BASE,
COLOR_TOGGLE_BUTTON_THUMB_ON_COLOR,
COLOR_TOGGLE_BUTTON_THUMB_OFF_COLOR,
Expand Down
31 changes: 31 additions & 0 deletions chromium_src/chrome/browser/ui/color/chrome_color_mixer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "chrome/browser/ui/color/chrome_color_mixer.h"

#define AddChromeColorMixer AddChromeColorMixer_ChromiumImpl
#include "src/chrome/browser/ui/color/chrome_color_mixer.cc"
#undef AddChromeColorMixer

namespace {

void AddBraveColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderManager::Key& key) {
const bool dark_mode =
key.color_mode == ui::ColorProviderManager::ColorMode::kDark;
ui::ColorMixer& mixer = provider->AddMixer();

// Download shelf colors.
mixer[kColorDownloadShelfButtonText] = {dark_mode ? SK_ColorWHITE
: gfx::kBraveGrey800};
}

} // namespace

void AddChromeColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderManager::Key& key) {
AddChromeColorMixer_ChromiumImpl(provider, key);
AddBraveColorMixer(provider, key);
}

0 comments on commit 5c145e9

Please sign in to comment.