Commit cecbee74 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix PWA theme colors for download shelf

Screen shots in crbug.com/1103558.

WebApp themes now match how custom themes are treated by checking
ThemeProvider::HasCustomColor rather than
ThemeService::UsingDefaultTheme which doesn't indicate when a PWA
is in use as has set a custom theme.

Default theme text color changed to use default MD blue.

Bug: 1103558
Change-Id: I7d527f89f577374bed028644b4e79f40ec0c77de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2306490
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790589}
parent 9a66d347
......@@ -291,18 +291,21 @@ void DownloadShelfView::RemoveDownloadView(View* view) {
}
void DownloadShelfView::ConfigureButtonForTheme(views::MdTextButton* button) {
DCHECK(GetThemeProvider());
const auto* const tp = GetThemeProvider();
DCHECK(tp);
button->SetEnabledTextColors(
GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT));
// For the normal theme, just use the default button bg color.
// If COLOR_DOWNLOAD_SHELF is not customized, just use the default button bg
// and text colors.
base::Optional<SkColor> bg_color;
if (!ThemeServiceFactory::GetForProfile(profile())->UsingDefaultTheme()) {
if (tp->HasCustomColor(ThemeProperties::COLOR_DOWNLOAD_SHELF)) {
// For custom themes, we have to make up a background color for the
// button. Use a slight tint of the shelf background.
bg_color = color_utils::BlendTowardMaxContrast(
GetThemeProvider()->GetColor(ThemeProperties::COLOR_DOWNLOAD_SHELF),
0x10);
tp->GetColor(ThemeProperties::COLOR_DOWNLOAD_SHELF), 0x10);
// Text color should be set to an appropriate button color over the button
// background, COLOR_BOOKMARK_TEXT is currently used as a convenient hack.
button->SetEnabledTextColors(
tp->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT));
}
button->SetBgColorOverride(bg_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