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

Light theme for login screen.

This CL adds light mode for login shelf buttons, text, icons,
and wallpaper.

Bug: 1110757
Change-Id: I1057aa89bf777f3f35564d7876256f9381059e8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363799Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMin Chen <minch@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarThomas Tellier <tellier@google.com>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803359}
parent 198d2546
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/public/cpp/login_constants.h" #include "ash/public/cpp/login_constants.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "ui/views/background.h" #include "ui/views/background.h"
...@@ -118,7 +119,7 @@ void LoginBigUserView::OnWallpaperBlurChanged() { ...@@ -118,7 +119,7 @@ void LoginBigUserView::OnWallpaperBlurChanged() {
layer()->SetFillsBoundsOpaquely(false); layer()->SetFillsBoundsOpaquely(false);
SetBackground(views::CreateBackgroundFromPainter( SetBackground(views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter( views::Painter::CreateSolidRoundRectPainter(
SkColorSetA(login_constants::kDefaultBaseColor, SkColorSetA(AshColorProvider::Get()->GetLoginBackgroundBaseColor(),
login_constants::kNonBlurredWallpaperBackgroundAlpha), login_constants::kNonBlurredWallpaperBackgroundAlpha),
login_constants::kNonBlurredWallpaperBackgroundRadiusDp))); login_constants::kNonBlurredWallpaperBackgroundRadiusDp)));
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ash/login/ui/views_utils.h" #include "ash/login/ui/views_utils.h"
#include "ash/public/cpp/login_constants.h" #include "ash/public/cpp/login_constants.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
...@@ -251,7 +252,7 @@ ScrollableUsersListView::GradientParams::BuildForStyle( ...@@ -251,7 +252,7 @@ ScrollableUsersListView::GradientParams::BuildForStyle(
color_utils::ColorProfile(color_utils::LumaRange::DARK, color_utils::ColorProfile(color_utils::LumaRange::DARK,
color_utils::SaturationRange::MUTED)); color_utils::SaturationRange::MUTED));
SkColor tint_color = color_utils::GetResultingPaintColor( SkColor tint_color = color_utils::GetResultingPaintColor(
SkColorSetA(login_constants::kDefaultBaseColor, SkColorSetA(AshColorProvider::Get()->GetLoginBackgroundBaseColor(),
login_constants::kTranslucentColorDarkenAlpha), login_constants::kTranslucentColorDarkenAlpha),
SkColorSetA(dark_muted_color, SK_AlphaOPAQUE)); SkColorSetA(dark_muted_color, SK_AlphaOPAQUE));
tint_color = tint_color =
...@@ -424,7 +425,7 @@ void ScrollableUsersListView::OnPaintBackground(gfx::Canvas* canvas) { ...@@ -424,7 +425,7 @@ void ScrollableUsersListView::OnPaintBackground(gfx::Canvas* canvas) {
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setStyle(cc::PaintFlags::kFill_Style); flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setColor( flags.setColor(
SkColorSetA(login_constants::kDefaultBaseColor, SkColorSetA(AshColorProvider::Get()->GetLoginBackgroundBaseColor(),
login_constants::kNonBlurredWallpaperBackgroundAlpha)); login_constants::kNonBlurredWallpaperBackgroundAlpha));
canvas->DrawRoundRect( canvas->DrawRoundRect(
render_bounds, login_constants::kNonBlurredWallpaperBackgroundRadiusDp, render_bounds, login_constants::kNonBlurredWallpaperBackgroundRadiusDp,
......
...@@ -18,17 +18,20 @@ namespace login_constants { ...@@ -18,17 +18,20 @@ namespace login_constants {
// extracted from wallpaper is invalid. // extracted from wallpaper is invalid.
constexpr SkColor kDefaultBaseColor = SK_ColorBLACK; constexpr SkColor kDefaultBaseColor = SK_ColorBLACK;
// The light mode base color of the login/lock screen when the color extracted
// from the wallpaper is invalid.
constexpr SkColor kLightModeBaseColor = SK_ColorWHITE;
// Color used on text associated with an auth method, e.g., password, // Color used on text associated with an auth method, e.g., password,
// fingerprint. // fingerprint.
constexpr SkColor kAuthMethodsTextColor = constexpr SkColor kAuthMethodsTextColor =
SkColorSetARGB(0xAB, 0xFF, 0xFF, 0xFF); SkColorSetARGB(0xAB, 0xFF, 0xFF, 0xFF);
// When the wallpaper is not blurred, a black background with this alpha should // When the wallpaper is not blurred, a background with this alpha should
// be rendered behind UI elements so they remain legible. // be rendered behind UI elements so they remain legible.
constexpr int kNonBlurredWallpaperBackgroundAlpha = 0xCC; // 0xCC -> 80% of 255 constexpr int kNonBlurredWallpaperBackgroundAlpha = 0xCC; // 0xCC -> 80% of 255
// Per above, the black background should be a rounded rect with this corner // Per above, the background should be a rounded rect with this corner radius.
// radius.
constexpr int kNonBlurredWallpaperBackgroundRadiusDp = 4; constexpr int kNonBlurredWallpaperBackgroundRadiusDp = 4;
// The alpha value for the login/lock screen background. // The alpha value for the login/lock screen background.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "ash/shelf/shelf_widget.h" #include "ash/shelf/shelf_widget.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "ash/system/status_area_widget_delegate.h" #include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/system_tray_notifier.h" #include "ash/system/tray/system_tray_notifier.h"
...@@ -72,6 +73,27 @@ namespace { ...@@ -72,6 +73,27 @@ namespace {
const char* kLoginShelfButtonClassName = "LoginShelfButton"; const char* kLoginShelfButtonClassName = "LoginShelfButton";
SkColor GetButtonTextColor() {
AshColorProvider* ash_color_provider = AshColorProvider::Get();
return ash_color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kButtonLabelColor,
AshColorProvider::AshColorMode::kDark);
}
SkColor GetButtonIconColor() {
AshColorProvider* ash_color_provider = AshColorProvider::Get();
return ash_color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kButtonIconColor,
AshColorProvider::AshColorMode::kDark);
}
SkColor GetButtonBackgroundColor() {
AshColorProvider* ash_color_provider = AshColorProvider::Get();
return ash_color_provider->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive,
AshColorProvider::AshColorMode::kDark);
}
LoginMetricsRecorder::ShelfButtonClickTarget GetUserClickTarget(int button_id) { LoginMetricsRecorder::ShelfButtonClickTarget GetUserClickTarget(int button_id) {
switch (button_id) { switch (button_id) {
case LoginShelfView::kShutdown: case LoginShelfView::kShutdown:
...@@ -106,15 +128,9 @@ constexpr int kButtonMarginRightDp = 16; ...@@ -106,15 +128,9 @@ constexpr int kButtonMarginRightDp = 16;
// Spacing between the button image and label. // Spacing between the button image and label.
constexpr int kImageLabelSpacingDp = 10; constexpr int kImageLabelSpacingDp = 10;
// The color of the button text.
constexpr SkColor kButtonTextColor = gfx::kGoogleGrey100;
// The color of the button text during OOBE. // The color of the button text during OOBE.
constexpr SkColor kButtonTextColorOobe = gfx::kGoogleGrey700; constexpr SkColor kButtonTextColorOobe = gfx::kGoogleGrey700;
// The color of the button icon.
constexpr SkColor kButtonIconColor = SkColorSetRGB(0xEB, 0xEA, 0xED);
void AnimateButtonOpacity(ui::Layer* layer, void AnimateButtonOpacity(ui::Layer* layer,
float target_opacity, float target_opacity,
base::TimeDelta animation_duration, base::TimeDelta animation_duration,
...@@ -155,11 +171,12 @@ class LoginShelfButton : public views::LabelButton { ...@@ -155,11 +171,12 @@ class LoginShelfButton : public views::LabelButton {
text_resource_id_(text_resource_id), text_resource_id_(text_resource_id),
icon_(icon) { icon_(icon) {
SetAccessibleName(GetText()); SetAccessibleName(GetText());
SkColor button_icon_color = GetButtonIconColor();
SetImage(views::Button::STATE_NORMAL, SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(icon, kButtonIconColor)); gfx::CreateVectorIcon(icon, button_icon_color));
SetImage(views::Button::STATE_DISABLED, SetImage(views::Button::STATE_DISABLED,
gfx::CreateVectorIcon( gfx::CreateVectorIcon(
icon, SkColorSetA(kButtonIconColor, icon, SkColorSetA(button_icon_color,
login_constants::kButtonDisabledAlpha))); login_constants::kButtonDisabledAlpha)));
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
SetInstallFocusRingOnFocus(true); SetInstallFocusRingOnFocus(true);
...@@ -181,10 +198,12 @@ class LoginShelfButton : public views::LabelButton { ...@@ -181,10 +198,12 @@ class LoginShelfButton : public views::LabelButton {
SetTextSubpixelRenderingEnabled(false); SetTextSubpixelRenderingEnabled(false);
SetImageLabelSpacing(kImageLabelSpacingDp); SetImageLabelSpacing(kImageLabelSpacingDp);
SetEnabledTextColors(kButtonTextColor);
SkColor button_text_color = GetButtonTextColor();
SetEnabledTextColors(button_text_color);
SetTextColor( SetTextColor(
views::Button::STATE_DISABLED, views::Button::STATE_DISABLED,
SkColorSetA(kButtonTextColor, login_constants::kButtonDisabledAlpha)); SkColorSetA(button_text_color, login_constants::kButtonDisabledAlpha));
label()->SetFontList(views::Label::GetDefaultFontList().Derive( label()->SetFontList(views::Label::GetDefaultFontList().Derive(
1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL)); 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL));
} }
...@@ -205,7 +224,7 @@ class LoginShelfButton : public views::LabelButton { ...@@ -205,7 +224,7 @@ class LoginShelfButton : public views::LabelButton {
void PaintButtonContents(gfx::Canvas* canvas) override { void PaintButtonContents(gfx::Canvas* canvas) override {
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setColor(ShelfConfig::Get()->GetShelfControlButtonColor()); flags.setColor(GetButtonBackgroundColor());
flags.setStyle(cc::PaintFlags::kFill_Style); flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(GetButtonHighlightPath(this), flags); canvas->DrawPath(GetButtonHighlightPath(this), flags);
} }
...@@ -231,9 +250,10 @@ class LoginShelfButton : public views::LabelButton { ...@@ -231,9 +250,10 @@ class LoginShelfButton : public views::LabelButton {
} }
void PaintLightColors() { void PaintLightColors() {
SetEnabledTextColors(kButtonTextColor); SkColor button_text_color = GetButtonTextColor();
SetEnabledTextColors(button_text_color);
SetImage(views::Button::STATE_NORMAL, SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(icon_, kButtonTextColor)); gfx::CreateVectorIcon(icon_, button_text_color));
SchedulePaint(); SchedulePaint();
} }
...@@ -293,9 +313,9 @@ class KioskAppsButton : public views::MenuButton, ...@@ -293,9 +313,9 @@ class KioskAppsButton : public views::MenuButton,
SetTextSubpixelRenderingEnabled(false); SetTextSubpixelRenderingEnabled(false);
SetImage(views::Button::STATE_NORMAL, SetImage(views::Button::STATE_NORMAL,
CreateVectorIcon(kShelfAppsButtonIcon, kButtonIconColor)); CreateVectorIcon(kShelfAppsButtonIcon, GetButtonIconColor()));
SetImageLabelSpacing(kImageLabelSpacingDp); SetImageLabelSpacing(kImageLabelSpacingDp);
SetEnabledTextColors(kButtonTextColor); SetEnabledTextColors(GetButtonTextColor());
label()->SetFontList(views::Label::GetDefaultFontList().Derive( label()->SetFontList(views::Label::GetDefaultFontList().Derive(
1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL)); 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL));
} }
...@@ -371,9 +391,9 @@ class KioskAppsButton : public views::MenuButton, ...@@ -371,9 +391,9 @@ class KioskAppsButton : public views::MenuButton,
} }
void PaintLightColors() { void PaintLightColors() {
SetEnabledTextColors(kButtonTextColor); SetEnabledTextColors(GetButtonTextColor());
SetImage(views::Button::STATE_NORMAL, SetImage(views::Button::STATE_NORMAL,
CreateVectorIcon(kShelfAppsButtonIcon, kButtonIconColor)); CreateVectorIcon(kShelfAppsButtonIcon, GetButtonIconColor()));
SchedulePaint(); SchedulePaint();
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_background_animator_observer.h" #include "ash/shelf/shelf_background_animator_observer.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
...@@ -242,7 +243,7 @@ SkColor ShelfBackgroundAnimator::GetBackgroundColor( ...@@ -242,7 +243,7 @@ SkColor ShelfBackgroundAnimator::GetBackgroundColor(
break; break;
case ShelfBackgroundType::kLoginNonBlurredWallpaper: case ShelfBackgroundType::kLoginNonBlurredWallpaper:
shelf_target_color = shelf_target_color =
SkColorSetA(login_constants::kDefaultBaseColor, SkColorSetA(AshColorProvider::Get()->GetLoginBackgroundBaseColor(),
login_constants::kNonBlurredWallpaperBackgroundAlpha); login_constants::kNonBlurredWallpaperBackgroundAlpha);
break; break;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/public/cpp/ash_constants.h" #include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/login_constants.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/system/dark_mode/color_mode_observer.h" #include "ash/system/dark_mode/color_mode_observer.h"
...@@ -116,6 +117,11 @@ void AshColorProvider::OnActiveUserPrefServiceChanged(PrefService* prefs) { ...@@ -116,6 +117,11 @@ void AshColorProvider::OnActiveUserPrefServiceChanged(PrefService* prefs) {
NotifyDarkModeEnabledPrefChange(); NotifyDarkModeEnabledPrefChange();
} }
SkColor AshColorProvider::GetLoginBackgroundBaseColor() const {
return IsDarkModeEnabled() ? login_constants::kDefaultBaseColor
: login_constants::kLightModeBaseColor;
}
SkColor AshColorProvider::DeprecatedGetShieldLayerColor( SkColor AshColorProvider::DeprecatedGetShieldLayerColor(
ShieldLayerType type, ShieldLayerType type,
SkColor default_color) const { SkColor default_color) const {
......
...@@ -236,6 +236,9 @@ class ASH_EXPORT AshColorProvider : public SessionObserver { ...@@ -236,6 +236,9 @@ class ASH_EXPORT AshColorProvider : public SessionObserver {
// Toggles pref |kDarkModeEnabled|. // Toggles pref |kDarkModeEnabled|.
void Toggle(); void Toggle();
// Gets the background base color for login screen.
SkColor GetLoginBackgroundBaseColor() const;
bool is_themed() const { return is_themed_; } bool is_themed() const { return is_themed_; }
private: private:
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ash/public/cpp/login_constants.h" #include "ash/public/cpp/login_constants.h"
#include "ash/public/cpp/wallpaper_types.h" #include "ash/public/cpp/wallpaper_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
...@@ -29,11 +30,12 @@ SkColor GetWallpaperDarkenColor() { ...@@ -29,11 +30,12 @@ SkColor GetWallpaperDarkenColor() {
Shell::Get()->wallpaper_controller()->GetProminentColor( Shell::Get()->wallpaper_controller()->GetProminentColor(
color_utils::ColorProfile(color_utils::LumaRange::DARK, color_utils::ColorProfile(color_utils::LumaRange::DARK,
color_utils::SaturationRange::MUTED)); color_utils::SaturationRange::MUTED));
if (darken_color == kInvalidWallpaperColor) if (darken_color == kInvalidWallpaperColor) {
darken_color = login_constants::kDefaultBaseColor; darken_color = AshColorProvider::Get()->GetLoginBackgroundBaseColor();
}
darken_color = color_utils::GetResultingPaintColor( darken_color = color_utils::GetResultingPaintColor(
SkColorSetA(login_constants::kDefaultBaseColor, SkColorSetA(AshColorProvider::Get()->GetLoginBackgroundBaseColor(),
login_constants::kTranslucentColorDarkenAlpha), login_constants::kTranslucentColorDarkenAlpha),
SkColorSetA(darken_color, 0xFF)); SkColorSetA(darken_color, 0xFF));
......
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