Commit bc36203c authored by Mariam Ali's avatar Mariam Ali Committed by Commit Bot

Add header asset native ui colors

This CL adds new color ids and colors for the avatar header assets for
incognito and guest modes using the old method by setting them manually
and the new method by extracting the colors from existing core colors.

Aligning colors in incognito and guest for both the header asset and
the avatar icon.

Screenshots:
https://screenshot.googleplex.com/BNC82JK2UkZR5eb.png

Bug: 1105763
Change-Id: Idcc27c87b081f22429c7342c042d39e721d6ef86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418654
Commit-Queue: Mariam Ali <alimariam@google.com>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814749}
parent ddae81d0
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu.h" #include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
#include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#include "ui/native_theme/native_theme.h"
#include "url/url_canon.h" #include "url/url_canon.h"
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -351,6 +353,10 @@ constexpr size_t kPlaceholderAvatarIndex = 0; ...@@ -351,6 +353,10 @@ constexpr size_t kPlaceholderAvatarIndex = 0;
#endif #endif
ui::ImageModel GetGuestAvatar(int size) { ui::ImageModel GetGuestAvatar(int size) {
if (base::FeatureList::IsEnabled(features::kNewProfilePicker)) {
return ui::ImageModel::FromVectorIcon(
kUserAccountAvatarIcon, ui::NativeTheme::kColorId_AvatarIcon, size);
}
return ui::ImageModel::FromVectorIcon(kUserAccountAvatarIcon, return ui::ImageModel::FromVectorIcon(kUserAccountAvatarIcon,
gfx::kGoogleGrey500, size); gfx::kGoogleGrey500, size);
} }
......
...@@ -52,16 +52,15 @@ void IncognitoMenuView::BuildMenu() { ...@@ -52,16 +52,15 @@ void IncognitoMenuView::BuildMenu() {
int incognito_window_count = int incognito_window_count =
BrowserList::GetOffTheRecordBrowsersActiveForProfile( BrowserList::GetOffTheRecordBrowsersActiveForProfile(
browser()->profile()); browser()->profile());
// TODO(crbug.com/1105763): Add asset colors to native theme and update icon
// temporary color placeholder to align with the design deck colors. ui::ThemedVectorIcon header_art_icon(
ui::ThemedVectorIcon header_art_icon(&kIncognitoMenuArtIcon, &kIncognitoMenuArtIcon, ui::NativeTheme::kColorId_AvatarHeaderArt);
ui::NativeTheme::kColorId_MenuIconColor);
SetProfileIdentityInfo( SetProfileIdentityInfo(
/*profile_name=*/base::string16(), /*profile_name=*/base::string16(),
/*background_color=*/SK_ColorTRANSPARENT, /*background_color=*/SK_ColorTRANSPARENT,
/*edit_button=*/base::nullopt, /*edit_button=*/base::nullopt,
ui::ImageModel::FromVectorIcon( ui::ImageModel::FromVectorIcon(kIncognitoProfileIcon,
kIncognitoProfileIcon, ui::NativeTheme::kColorId_BubbleForeground), ui::NativeTheme::kColorId_AvatarIcon),
l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_TITLE), l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_TITLE),
incognito_window_count > 1 incognito_window_count > 1
? l10n_util::GetPluralStringFUTF16(IDS_INCOGNITO_WINDOW_COUNT_MESSAGE, ? l10n_util::GetPluralStringFUTF16(IDS_INCOGNITO_WINDOW_COUNT_MESSAGE,
......
...@@ -491,10 +491,8 @@ void ProfileMenuView::BuildGuestIdentity() { ...@@ -491,10 +491,8 @@ void ProfileMenuView::BuildGuestIdentity() {
guest_window_count); guest_window_count);
} }
// TODO(crbug.com/1105763): Add asset colors to native theme and update icon ui::ThemedVectorIcon header_art_icon(
// temporary color placeholder to align with the design deck colors. &kGuestMenuArtIcon, ui::NativeTheme::kColorId_AvatarHeaderArt);
ui::ThemedVectorIcon header_art_icon(&kGuestMenuArtIcon,
ui::NativeTheme::kColorId_MenuIconColor);
SetProfileIdentityInfo( SetProfileIdentityInfo(
/*profile_name=*/base::string16(), /*profile_name=*/base::string16(),
/*background_color=*/SK_ColorTRANSPARENT, /*background_color=*/SK_ColorTRANSPARENT,
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
E(kColorAlertHighSeverity, NativeTheme::kColorId_AlertSeverityHigh) \ E(kColorAlertHighSeverity, NativeTheme::kColorId_AlertSeverityHigh) \
E(kColorAlertLowSeverity, NativeTheme::kColorId_AlertSeverityLow) \ E(kColorAlertLowSeverity, NativeTheme::kColorId_AlertSeverityLow) \
E(kColorAlertMediumSeverity, NativeTheme::kColorId_AlertSeverityMedium) \ E(kColorAlertMediumSeverity, NativeTheme::kColorId_AlertSeverityMedium) \
E_CPONLY(kColorBorderAndSeparatorForeground) \
E_CPONLY(kColorDisabledForeground) \ E_CPONLY(kColorDisabledForeground) \
E_CPONLY(kColorItemSelectionBackground) \ E_CPONLY(kColorItemSelectionBackground) \
E_CPONLY(kColorMidground) \
E_CPONLY(kColorPrimaryBackground) \ E_CPONLY(kColorPrimaryBackground) \
E_CPONLY(kColorPrimaryForeground) \ E_CPONLY(kColorPrimaryForeground) \
E_CPONLY(kColorSecondaryForeground) \ E_CPONLY(kColorSecondaryForeground) \
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
E_CPONLY(kColorTextSelectionBackground) \ E_CPONLY(kColorTextSelectionBackground) \
\ \
/* Further UI element colors */ \ /* Further UI element colors */ \
E(kColorAvatarHeaderArt, NativeTheme::kColorId_AvatarHeaderArt) \
E(kColorAvatarIcon, NativeTheme::kColorId_AvatarIcon) \
E(kColorBubbleBackground, NativeTheme::kColorId_BubbleBackground) \ E(kColorBubbleBackground, NativeTheme::kColorId_BubbleBackground) \
E(kColorBubbleFooterBackground, \ E(kColorBubbleFooterBackground, \
NativeTheme::kColorId_BubbleFooterBackground) \ NativeTheme::kColorId_BubbleFooterBackground) \
......
...@@ -28,7 +28,7 @@ ColorMixer& AddMixerForDarkMode(ColorProvider* provider) { ...@@ -28,7 +28,7 @@ ColorMixer& AddMixerForDarkMode(ColorProvider* provider) {
{kColorAlertHighSeverity, gfx::kGoogleRed300}, {kColorAlertHighSeverity, gfx::kGoogleRed300},
{kColorAlertLowSeverity, gfx::kGoogleGreen300}, {kColorAlertLowSeverity, gfx::kGoogleGreen300},
{kColorAlertMediumSeverity, gfx::kGoogleYellow300}, {kColorAlertMediumSeverity, gfx::kGoogleYellow300},
{kColorBorderAndSeparatorForeground, gfx::kGoogleGrey800}, {kColorMidground, gfx::kGoogleGrey800},
{kColorPrimaryBackground, SkColorSetRGB(0x29, 0x2A, 0x2D)}, {kColorPrimaryBackground, SkColorSetRGB(0x29, 0x2A, 0x2D)},
{kColorPrimaryForeground, gfx::kGoogleGrey200}, {kColorPrimaryForeground, gfx::kGoogleGrey200},
{kColorSecondaryForeground, gfx::kGoogleGrey500}, {kColorSecondaryForeground, gfx::kGoogleGrey500},
...@@ -46,7 +46,7 @@ ColorMixer& AddMixerForLightMode(ColorProvider* provider) { ...@@ -46,7 +46,7 @@ ColorMixer& AddMixerForLightMode(ColorProvider* provider) {
{kColorAlertHighSeverity, gfx::kGoogleRed600}, {kColorAlertHighSeverity, gfx::kGoogleRed600},
{kColorAlertLowSeverity, gfx::kGoogleGreen700}, {kColorAlertLowSeverity, gfx::kGoogleGreen700},
{kColorAlertMediumSeverity, gfx::kGoogleYellow700}, {kColorAlertMediumSeverity, gfx::kGoogleYellow700},
{kColorBorderAndSeparatorForeground, gfx::kGoogleGrey300}, {kColorMidground, gfx::kGoogleGrey300},
{kColorPrimaryBackground, SK_ColorWHITE}, {kColorPrimaryBackground, SK_ColorWHITE},
{kColorPrimaryForeground, gfx::kGoogleGrey900}, {kColorPrimaryForeground, gfx::kGoogleGrey900},
{kColorSecondaryForeground, gfx::kGoogleGrey700}, {kColorSecondaryForeground, gfx::kGoogleGrey700},
......
...@@ -17,10 +17,12 @@ void AddUiColorMixer(ColorProvider* provider) { ...@@ -17,10 +17,12 @@ void AddUiColorMixer(ColorProvider* provider) {
const auto button_disabled_background = const auto button_disabled_background =
BlendForMinContrastWithSelf(kColorButtonBackground, 1.2f); BlendForMinContrastWithSelf(kColorButtonBackground, 1.2f);
mixer[kColorAvatarHeaderArt] = {kColorMidground};
mixer[kColorAvatarIcon] = {kColorPrimaryForeground};
mixer[kColorBubbleBackground] = {kColorPrimaryBackground}; mixer[kColorBubbleBackground] = {kColorPrimaryBackground};
mixer[kColorBubbleFooterBackground] = {kColorSubtleEmphasisBackground}; mixer[kColorBubbleFooterBackground] = {kColorSubtleEmphasisBackground};
mixer[kColorButtonBackground] = {kColorPrimaryBackground}; mixer[kColorButtonBackground] = {kColorPrimaryBackground};
mixer[kColorButtonBorder] = {kColorBorderAndSeparatorForeground}; mixer[kColorButtonBorder] = {kColorMidground};
mixer[kColorButtonBorderDisabled] = button_disabled_background; mixer[kColorButtonBorderDisabled] = button_disabled_background;
mixer[kColorButtonForegroundDisabled] = {kColorDisabledForeground}; mixer[kColorButtonForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorButtonForeground] = {kColorAccent}; mixer[kColorButtonForeground] = {kColorAccent};
...@@ -35,7 +37,7 @@ void AddUiColorMixer(ColorProvider* provider) { ...@@ -35,7 +37,7 @@ void AddUiColorMixer(ColorProvider* provider) {
mixer[kColorDialogBackground] = {kColorPrimaryBackground}; mixer[kColorDialogBackground] = {kColorPrimaryBackground};
mixer[kColorDialogForeground] = {kColorSecondaryForeground}; mixer[kColorDialogForeground] = {kColorSecondaryForeground};
mixer[kColorFocusableBorderFocused] = SetAlpha(kColorAccent, 0x4D); mixer[kColorFocusableBorderFocused] = SetAlpha(kColorAccent, 0x4D);
mixer[kColorFocusableBorderUnfocused] = {kColorBorderAndSeparatorForeground}; mixer[kColorFocusableBorderUnfocused] = {kColorMidground};
mixer[kColorIcon] = {kColorSecondaryForeground}; mixer[kColorIcon] = {kColorSecondaryForeground};
mixer[kColorMenuIcon] = {kColorIcon}; mixer[kColorMenuIcon] = {kColorIcon};
mixer[kColorLabelForegroundDisabled] = {kColorDisabledForeground}; mixer[kColorLabelForegroundDisabled] = {kColorDisabledForeground};
...@@ -47,7 +49,7 @@ void AddUiColorMixer(ColorProvider* provider) { ...@@ -47,7 +49,7 @@ void AddUiColorMixer(ColorProvider* provider) {
mixer[kColorLinkForegroundPressed] = {kColorLinkForeground}; mixer[kColorLinkForegroundPressed] = {kColorLinkForeground};
mixer[kColorLinkForeground] = {kColorAccent}; mixer[kColorLinkForeground] = {kColorAccent};
mixer[kColorMenuBackground] = {kColorPrimaryBackground}; mixer[kColorMenuBackground] = {kColorPrimaryBackground};
mixer[kColorMenuBorder] = {kColorBorderAndSeparatorForeground}; mixer[kColorMenuBorder] = {kColorMidground};
mixer[kColorMenuItemBackgroundAlertedInitial] = SetAlpha(kColorAccent, 0x4D); mixer[kColorMenuItemBackgroundAlertedInitial] = SetAlpha(kColorAccent, 0x4D);
mixer[kColorMenuItemBackgroundAlertedTarget] = SetAlpha(kColorAccent, 0x1A); mixer[kColorMenuItemBackgroundAlertedTarget] = SetAlpha(kColorAccent, 0x1A);
mixer[kColorMenuItemForegroundDisabled] = {kColorDisabledForeground}; mixer[kColorMenuItemForegroundDisabled] = {kColorDisabledForeground};
...@@ -57,8 +59,8 @@ void AddUiColorMixer(ColorProvider* provider) { ...@@ -57,8 +59,8 @@ void AddUiColorMixer(ColorProvider* provider) {
mixer[kColorMenuItemForegroundSecondary] = {kColorSecondaryForeground}; mixer[kColorMenuItemForegroundSecondary] = {kColorSecondaryForeground};
mixer[kColorMenuItemBackgroundSelected] = {kColorItemSelectionBackground}; mixer[kColorMenuItemBackgroundSelected] = {kColorItemSelectionBackground};
mixer[kColorMenuItemForegroundSelected] = {kColorMenuItemForeground}; mixer[kColorMenuItemForegroundSelected] = {kColorMenuItemForeground};
mixer[kColorMenuSeparator] = {kColorBorderAndSeparatorForeground}; mixer[kColorMenuSeparator] = {kColorMidground};
mixer[kColorTabContentSeparator] = {kColorBorderAndSeparatorForeground}; mixer[kColorTabContentSeparator] = {kColorMidground};
mixer[kColorTabForeground] = {kColorSecondaryForeground}; mixer[kColorTabForeground] = {kColorSecondaryForeground};
mixer[kColorTabBorderSelected] = {kColorAccent}; mixer[kColorTabBorderSelected] = {kColorAccent};
mixer[kColorTabForegroundSelected] = {kColorAccent}; mixer[kColorTabForegroundSelected] = {kColorAccent};
...@@ -67,7 +69,7 @@ void AddUiColorMixer(ColorProvider* provider) { ...@@ -67,7 +69,7 @@ void AddUiColorMixer(ColorProvider* provider) {
mixer[kColorTableGroupingIndicator] = {kColorTableBackgroundSelectedFocused}; mixer[kColorTableGroupingIndicator] = {kColorTableBackgroundSelectedFocused};
mixer[kColorTableHeaderBackground] = {kColorTableBackground}; mixer[kColorTableHeaderBackground] = {kColorTableBackground};
mixer[kColorTableHeaderForeground] = {kColorTableForeground}; mixer[kColorTableHeaderForeground] = {kColorTableForeground};
mixer[kColorTableHeaderSeparator] = {kColorBorderAndSeparatorForeground}; mixer[kColorTableHeaderSeparator] = {kColorMidground};
mixer[kColorTableBackgroundSelectedFocused] = {kColorItemSelectionBackground}; mixer[kColorTableBackgroundSelectedFocused] = {kColorItemSelectionBackground};
mixer[kColorTableForegroundSelectedFocused] = {kColorTableForeground}; mixer[kColorTableForegroundSelectedFocused] = {kColorTableForeground};
mixer[kColorTableBackgroundSelectedUnfocused] = { mixer[kColorTableBackgroundSelectedUnfocused] = {
......
...@@ -81,7 +81,7 @@ base::Optional<SkColor> SkColorFromColorId( ...@@ -81,7 +81,7 @@ base::Optional<SkColor> SkColorFromColorId(
case ui::NativeTheme::kColorId_NotificationDefaultBackground: case ui::NativeTheme::kColorId_NotificationDefaultBackground:
return GetBgColor(""); return GetBgColor("");
case ui::NativeTheme::kColorId_DialogForeground: case ui::NativeTheme::kColorId_DialogForeground:
case ui::NativeTheme::kColorId_BubbleForeground: case ui::NativeTheme::kColorId_AvatarIcon:
return GetFgColor("GtkLabel"); return GetFgColor("GtkLabel");
case ui::NativeTheme::kColorId_BubbleFooterBackground: case ui::NativeTheme::kColorId_BubbleFooterBackground:
return GetBgColor("#statusbar"); return GetBgColor("#statusbar");
...@@ -126,6 +126,7 @@ base::Optional<SkColor> SkColorFromColorId( ...@@ -126,6 +126,7 @@ base::Optional<SkColor> SkColorFromColorId(
return GetFgColor( return GetFgColor(
"GtkMenu#menu GtkMenuItem#menuitem GtkLabel.accelerator"); "GtkMenu#menu GtkMenuItem#menuitem GtkLabel.accelerator");
case ui::NativeTheme::kColorId_MenuSeparatorColor: case ui::NativeTheme::kColorId_MenuSeparatorColor:
case ui::NativeTheme::kColorId_AvatarHeaderArt:
if (GtkCheckVersion(3, 20)) { if (GtkCheckVersion(3, 20)) {
return GetSeparatorColor( return GetSeparatorColor(
"GtkMenu#menu GtkSeparator#separator.horizontal"); "GtkMenu#menu GtkSeparator#separator.horizontal");
......
...@@ -74,10 +74,12 @@ base::Optional<SkColor> GetDarkSchemeColor(NativeTheme::ColorId color_id) { ...@@ -74,10 +74,12 @@ base::Optional<SkColor> GetDarkSchemeColor(NativeTheme::ColorId color_id) {
return color_utils::AlphaBlend(SK_ColorWHITE, gfx::kGoogleGrey900, 0.04f); return color_utils::AlphaBlend(SK_ColorWHITE, gfx::kGoogleGrey900, 0.04f);
case NativeTheme::kColorId_DialogForeground: case NativeTheme::kColorId_DialogForeground:
return gfx::kGoogleGrey500; return gfx::kGoogleGrey500;
case NativeTheme::kColorId_BubbleForeground:
return gfx::kGoogleGrey200;
case NativeTheme::kColorId_BubbleFooterBackground: case NativeTheme::kColorId_BubbleFooterBackground:
return SkColorSetRGB(0x32, 0x36, 0x39); return SkColorSetRGB(0x32, 0x36, 0x39);
case NativeTheme::kColorId_AvatarHeaderArt:
return gfx::kGoogleGrey800;
case NativeTheme::kColorId_AvatarIcon:
return gfx::kGoogleGrey200;
// FocusableBorder // FocusableBorder
case NativeTheme::kColorId_FocusedBorderColor: case NativeTheme::kColorId_FocusedBorderColor:
...@@ -249,10 +251,12 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, ...@@ -249,10 +251,12 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id,
case NativeTheme::kColorId_BubbleBackground: case NativeTheme::kColorId_BubbleBackground:
case NativeTheme::kColorId_NotificationDefaultBackground: case NativeTheme::kColorId_NotificationDefaultBackground:
return SK_ColorWHITE; return SK_ColorWHITE;
case NativeTheme::kColorId_AvatarHeaderArt:
return gfx::kGoogleGrey300;
case NativeTheme::kColorId_AvatarIcon:
return kPrimaryTextColor;
case NativeTheme::kColorId_DialogForeground: case NativeTheme::kColorId_DialogForeground:
return gfx::kGoogleGrey700; return gfx::kGoogleGrey700;
case NativeTheme::kColorId_BubbleForeground:
return kPrimaryTextColor;
case NativeTheme::kColorId_BubbleFooterBackground: case NativeTheme::kColorId_BubbleFooterBackground:
return gfx::kGoogleGrey050; return gfx::kGoogleGrey050;
......
...@@ -36,6 +36,8 @@ NativeThemeColorIdToColorIdMap() { ...@@ -36,6 +36,8 @@ NativeThemeColorIdToColorIdMap() {
{NTCID::kColorId_AlertSeverityHigh, kColorAlertHighSeverity}, {NTCID::kColorId_AlertSeverityHigh, kColorAlertHighSeverity},
{NTCID::kColorId_AlertSeverityLow, kColorAlertLowSeverity}, {NTCID::kColorId_AlertSeverityLow, kColorAlertLowSeverity},
{NTCID::kColorId_AlertSeverityMedium, kColorAlertMediumSeverity}, {NTCID::kColorId_AlertSeverityMedium, kColorAlertMediumSeverity},
{NTCID::kColorId_AvatarHeaderArt, kColorAvatarHeaderArt},
{NTCID::kColorId_AvatarIcon, kColorAvatarIcon},
{NTCID::kColorId_BubbleBackground, kColorBubbleBackground}, {NTCID::kColorId_BubbleBackground, kColorBubbleBackground},
{NTCID::kColorId_BubbleFooterBackground, {NTCID::kColorId_BubbleFooterBackground,
kColorBubbleFooterBackground}, kColorBubbleFooterBackground},
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
OP(kColorId_DialogBackground), \ OP(kColorId_DialogBackground), \
OP(kColorId_DialogForeground), \ OP(kColorId_DialogForeground), \
OP(kColorId_BubbleBackground), \ OP(kColorId_BubbleBackground), \
OP(kColorId_BubbleForeground), \
OP(kColorId_BubbleFooterBackground), \ OP(kColorId_BubbleFooterBackground), \
/* Avatar and Header Asset */ \
OP(kColorId_AvatarHeaderArt), \
OP(kColorId_AvatarIcon), \
/* FocusableBorder */ \ /* FocusableBorder */ \
OP(kColorId_FocusedBorderColor), \ OP(kColorId_FocusedBorderColor), \
OP(kColorId_UnfocusedBorderColor), \ OP(kColorId_UnfocusedBorderColor), \
......
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