Commit f0ed1c19 authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

dark_mode: Update app list folder/overlay background.

All search results will be displayed using primary text coloring.

Bug: 1130822
Change-Id: Id55060e52e62d263da50ec8d507b742e812902c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421441Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809521}
parent 9aa46ffe
...@@ -39,6 +39,12 @@ SkColor AppListColorProviderImpl::GetSearchBoxBackgroundColor() const { ...@@ -39,6 +39,12 @@ SkColor AppListColorProviderImpl::GetSearchBoxBackgroundColor() const {
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive);
} }
SkColor AppListColorProviderImpl::GetSearchBoxCardBackgroundColor() const {
// Set solid color background to avoid broken text. See crbug.com/746563.
return ash_color_provider_->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kOpaque);
}
SkColor AppListColorProviderImpl::GetSearchBoxPlaceholderTextColor() const { SkColor AppListColorProviderImpl::GetSearchBoxPlaceholderTextColor() const {
return ash_color_provider_->GetContentLayerColor( return ash_color_provider_->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary); AshColorProvider::ContentLayerType::kTextColorSecondary);
...@@ -49,6 +55,11 @@ SkColor AppListColorProviderImpl::GetSearchBoxTextColor() const { ...@@ -49,6 +55,11 @@ SkColor AppListColorProviderImpl::GetSearchBoxTextColor() const {
AshColorProvider::ContentLayerType::kTextColorPrimary); AshColorProvider::ContentLayerType::kTextColorPrimary);
} }
SkColor AppListColorProviderImpl::GetSearchBoxSecondaryTextColor() const {
return ash_color_provider_->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary);
}
SkColor AppListColorProviderImpl::GetSuggestionChipBackgroundColor() const { SkColor AppListColorProviderImpl::GetSuggestionChipBackgroundColor() const {
return ash_color_provider_->GetControlsLayerColor( return ash_color_provider_->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive);
...@@ -103,6 +114,27 @@ SkColor AppListColorProviderImpl::GetFolderHintTextColor() const { ...@@ -103,6 +114,27 @@ SkColor AppListColorProviderImpl::GetFolderHintTextColor() const {
AshColorProvider::ContentLayerType::kTextColorSecondary); AshColorProvider::ContentLayerType::kTextColorSecondary);
} }
SkColor AppListColorProviderImpl::GetFolderNameBackgroundColor(
bool active) const {
if (!active)
return SK_ColorTRANSPARENT;
AshColorProvider::RippleAttributes ripple_attributes =
ash_color_provider_->GetRippleAttributes(GetAppListBackgroundColor());
return SkColorSetA(ripple_attributes.base_color,
ripple_attributes.inkdrop_opacity * 255);
}
SkColor AppListColorProviderImpl::GetContentsBackgroundColor() const {
return ash_color_provider_->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive);
}
SkColor AppListColorProviderImpl::GetSeparatorColor() const {
return ash_color_provider_->GetContentLayerColor(
AshColorProvider::ContentLayerType::kSeparatorColor);
}
float AppListColorProviderImpl::GetFolderBackgrounBlurSigma() const { float AppListColorProviderImpl::GetFolderBackgrounBlurSigma() const {
return static_cast<float>(AshColorProvider::LayerBlurSigma::kBlurDefault); return static_cast<float>(AshColorProvider::LayerBlurSigma::kBlurDefault);
} }
......
...@@ -21,6 +21,7 @@ class AppListColorProviderImpl : public AppListColorProvider { ...@@ -21,6 +21,7 @@ class AppListColorProviderImpl : public AppListColorProvider {
SkColor GetExpandArrowIconBackgroundColor() const override; SkColor GetExpandArrowIconBackgroundColor() const override;
SkColor GetAppListBackgroundColor() const override; SkColor GetAppListBackgroundColor() const override;
SkColor GetSearchBoxBackgroundColor() const override; SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxSecondaryTextColor() const override;
SkColor GetSearchBoxPlaceholderTextColor() const override; SkColor GetSearchBoxPlaceholderTextColor() const override;
SkColor GetSearchBoxTextColor() const override; SkColor GetSearchBoxTextColor() const override;
SkColor GetSuggestionChipBackgroundColor() const override; SkColor GetSuggestionChipBackgroundColor() const override;
...@@ -30,9 +31,13 @@ class AppListColorProviderImpl : public AppListColorProvider { ...@@ -30,9 +31,13 @@ class AppListColorProviderImpl : public AppListColorProvider {
SkColor GetPageSwitcherInkDropBaseColor() const override; SkColor GetPageSwitcherInkDropBaseColor() const override;
SkColor GetPageSwitcherInkDropHighlightColor() const override; SkColor GetPageSwitcherInkDropHighlightColor() const override;
SkColor GetSearchBoxIconColor() const override; SkColor GetSearchBoxIconColor() const override;
SkColor GetSearchBoxCardBackgroundColor() const override;
SkColor GetFolderBackgroundColor() const override; SkColor GetFolderBackgroundColor() const override;
SkColor GetFolderTitleTextColor() const override; SkColor GetFolderTitleTextColor() const override;
SkColor GetFolderHintTextColor() const override; SkColor GetFolderHintTextColor() const override;
SkColor GetFolderNameBackgroundColor(bool active) const override;
SkColor GetContentsBackgroundColor() const override;
SkColor GetSeparatorColor() const override;
float GetFolderBackgrounBlurSigma() const override; float GetFolderBackgrounBlurSigma() const override;
private: private:
......
...@@ -25,7 +25,11 @@ SkColor TestAppListColorProvider::GetAppListBackgroundColor() const { ...@@ -25,7 +25,11 @@ SkColor TestAppListColorProvider::GetAppListBackgroundColor() const {
} }
SkColor TestAppListColorProvider::GetSearchBoxBackgroundColor() const { SkColor TestAppListColorProvider::GetSearchBoxBackgroundColor() const {
return SK_ColorWHITE; return gfx::kGoogleGrey900;
}
SkColor TestAppListColorProvider::GetSearchBoxCardBackgroundColor() const {
return gfx::kGoogleGrey900;
} }
SkColor TestAppListColorProvider::GetSearchBoxPlaceholderTextColor() const { SkColor TestAppListColorProvider::GetSearchBoxPlaceholderTextColor() const {
...@@ -36,6 +40,10 @@ SkColor TestAppListColorProvider::GetSearchBoxTextColor() const { ...@@ -36,6 +40,10 @@ SkColor TestAppListColorProvider::GetSearchBoxTextColor() const {
return gfx::kGoogleGrey200; return gfx::kGoogleGrey200;
} }
SkColor TestAppListColorProvider::GetSearchBoxSecondaryTextColor() const {
return gfx::kGoogleGrey500;
}
SkColor TestAppListColorProvider::GetSuggestionChipBackgroundColor() const { SkColor TestAppListColorProvider::GetSuggestionChipBackgroundColor() const {
return SkColorSetA(SK_ColorWHITE, 0x1A); return SkColorSetA(SK_ColorWHITE, 0x1A);
} }
...@@ -53,7 +61,7 @@ SkColor TestAppListColorProvider::GetFolderBackgroundColor() const { ...@@ -53,7 +61,7 @@ SkColor TestAppListColorProvider::GetFolderBackgroundColor() const {
} }
SkColor TestAppListColorProvider::GetPageSwitcherButtonColor() const { SkColor TestAppListColorProvider::GetPageSwitcherButtonColor() const {
return gfx::kGoogleGrey900; return gfx::kGoogleGrey700;
} }
SkColor TestAppListColorProvider::GetPageSwitcherInkDropBaseColor() const { SkColor TestAppListColorProvider::GetPageSwitcherInkDropBaseColor() const {
...@@ -76,6 +84,22 @@ SkColor TestAppListColorProvider::GetFolderHintTextColor() const { ...@@ -76,6 +84,22 @@ SkColor TestAppListColorProvider::GetFolderHintTextColor() const {
return gfx::kGoogleGrey500; return gfx::kGoogleGrey500;
} }
SkColor TestAppListColorProvider::GetFolderNameBackgroundColor(
bool active) const {
if (!active)
return SK_ColorTRANSPARENT;
return SkColorSetA(SK_ColorBLACK, 0x0F);
}
SkColor TestAppListColorProvider::GetContentsBackgroundColor() const {
return gfx::kGoogleGrey200;
}
SkColor TestAppListColorProvider::GetSeparatorColor() const {
return SkColorSetA(SK_ColorWHITE, 0x24);
}
float TestAppListColorProvider::GetFolderBackgrounBlurSigma() const { float TestAppListColorProvider::GetFolderBackgrounBlurSigma() const {
return 30.0f; return 30.0f;
} }
......
...@@ -23,6 +23,7 @@ class TestAppListColorProvider : public AppListColorProvider { ...@@ -23,6 +23,7 @@ class TestAppListColorProvider : public AppListColorProvider {
SkColor GetSearchBoxBackgroundColor() const override; SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxPlaceholderTextColor() const override; SkColor GetSearchBoxPlaceholderTextColor() const override;
SkColor GetSearchBoxTextColor() const override; SkColor GetSearchBoxTextColor() const override;
SkColor GetSearchBoxSecondaryTextColor() const override;
SkColor GetSuggestionChipBackgroundColor() const override; SkColor GetSuggestionChipBackgroundColor() const override;
SkColor GetSuggestionChipTextColor() const override; SkColor GetSuggestionChipTextColor() const override;
SkColor GetAppListItemTextColor() const override; SkColor GetAppListItemTextColor() const override;
...@@ -30,9 +31,13 @@ class TestAppListColorProvider : public AppListColorProvider { ...@@ -30,9 +31,13 @@ class TestAppListColorProvider : public AppListColorProvider {
SkColor GetPageSwitcherInkDropBaseColor() const override; SkColor GetPageSwitcherInkDropBaseColor() const override;
SkColor GetPageSwitcherInkDropHighlightColor() const override; SkColor GetPageSwitcherInkDropHighlightColor() const override;
SkColor GetSearchBoxIconColor() const override; SkColor GetSearchBoxIconColor() const override;
SkColor GetSearchBoxCardBackgroundColor() const override;
SkColor GetFolderBackgroundColor() const override; SkColor GetFolderBackgroundColor() const override;
SkColor GetFolderTitleTextColor() const override; SkColor GetFolderTitleTextColor() const override;
SkColor GetFolderHintTextColor() const override; SkColor GetFolderHintTextColor() const override;
SkColor GetFolderNameBackgroundColor(bool active) const override;
SkColor GetContentsBackgroundColor() const override;
SkColor GetSeparatorColor() const override;
float GetFolderBackgrounBlurSigma() const override; float GetFolderBackgrounBlurSigma() const override;
}; };
......
...@@ -64,7 +64,7 @@ class FolderHeaderView::FolderNameView : public views::Textfield, ...@@ -64,7 +64,7 @@ class FolderHeaderView::FolderNameView : public views::Textfield,
gfx::Insets(0, horizontal_padding))); gfx::Insets(0, horizontal_padding)));
SetBackgroundColor( SetBackgroundColor(
AppListConfig::instance().GetFolderNameBackgroundColor(is_active)); AppListColorProvider::Get()->GetFolderNameBackgroundColor(is_active));
} }
void OnFocus() override { void OnFocus() override {
...@@ -123,8 +123,9 @@ class FolderHeaderView::FolderNameView : public views::Textfield, ...@@ -123,8 +123,9 @@ class FolderHeaderView::FolderNameView : public views::Textfield,
void OnMouseExited(const ui::MouseEvent& event) override { void OnMouseExited(const ui::MouseEvent& event) override {
if (!HasFocus()) { if (!HasFocus()) {
SetBackgroundColor(AppListConfig::instance().GetFolderNameBackgroundColor( SetBackgroundColor(
/*is_active=*/false)); AppListColorProvider::Get()->GetFolderNameBackgroundColor(
/*is_active=*/false));
} }
has_mouse_already_entered_ = false; has_mouse_already_entered_ = false;
...@@ -135,7 +136,7 @@ class FolderHeaderView::FolderNameView : public views::Textfield, ...@@ -135,7 +136,7 @@ class FolderHeaderView::FolderNameView : public views::Textfield,
// If this is reached, the mouse is entering the view. // If this is reached, the mouse is entering the view.
// Recreate border to have custom corner radius. // Recreate border to have custom corner radius.
SetBackground(views::CreateRoundedRectBackground( SetBackground(views::CreateRoundedRectBackground(
AppListConfig::instance().GetFolderNameBackgroundColor( AppListColorProvider::Get()->GetFolderNameBackgroundColor(
/*is_active=*/true), /*is_active=*/true),
AppListConfig::instance().folder_name_border_radius())); AppListConfig::instance().folder_name_border_radius()));
has_mouse_already_entered_ = true; has_mouse_already_entered_ = true;
...@@ -143,8 +144,9 @@ class FolderHeaderView::FolderNameView : public views::Textfield, ...@@ -143,8 +144,9 @@ class FolderHeaderView::FolderNameView : public views::Textfield,
has_mouse_already_entered_ && !HasFocus()) { has_mouse_already_entered_ && !HasFocus()) {
// If this is reached, the mouse is exiting the view on its horizontal // If this is reached, the mouse is exiting the view on its horizontal
// edges. // edges.
SetBackgroundColor(AppListConfig::instance().GetFolderNameBackgroundColor( SetBackgroundColor(
/*is_active=*/false)); AppListColorProvider::Get()->GetFolderNameBackgroundColor(
/*is_active=*/false));
has_mouse_already_entered_ = false; has_mouse_already_entered_ = false;
} }
} }
......
...@@ -373,7 +373,7 @@ int SearchBoxView::GetSearchBoxBorderCornerRadiusForState( ...@@ -373,7 +373,7 @@ int SearchBoxView::GetSearchBoxBorderCornerRadiusForState(
SkColor SearchBoxView::GetBackgroundColorForState(AppListState state) const { SkColor SearchBoxView::GetBackgroundColorForState(AppListState state) const {
if (state == AppListState::kStateSearchResults) if (state == AppListState::kStateSearchResults)
return AppListConfig::instance().card_background_color(); return AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor();
return AppListColorProvider::Get()->GetSearchBoxBackgroundColor(); return AppListColorProvider::Get()->GetSearchBoxBackgroundColor();
} }
...@@ -385,14 +385,6 @@ void SearchBoxView::ShowZeroStateSuggestions() { ...@@ -385,14 +385,6 @@ void SearchBoxView::ShowZeroStateSuggestions() {
} }
void SearchBoxView::OnWallpaperColorsChanged() { void SearchBoxView::OnWallpaperColorsChanged() {
const auto& colors = view_delegate_->GetWallpaperProminentColors();
if (colors.empty())
return;
DCHECK_EQ(static_cast<size_t>(ColorProfileType::NUM_OF_COLOR_PROFILES),
colors.size());
SetSearchBoxColor(colors[static_cast<int>(ColorProfileType::DARK_MUTED)]);
UpdateSearchIcon(); UpdateSearchIcon();
AppListColorProvider* app_list_color_provider = AppListColorProvider::Get(); AppListColorProvider* app_list_color_provider = AppListColorProvider::Get();
search_box()->set_placeholder_text_color( search_box()->set_placeholder_text_color(
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ash/app_list/views/search_result_list_view.h" #include "ash/app_list/views/search_result_list_view.h"
#include "ash/app_list/views/search_result_page_anchored_dialog.h" #include "ash/app_list/views/search_result_page_anchored_dialog.h"
#include "ash/app_list/views/search_result_tile_item_list_view.h" #include "ash/app_list/views/search_result_tile_item_list_view.h"
#include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/view_shadow.h" #include "ash/public/cpp/view_shadow.h"
...@@ -184,7 +185,7 @@ SearchResultPageView::SearchResultPageView(SearchModel* search_model) ...@@ -184,7 +185,7 @@ SearchResultPageView::SearchResultPageView(SearchModel* search_model)
// background border corner radius. All child views' background should be // background border corner radius. All child views' background should be
// set transparent so that the rounded corner is not overwritten. // set transparent so that the rounded corner is not overwritten.
SetBackground(std::make_unique<SearchResultPageBackground>( SetBackground(std::make_unique<SearchResultPageBackground>(
AppListConfig::instance().card_background_color())); AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor()));
auto scroller = std::make_unique<views::ScrollView>(); auto scroller = std::make_unique<views::ScrollView>();
// Leaves a placeholder area for the search box and the separator below it. // Leaves a placeholder area for the search box and the separator below it.
scroller->SetBorder(views::CreateEmptyBorder(gfx::Insets( scroller->SetBorder(views::CreateEmptyBorder(gfx::Insets(
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/app_list/app_list_view_delegate.h" #include "ash/app_list/app_list_view_delegate.h"
#include "ash/app_list/model/search/search_result.h" #include "ash/app_list/model/search/search_result.h"
#include "ash/app_list/views/search_result_page_view.h" #include "ash/app_list/views/search_result_page_view.h"
#include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/app_list_notifier.h" #include "ash/public/cpp/app_list/app_list_notifier.h"
...@@ -48,8 +49,6 @@ constexpr int kSeparatorLeftRightPadding = 4; ...@@ -48,8 +49,6 @@ constexpr int kSeparatorLeftRightPadding = 4;
constexpr int kSeparatorHeight = 46; constexpr int kSeparatorHeight = 46;
constexpr int kSeparatorTopPadding = 10; constexpr int kSeparatorTopPadding = 10;
constexpr SkColor kSeparatorColor = SkColorSetA(gfx::kGoogleGrey900, 0x24);
// The Delay before recording play store app results impression, i.e., if the // The Delay before recording play store app results impression, i.e., if the
// play store results are displayed less than the duration, we assume user // play store results are displayed less than the duration, we assume user
// won't have chance to see them clearly and click on them, and wont' log // won't have chance to see them clearly and click on them, and wont' log
...@@ -95,7 +94,7 @@ SearchResultTileItemListView::SearchResultTileItemListView( ...@@ -95,7 +94,7 @@ SearchResultTileItemListView::SearchResultTileItemListView(
kSeparatorTopPadding, kSeparatorLeftRightPadding, kSeparatorTopPadding, kSeparatorLeftRightPadding,
AppListConfig::instance().search_tile_height() - kSeparatorHeight, AppListConfig::instance().search_tile_height() - kSeparatorHeight,
kSeparatorLeftRightPadding)); kSeparatorLeftRightPadding));
separator->SetColor(kSeparatorColor); separator->SetColor(AppListColorProvider::Get()->GetSeparatorColor());
separator_views_.push_back(separator); separator_views_.push_back(separator);
layout_->SetFlexForView(separator, 0); layout_->SetFlexForView(separator, 0);
} }
...@@ -105,7 +104,7 @@ SearchResultTileItemListView::SearchResultTileItemListView( ...@@ -105,7 +104,7 @@ SearchResultTileItemListView::SearchResultTileItemListView(
view_delegate, false /* show_in_apps_page */)); view_delegate, false /* show_in_apps_page */));
tile_item->set_index_in_container(i); tile_item->set_index_in_container(i);
tile_item->SetParentBackgroundColor( tile_item->SetParentBackgroundColor(
AppListConfig::instance().card_background_color()); AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor());
tile_views_.push_back(tile_item); tile_views_.push_back(tile_item);
AddObservedResultView(tile_item); AddObservedResultView(tile_item);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ash/app_list/model/search/search_model.h" #include "ash/app_list/model/search/search_model.h"
#include "ash/app_list/model/search/search_result.h" #include "ash/app_list/model/search/search_result.h"
#include "ash/app_list/views/app_list_item_view.h" #include "ash/app_list/views/app_list_item_view.h"
#include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/app_list/app_list_types.h"
...@@ -66,11 +67,6 @@ constexpr int kSearchRatingCenteringOffset = ...@@ -66,11 +67,6 @@ constexpr int kSearchRatingCenteringOffset =
kSearchRatingStarSize)) / kSearchRatingStarSize)) /
2); 2);
constexpr SkColor kSearchTitleColor = gfx::kGoogleGrey900;
constexpr SkColor kSearchAppRatingColor = gfx::kGoogleGrey700;
constexpr SkColor kSearchAppPriceColor = gfx::kGoogleGreen600;
constexpr SkColor kSearchRatingStarColor = gfx::kGoogleGrey700;
} // namespace } // namespace
SearchResultTileItemView::SearchResultTileItemView( SearchResultTileItemView::SearchResultTileItemView(
...@@ -104,7 +100,7 @@ SearchResultTileItemView::SearchResultTileItemView( ...@@ -104,7 +100,7 @@ SearchResultTileItemView::SearchResultTileItemView(
title_ = new views::Label; title_ = new views::Label;
title_->SetAutoColorReadabilityEnabled(false); title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColor(AppListConfig::instance().grid_title_color()); title_->SetEnabledColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
title_->SetLineHeight(kTileTextLineHeight); title_->SetLineHeight(kTileTextLineHeight);
title_->SetHorizontalAlignment(gfx::ALIGN_CENTER); title_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
title_->SetHandlesTooltips(false); title_->SetHandlesTooltips(false);
...@@ -114,7 +110,8 @@ SearchResultTileItemView::SearchResultTileItemView( ...@@ -114,7 +110,8 @@ SearchResultTileItemView::SearchResultTileItemView(
if (is_play_store_app_search_enabled_ || if (is_play_store_app_search_enabled_ ||
is_app_reinstall_recommendation_enabled_) { is_app_reinstall_recommendation_enabled_) {
rating_ = new views::Label; rating_ = new views::Label;
rating_->SetEnabledColor(kSearchAppRatingColor); rating_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor());
rating_->SetLineHeight(kTileTextLineHeight); rating_->SetLineHeight(kTileTextLineHeight);
rating_->SetHorizontalAlignment(gfx::ALIGN_RIGHT); rating_->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
rating_->SetVisible(false); rating_->SetVisible(false);
...@@ -124,12 +121,14 @@ SearchResultTileItemView::SearchResultTileItemView( ...@@ -124,12 +121,14 @@ SearchResultTileItemView::SearchResultTileItemView(
rating_star_->set_can_process_events_within_subtree(false); rating_star_->set_can_process_events_within_subtree(false);
rating_star_->SetVerticalAlignment(views::ImageView::Alignment::kLeading); rating_star_->SetVerticalAlignment(views::ImageView::Alignment::kLeading);
rating_star_->SetImage(gfx::CreateVectorIcon( rating_star_->SetImage(gfx::CreateVectorIcon(
kBadgeRatingIcon, kSearchRatingStarSize, kSearchRatingStarColor)); kBadgeRatingIcon, kSearchRatingStarSize,
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor()));
rating_star_->SetVisible(false); rating_star_->SetVisible(false);
AddChildView(rating_star_); AddChildView(rating_star_);
price_ = new views::Label; price_ = new views::Label;
price_->SetEnabledColor(kSearchAppPriceColor); price_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor());
price_->SetLineHeight(kTileTextLineHeight); price_->SetLineHeight(kTileTextLineHeight);
price_->SetHorizontalAlignment(gfx::ALIGN_LEFT); price_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
price_->SetVisible(false); price_->SetVisible(false);
...@@ -163,7 +162,7 @@ void SearchResultTileItemView::OnResultChanged() { ...@@ -163,7 +162,7 @@ void SearchResultTileItemView::OnResultChanged() {
// Set solid color background to avoid broken text. See crbug.com/746563. // Set solid color background to avoid broken text. See crbug.com/746563.
if (rating_) { if (rating_) {
rating_->SetBackground(views::CreateSolidBackground( rating_->SetBackground(views::CreateSolidBackground(
AppListConfig::instance().card_background_color())); AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor()));
if (!IsSuggestedAppTile()) { if (!IsSuggestedAppTile()) {
// App search results use different fonts than AppList apps. // App search results use different fonts than AppList apps.
rating_->SetFontList( rating_->SetFontList(
...@@ -175,7 +174,7 @@ void SearchResultTileItemView::OnResultChanged() { ...@@ -175,7 +174,7 @@ void SearchResultTileItemView::OnResultChanged() {
} }
if (price_) { if (price_) {
price_->SetBackground(views::CreateSolidBackground( price_->SetBackground(views::CreateSolidBackground(
AppListConfig::instance().card_background_color())); AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor()));
if (!IsSuggestedAppTile()) { if (!IsSuggestedAppTile()) {
// App search results use different fonts than AppList apps. // App search results use different fonts than AppList apps.
price_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( price_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
...@@ -185,7 +184,7 @@ void SearchResultTileItemView::OnResultChanged() { ...@@ -185,7 +184,7 @@ void SearchResultTileItemView::OnResultChanged() {
} }
} }
title_->SetBackground(views::CreateSolidBackground( title_->SetBackground(views::CreateSolidBackground(
AppListConfig::instance().card_background_color())); AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor()));
if (!IsSuggestedAppTile()) { if (!IsSuggestedAppTile()) {
// App search results use different fonts than AppList apps. // App search results use different fonts than AppList apps.
title_->SetFontList( title_->SetFontList(
...@@ -196,7 +195,8 @@ void SearchResultTileItemView::OnResultChanged() { ...@@ -196,7 +195,8 @@ void SearchResultTileItemView::OnResultChanged() {
} else { } else {
title_->SetFontList(font); title_->SetFontList(font);
} }
title_->SetEnabledColor(kSearchTitleColor); title_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxTextColor());
} }
title_->SetMaxLines(2); title_->SetMaxLines(2);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ash/app_list/views/search_result_actions_view.h" #include "ash/app_list/views/search_result_actions_view.h"
#include "ash/app_list/views/search_result_list_view.h" #include "ash/app_list/views/search_result_list_view.h"
#include "ash/app_list/views/search_result_page_view.h" #include "ash/app_list/views/search_result_page_view.h"
#include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_switches.h" #include "ash/public/cpp/app_list/app_list_switches.h"
#include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/app_list/app_list_types.h"
...@@ -44,10 +45,6 @@ constexpr int kActionButtonRightMargin = 8; ...@@ -44,10 +45,6 @@ constexpr int kActionButtonRightMargin = 8;
constexpr int kTitleLineHeight = 20; constexpr int kTitleLineHeight = 20;
constexpr int kDetailsLineHeight = 16; constexpr int kDetailsLineHeight = 16;
// Matched text color.
constexpr SkColor kMatchedTextColor = gfx::kGoogleGrey900;
// Default text color.
constexpr SkColor kDefaultTextColor = gfx::kGoogleGrey700;
// URL color. // URL color.
constexpr SkColor kUrlColor = gfx::kGoogleBlue600; constexpr SkColor kUrlColor = gfx::kGoogleBlue600;
// Row selected color, Google Grey 8%. // Row selected color, Google Grey 8%.
...@@ -122,16 +119,14 @@ void SearchResultView::CreateTitleRenderText() { ...@@ -122,16 +119,14 @@ void SearchResultView::CreateTitleRenderText() {
// When result is an omnibox non-url search, the matched tag indicates // When result is an omnibox non-url search, the matched tag indicates
// proposed query. For all other cases, the matched tag indicates typed search // proposed query. For all other cases, the matched tag indicates typed search
// query. // query.
render_text->SetColor(result()->is_omnibox_search() ? kDefaultTextColor render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
: kMatchedTextColor);
const SearchResult::Tags& tags = result()->title_tags(); const SearchResult::Tags& tags = result()->title_tags();
for (const auto& tag : tags) { for (const auto& tag : tags) {
if (tag.styles & SearchResult::Tag::URL) { if (tag.styles & SearchResult::Tag::URL) {
render_text->ApplyColor(kUrlColor, tag.range); render_text->ApplyColor(kUrlColor, tag.range);
} else if (tag.styles & SearchResult::Tag::MATCH) { } else if (tag.styles & SearchResult::Tag::MATCH) {
render_text->ApplyColor( render_text->ApplyColor(
result()->is_omnibox_search() ? kMatchedTextColor : kDefaultTextColor, AppListColorProvider::Get()->GetSearchBoxTextColor(), tag.range);
tag.range);
} }
} }
title_text_ = std::move(render_text); title_text_ = std::move(render_text);
...@@ -148,7 +143,7 @@ void SearchResultView::CreateDetailsRenderText() { ...@@ -148,7 +143,7 @@ void SearchResultView::CreateDetailsRenderText() {
render_text->SetText(result()->details()); render_text->SetText(result()->details());
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
render_text->SetFontList(rb.GetFontList(ui::ResourceBundle::BaseFont)); render_text->SetFontList(rb.GetFontList(ui::ResourceBundle::BaseFont));
render_text->SetColor(kDefaultTextColor); render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
const SearchResult::Tags& tags = result()->details_tags(); const SearchResult::Tags& tags = result()->details_tags();
for (const auto& tag : tags) { for (const auto& tag : tags) {
if (tag.styles & SearchResult::Tag::URL) if (tag.styles & SearchResult::Tag::URL)
...@@ -270,8 +265,9 @@ void SearchResultView::PaintButtonContents(gfx::Canvas* canvas) { ...@@ -270,8 +265,9 @@ void SearchResultView::PaintButtonContents(gfx::Canvas* canvas) {
// Set solid color background to avoid broken text. See crbug.com/746563. // Set solid color background to avoid broken text. See crbug.com/746563.
// This should be drawn before selected color which is semi-transparent. // This should be drawn before selected color which is semi-transparent.
canvas->FillRect(text_bounds, canvas->FillRect(
AppListConfig::instance().card_background_color()); text_bounds,
AppListColorProvider::Get()->GetSearchBoxCardBackgroundColor());
// Possibly call FillRect a second time (these colours are partially // Possibly call FillRect a second time (these colours are partially
// transparent, so the previous FillRect is not redundant). // transparent, so the previous FillRect is not redundant).
......
...@@ -22,6 +22,7 @@ class ASH_PUBLIC_EXPORT AppListColorProvider { ...@@ -22,6 +22,7 @@ class ASH_PUBLIC_EXPORT AppListColorProvider {
virtual SkColor GetSearchBoxBackgroundColor() const = 0; virtual SkColor GetSearchBoxBackgroundColor() const = 0;
virtual SkColor GetSearchBoxPlaceholderTextColor() const = 0; virtual SkColor GetSearchBoxPlaceholderTextColor() const = 0;
virtual SkColor GetSearchBoxTextColor() const = 0; virtual SkColor GetSearchBoxTextColor() const = 0;
virtual SkColor GetSearchBoxSecondaryTextColor() const = 0;
virtual SkColor GetSuggestionChipBackgroundColor() const = 0; virtual SkColor GetSuggestionChipBackgroundColor() const = 0;
virtual SkColor GetSuggestionChipTextColor() const = 0; virtual SkColor GetSuggestionChipTextColor() const = 0;
virtual SkColor GetAppListItemTextColor() const = 0; virtual SkColor GetAppListItemTextColor() const = 0;
...@@ -29,9 +30,13 @@ class ASH_PUBLIC_EXPORT AppListColorProvider { ...@@ -29,9 +30,13 @@ class ASH_PUBLIC_EXPORT AppListColorProvider {
virtual SkColor GetPageSwitcherInkDropBaseColor() const = 0; virtual SkColor GetPageSwitcherInkDropBaseColor() const = 0;
virtual SkColor GetPageSwitcherInkDropHighlightColor() const = 0; virtual SkColor GetPageSwitcherInkDropHighlightColor() const = 0;
virtual SkColor GetSearchBoxIconColor() const = 0; virtual SkColor GetSearchBoxIconColor() const = 0;
virtual SkColor GetSearchBoxCardBackgroundColor() const = 0;
virtual SkColor GetFolderBackgroundColor() const = 0; virtual SkColor GetFolderBackgroundColor() const = 0;
virtual SkColor GetFolderTitleTextColor() const = 0; virtual SkColor GetFolderTitleTextColor() const = 0;
virtual SkColor GetFolderHintTextColor() const = 0; virtual SkColor GetFolderHintTextColor() const = 0;
virtual SkColor GetFolderNameBackgroundColor(bool active) const = 0;
virtual SkColor GetContentsBackgroundColor() const = 0;
virtual SkColor GetSeparatorColor() const = 0;
virtual float GetFolderBackgrounBlurSigma() const = 0; virtual float GetFolderBackgrounBlurSigma() const = 0;
protected: protected:
......
...@@ -301,8 +301,6 @@ AppListConfig::AppListConfig(AppListConfigType type) ...@@ -301,8 +301,6 @@ AppListConfig::AppListConfig(AppListConfigType type)
folder_name_border_thickness_(2), folder_name_border_thickness_(2),
folder_name_padding_(8), folder_name_padding_(8),
folder_name_border_color_(gfx::kGoogleBlue600), folder_name_border_color_(gfx::kGoogleBlue600),
folder_name_background_color_(SK_ColorTRANSPARENT),
folder_name_background_color_active_(gfx::kGoogleGrey100),
folder_icon_dimension_(FolderClippedIconDimensionForType(type)), folder_icon_dimension_(FolderClippedIconDimensionForType(type)),
folder_unclipped_icon_dimension_( folder_unclipped_icon_dimension_(
FolderUnclippedIconDimensionForType(type)), FolderUnclippedIconDimensionForType(type)),
...@@ -318,9 +316,7 @@ AppListConfig::AppListConfig(AppListConfigType type) ...@@ -318,9 +316,7 @@ AppListConfig::AppListConfig(AppListConfigType type)
page_flip_zone_size_(20), page_flip_zone_size_(20),
grid_tile_spacing_in_folder_(8), grid_tile_spacing_in_folder_(8),
blur_radius_(30), blur_radius_(30),
contents_background_color_(SkColorSetRGB(0xF2, 0xF2, 0xF2)),
grid_selected_color_(gfx::kGoogleBlue300), grid_selected_color_(gfx::kGoogleBlue300),
card_background_color_(SK_ColorWHITE),
page_transition_duration_(base::TimeDelta::FromMilliseconds(250)), page_transition_duration_(base::TimeDelta::FromMilliseconds(250)),
overscroll_page_transition_duration_( overscroll_page_transition_duration_(
base::TimeDelta::FromMilliseconds(50)), base::TimeDelta::FromMilliseconds(50)),
...@@ -436,9 +432,6 @@ AppListConfig::AppListConfig(const AppListConfig& base_config, ...@@ -436,9 +432,6 @@ AppListConfig::AppListConfig(const AppListConfig& base_config,
folder_name_border_thickness_(base_config.folder_name_border_thickness_), folder_name_border_thickness_(base_config.folder_name_border_thickness_),
folder_name_padding_(base_config.folder_name_padding_), folder_name_padding_(base_config.folder_name_padding_),
folder_name_border_color_(base_config.folder_name_border_color_), folder_name_border_color_(base_config.folder_name_border_color_),
folder_name_background_color_(base_config.folder_name_background_color_),
folder_name_background_color_active_(
base_config.folder_name_background_color_active_),
folder_icon_dimension_(MinScale(base_config.folder_icon_dimension_, folder_icon_dimension_(MinScale(base_config.folder_icon_dimension_,
scale_x, scale_x,
inner_tile_scale_y)), inner_tile_scale_y)),
...@@ -472,9 +465,7 @@ AppListConfig::AppListConfig(const AppListConfig& base_config, ...@@ -472,9 +465,7 @@ AppListConfig::AppListConfig(const AppListConfig& base_config,
scale_x, scale_x,
inner_tile_scale_y)), inner_tile_scale_y)),
blur_radius_(base_config.blur_radius_), blur_radius_(base_config.blur_radius_),
contents_background_color_(base_config.contents_background_color_),
grid_selected_color_(base_config.grid_selected_color_), grid_selected_color_(base_config.grid_selected_color_),
card_background_color_(base_config.card_background_color_),
page_transition_duration_(base_config.page_transition_duration_), page_transition_duration_(base_config.page_transition_duration_),
overscroll_page_transition_duration_( overscroll_page_transition_duration_(
base_config.overscroll_page_transition_duration_), base_config.overscroll_page_transition_duration_),
...@@ -553,9 +544,4 @@ SkColor AppListConfig::GetCardifiedBackgroundColor(bool is_active) const { ...@@ -553,9 +544,4 @@ SkColor AppListConfig::GetCardifiedBackgroundColor(bool is_active) const {
: cardified_background_color_; : cardified_background_color_;
} }
SkColor AppListConfig::GetFolderNameBackgroundColor(bool is_active) const {
return is_active ? folder_name_background_color_active_
: folder_name_background_color_;
}
} // namespace ash } // namespace ash
...@@ -150,11 +150,7 @@ class ASH_PUBLIC_EXPORT AppListConfig { ...@@ -150,11 +150,7 @@ class ASH_PUBLIC_EXPORT AppListConfig {
return grid_tile_spacing_in_folder_; return grid_tile_spacing_in_folder_;
} }
int blur_radius() const { return blur_radius_; } int blur_radius() const { return blur_radius_; }
SkColor contents_background_color() const {
return contents_background_color_;
}
SkColor grid_selected_color() const { return grid_selected_color_; } SkColor grid_selected_color() const { return grid_selected_color_; }
SkColor card_background_color() const { return card_background_color_; }
base::TimeDelta page_transition_duration() const { base::TimeDelta page_transition_duration() const {
return page_transition_duration_; return page_transition_duration_;
} }
...@@ -268,9 +264,6 @@ class ASH_PUBLIC_EXPORT AppListConfig { ...@@ -268,9 +264,6 @@ class ASH_PUBLIC_EXPORT AppListConfig {
// Returns the color and opacity for the page background. // Returns the color and opacity for the page background.
SkColor GetCardifiedBackgroundColor(bool is_active) const; SkColor GetCardifiedBackgroundColor(bool is_active) const;
// Returns the folder name background color.
SkColor GetFolderNameBackgroundColor(bool is_active) const;
private: private:
const AppListConfigType type_; const AppListConfigType type_;
...@@ -411,10 +404,6 @@ class ASH_PUBLIC_EXPORT AppListConfig { ...@@ -411,10 +404,6 @@ class ASH_PUBLIC_EXPORT AppListConfig {
// The color of the folder name border. // The color of the folder name border.
const SkColor folder_name_border_color_; const SkColor folder_name_border_color_;
// Background colors for folder name.
const SkColor folder_name_background_color_;
const SkColor folder_name_background_color_active_;
// The icon dimension of folder. // The icon dimension of folder.
const int folder_icon_dimension_; const int folder_icon_dimension_;
...@@ -455,16 +444,10 @@ class ASH_PUBLIC_EXPORT AppListConfig { ...@@ -455,16 +444,10 @@ class ASH_PUBLIC_EXPORT AppListConfig {
// The blur radius used in the app list. // The blur radius used in the app list.
const int blur_radius_; const int blur_radius_;
// The background color of app list overlay.
const SkColor contents_background_color_;
// The keyboard select color for grid views, which are on top of a black // The keyboard select color for grid views, which are on top of a black
// shield view for new design (12% white). // shield view for new design (12% white).
const SkColor grid_selected_color_; const SkColor grid_selected_color_;
// The background color for views in search results page.
const SkColor card_background_color_;
// Duration for page transition. // Duration for page transition.
const base::TimeDelta page_transition_duration_; const base::TimeDelta page_transition_duration_;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "ui/views/window/non_client_view.h" #include "ui/views/window/non_client_view.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#endif #endif
...@@ -62,7 +62,8 @@ class AppListOverlayBackground : public views::Background { ...@@ -62,7 +62,8 @@ class AppListOverlayBackground : public views::Background {
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style); flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setColor(ash::AppListConfig::instance().contents_background_color()); flags.setColor(
ash::AppListColorProvider::Get()->GetContentsBackgroundColor());
canvas->DrawRoundRect(view->GetContentsBounds(), canvas->DrawRoundRect(view->GetContentsBounds(),
kAppListOverlayBorderRadius, flags); kAppListOverlayBorderRadius, flags);
} }
......
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