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

Update page switcher for light mode.

Bug: 1110766
Change-Id: I9a77bfbdc6c19679d82ea01bfaf25fc70e7483ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416763Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808444}
parent 24f1af7e
...@@ -64,4 +64,23 @@ SkColor AppListColorProviderImpl::GetAppListItemTextColor() const { ...@@ -64,4 +64,23 @@ SkColor AppListColorProviderImpl::GetAppListItemTextColor() const {
AshColorProvider::ContentLayerType::kTextColorPrimary); AshColorProvider::ContentLayerType::kTextColorPrimary);
} }
SkColor AppListColorProviderImpl::GetPageSwitcherButtonColor() const {
return ash_color_provider_->GetContentLayerColor(
AshColorProvider::ContentLayerType::kButtonIconColor);
}
SkColor AppListColorProviderImpl::GetPageSwitcherInkDropBaseColor() const {
AshColorProvider::RippleAttributes ripple_attributes =
ash_color_provider_->GetRippleAttributes(GetAppListBackgroundColor());
return SkColorSetA(ripple_attributes.base_color,
ripple_attributes.inkdrop_opacity * 255);
}
SkColor AppListColorProviderImpl::GetPageSwitcherInkDropHighlightColor() const {
AshColorProvider::RippleAttributes ripple_attributes =
ash_color_provider_->GetRippleAttributes(GetAppListBackgroundColor());
return SkColorSetA(ripple_attributes.base_color,
ripple_attributes.highlight_opacity * 255);
}
} // namespace ash } // namespace ash
...@@ -26,6 +26,9 @@ class AppListColorProviderImpl : public AppListColorProvider { ...@@ -26,6 +26,9 @@ class AppListColorProviderImpl : public AppListColorProvider {
SkColor GetSuggestionChipBackgroundColor() const override; SkColor GetSuggestionChipBackgroundColor() const override;
SkColor GetSuggestionChipTextColor() const override; SkColor GetSuggestionChipTextColor() const override;
SkColor GetAppListItemTextColor() const override; SkColor GetAppListItemTextColor() const override;
SkColor GetPageSwitcherButtonColor() const override;
SkColor GetPageSwitcherInkDropBaseColor() const override;
SkColor GetPageSwitcherInkDropHighlightColor() const override;
private: private:
// Unowned. // Unowned.
......
...@@ -48,4 +48,16 @@ SkColor TestAppListColorProvider::GetAppListItemTextColor() const { ...@@ -48,4 +48,16 @@ SkColor TestAppListColorProvider::GetAppListItemTextColor() const {
return gfx::kGoogleGrey900; return gfx::kGoogleGrey900;
} }
SkColor TestAppListColorProvider::GetPageSwitcherButtonColor() const {
return gfx::kGoogleGrey900;
}
SkColor TestAppListColorProvider::GetPageSwitcherInkDropBaseColor() const {
return SkColorSetA(SK_ColorBLACK, 0x0F);
}
SkColor TestAppListColorProvider::GetPageSwitcherInkDropHighlightColor() const {
return SkColorSetA(SK_ColorBLACK, 0x0F);
}
} // namespace ash } // namespace ash
...@@ -26,6 +26,9 @@ class TestAppListColorProvider : public AppListColorProvider { ...@@ -26,6 +26,9 @@ class TestAppListColorProvider : public AppListColorProvider {
SkColor GetSuggestionChipBackgroundColor() const override; SkColor GetSuggestionChipBackgroundColor() const override;
SkColor GetSuggestionChipTextColor() const override; SkColor GetSuggestionChipTextColor() const override;
SkColor GetAppListItemTextColor() const override; SkColor GetAppListItemTextColor() const override;
SkColor GetPageSwitcherButtonColor() const override;
SkColor GetPageSwitcherInkDropBaseColor() const override;
SkColor GetPageSwitcherInkDropHighlightColor() const override;
}; };
} // namespace ash } // namespace ash
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include "ash/app_list/app_list_metrics.h" #include "ash/app_list/app_list_metrics.h"
#include "ash/public/cpp/app_list/app_list_color_provider.h"
#include "ash/public/cpp/pagination/pagination_model.h" #include "ash/public/cpp/pagination/pagination_model.h"
#include "base/i18n/number_formatting.h" #include "base/i18n/number_formatting.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -41,29 +42,11 @@ constexpr SkScalar kStrokeWidth = SkIntToScalar(2); ...@@ -41,29 +42,11 @@ constexpr SkScalar kStrokeWidth = SkIntToScalar(2);
// Constants for the button strip that grows vertically. // Constants for the button strip that grows vertically.
// The padding on top/bottom side of each button. // The padding on top/bottom side of each button.
constexpr int kVerticalButtonPadding = 0; constexpr int kVerticalButtonPadding = 0;
// The selected button color.
constexpr SkColor kDarkSelectedButtonColor = SkColorSetARGB(255, 232, 234, 237);
// The normal button color for the page switcher shown in the app grid (54%
// white).
constexpr SkColor kDarkNormalColor = SkColorSetARGB(255, 232, 234, 237);
constexpr SkColor kDarkInkDropBaseColor = SkColorSetRGB(241, 243, 244);
constexpr SkColor kDarkInkDropRippleColor =
SkColorSetA(kDarkInkDropBaseColor, 15);
constexpr SkColor kDarkInkDropHighlightColor =
SkColorSetA(kDarkInkDropBaseColor, 20);
// Constants for the button strip that grows horizontally. // Constants for the button strip that grows horizontally.
// The padding on left/right side of each button. // The padding on left/right side of each button.
constexpr int kHorizontalButtonPadding = 0; constexpr int kHorizontalButtonPadding = 0;
// The normal button color for the page switcher shown in folders (54% black).
constexpr SkColor kLightNormalColor = SkColorSetA(SK_ColorBLACK, 138);
constexpr SkColor kLightInkDropBaseColor = SkColorSetARGB(255, 95, 99, 104);
constexpr SkColor kLightInkDropRippleColor =
SkColorSetA(kLightInkDropBaseColor, 8);
constexpr SkColor kLightInkDropHighlightColor =
SkColorSetA(kLightInkDropBaseColor, 24);
class PageSwitcherButton : public views::Button { class PageSwitcherButton : public views::Button {
public: public:
PageSwitcherButton(views::ButtonListener* listener, PageSwitcherButton(views::ButtonListener* listener,
...@@ -119,17 +102,14 @@ class PageSwitcherButton : public views::Button { ...@@ -119,17 +102,14 @@ class PageSwitcherButton : public views::Button {
return std::make_unique<views::FloodFillInkDropRipple>( return std::make_unique<views::FloodFillInkDropRipple>(
size(), GetLocalBounds().InsetsFrom(bounds), size(), GetLocalBounds().InsetsFrom(bounds),
GetInkDropCenterBasedOnLastEvent(), GetInkDropCenterBasedOnLastEvent(),
is_root_app_grid_page_switcher_ ? kDarkInkDropRippleColor AppListColorProvider::Get()->GetPageSwitcherInkDropBaseColor(), 1.0f);
: kLightInkDropRippleColor,
1.0f);
} }
std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
const override { const override {
auto highlight = std::make_unique<views::InkDropHighlight>( auto highlight = std::make_unique<views::InkDropHighlight>(
gfx::SizeF(size()), is_root_app_grid_page_switcher_ gfx::SizeF(size()),
? kDarkInkDropHighlightColor AppListColorProvider::Get()->GetPageSwitcherInkDropHighlightColor());
: kLightInkDropHighlightColor);
highlight->set_visible_opacity(1.f); highlight->set_visible_opacity(1.f);
return highlight; return highlight;
} }
...@@ -151,15 +131,12 @@ class PageSwitcherButton : public views::Button { ...@@ -151,15 +131,12 @@ class PageSwitcherButton : public views::Button {
// Returns the information of how to paint selected/normal button. // Returns the information of how to paint selected/normal button.
PaintButtonInfo BuildPaintButtonInfo() { PaintButtonInfo BuildPaintButtonInfo() {
PaintButtonInfo info; PaintButtonInfo info;
info.color = AppListColorProvider::Get()->GetPageSwitcherButtonColor();
if (selected_) { if (selected_) {
info.color = is_root_app_grid_page_switcher_ ? kDarkSelectedButtonColor
: kLightNormalColor;
info.style = cc::PaintFlags::kFill_Style; info.style = cc::PaintFlags::kFill_Style;
info.radius = SkIntToScalar(kSelectedButtonRadius); info.radius = SkIntToScalar(kSelectedButtonRadius);
info.stroke_width = SkIntToScalar(0); info.stroke_width = SkIntToScalar(0);
} else { } else {
info.color = is_root_app_grid_page_switcher_ ? kDarkNormalColor
: kLightNormalColor;
info.style = cc::PaintFlags::kStroke_Style; info.style = cc::PaintFlags::kStroke_Style;
info.radius = SkIntToScalar(kNormalButtonRadius); info.radius = SkIntToScalar(kNormalButtonRadius);
info.stroke_width = kStrokeWidth; info.stroke_width = kStrokeWidth;
......
...@@ -25,6 +25,9 @@ class ASH_PUBLIC_EXPORT AppListColorProvider { ...@@ -25,6 +25,9 @@ class ASH_PUBLIC_EXPORT AppListColorProvider {
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;
virtual SkColor GetPageSwitcherButtonColor() const = 0;
virtual SkColor GetPageSwitcherInkDropBaseColor() const = 0;
virtual SkColor GetPageSwitcherInkDropHighlightColor() const = 0;
protected: protected:
AppListColorProvider(); AppListColorProvider();
......
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