0

Migrated views::Label::SetEnabledColor() to use ui::ColorVariant

This CL also removes `u/v/examples/examples_themed_label.*` as
ThemedLabel wrapper class is not required to support ColorIds.

Bug: b:394420459
Change-Id: Ia1920e5dbd1d11f0bf8e71c981dc75c50541b2a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6267139
Commit-Queue: Zoraiz Naeem <zoraiznaeem@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424821}
This commit is contained in:
Zoraiz Naeem
2025-02-25 15:09:30 -08:00
committed by Chromium LUCI CQ
parent e9035d05b9
commit 2abbd4438f
237 changed files with 497 additions and 600 deletions
ash
app_list
assistant
auth
bubble
capture_mode
clipboard
controls
game_dashboard
glanceables
in_session_auth
login
quick_insert
search_box
shelf
style
system
accessibility
audio
bluetooth
cast
channel_indicator
eche
focus_mode
holding_space
hotspot
ime_menu
keyboard_brightness
locale
magic_boost
mahi
nearby_share
network
notification_center
palette
power
time
toast
tray
unified
video_conference
wm
chrome/browser
ash
arc
ui
ash
toasts
views
autofill
commerce
content_setting_bubble_contents.cc
controls
desktop_capture
download
extensions
find_bar_view.cc
global_media_controls
location_bar
mahi
media_preview
overlay
page_info
passwords
payments
permissions
plus_addresses
promos
side_panel
tabs
toolbar
webauthn
webid
chromeos
ash
components
magic_boost
ui
frame
components
ui/views

@ -659,7 +659,7 @@ AppListItemView::AppListItemView(const AppListConfig* app_list_config,
? TypographyToken::kCrosAnnotation1
: TypographyToken::kCrosButton2,
*title);
title->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
icon_background_ = AddChildView(std::make_unique<views::View>());
icon_background_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);

@ -80,7 +80,7 @@ AppsCollectionsDismissDialog::AppsCollectionsDismissDialog(
AddChildView(std::make_unique<views::Label>(l10n_util::GetStringUTF16(
IDS_ASH_LAUNCHER_APPS_COLLECTIONS_DISMISS_DIALOG_TITLE)));
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosTitle1, *title_);
title_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_->SetAutoColorReadabilityEnabled(false);
// Needs to paint to layer so it's stacked above `this` view.
@ -98,7 +98,7 @@ AppsCollectionsDismissDialog::AppsCollectionsDismissDialog(
gfx::Insets::TLBR(kMarginBetweenTitleAndBody, 0,
kMarginBetweenBodyAndButtons, 0));
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody1, *body);
body->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
body->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
body->SetHorizontalAlignment(gfx::ALIGN_LEFT);
body->SetMultiLine(true);
body->SetAllowCharacterBreak(true);

@ -89,7 +89,7 @@ SearchResultImageListView::SearchResultImageListView(
l10n_util::GetStringUTF16(IDS_ASH_SEARCH_RESULT_CATEGORY_LABEL_IMAGES)));
title_label_->SetBackgroundColor(SK_ColorTRANSPARENT);
title_label_->SetAutoColorReadabilityEnabled(false);
title_label_->SetEnabledColorId(kColorAshTextColorSecondary);
title_label_->SetEnabledColor(kColorAshTextColorSecondary);
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label_->SetBorder(views::CreateEmptyBorder(gfx::Insets::TLBR(
kPreferredTitleTopMargins, kPreferredTitleHorizontalMargins,
@ -160,12 +160,12 @@ SearchResultImageListView::SearchResultImageListView(
content_label->SetAllowCharacterBreak(true);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton1,
*content_label);
content_label->SetEnabledColorId(cros_tokens::kColorPrimary);
content_label->SetEnabledColor(cros_tokens::kColorPrimary);
} else {
content_label->SetElideBehavior(gfx::ElideBehavior::ELIDE_MIDDLE);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*content_label);
content_label->SetEnabledColorId(cros_tokens::kTextColorSecondary);
content_label->SetEnabledColor(cros_tokens::kTextColorSecondary);
}
metadata_content_labels_.push_back(content_label.get());

@ -102,15 +102,15 @@ void SearchResultInlineIconView::SetText(const std::u16string& text) {
label_->SetVisible(true);
if (ash::features::IsSearchCustomizableShortcutsInLauncherEnabled()) {
label_->SetEnabledColorId(
use_modified_styling_ ? cros_tokens::kCrosSysSystemOnPrimaryContainer
: cros_tokens::kCrosSysOnSurface);
label_->SetEnabledColor(use_modified_styling_
? cros_tokens::kCrosSysSystemOnPrimaryContainer
: cros_tokens::kCrosSysOnSurface);
label_->SetBackground(views::CreateThemedRoundedRectBackground(
use_modified_styling_ ? cros_tokens::kCrosSysSystemPrimaryContainer
: cros_tokens::kCrosSysSurface,
kContentCornerRadius));
} else {
label_->SetEnabledColorId(cros_tokens::kCrosSysPrimary);
label_->SetEnabledColor(cros_tokens::kCrosSysPrimary);
}
int label_left_right_margin =

@ -92,7 +92,7 @@ SearchResultListView::SearchResultListView(
title_label_->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*title_label_);
title_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
title_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label_->SetBorder(views::CreateEmptyBorder(gfx::Insets::TLBR(

@ -240,7 +240,7 @@ views::Label* SetupChildLabelView(
label->GetViewAccessibility().SetIsIgnored(true);
label->SetBackgroundColor(SK_ColorTRANSPARENT);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColorId(color_id);
label->SetEnabledColor(color_id);
label->SetVisible(false);
label->SetElideBehavior(overflow_behavior ==
SearchResultTextItem::OverflowBehavior::kElide

@ -106,7 +106,7 @@ TopIconAnimationView::TopIconAnimationView(AppsGridView* grid,
? TypographyToken::kCrosAnnotation1
: TypographyToken::kCrosButton2,
*title_label);
title_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title_label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
title_label->SetLineHeight(app_list_config->app_title_max_line_height());
title_label->SetText(title);
if (item_in_folder_icon_) {

@ -137,7 +137,7 @@ void AssistantZeroStateView::InitLayout() {
greeting_label_->SetText(
l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_PROMPT_DEFAULT));
greeting_label_->SetBackgroundColor(kColorAshAssistantBgPlate);
greeting_label_->SetEnabledColorId(kColorAshAssistantTextColorPrimary);
greeting_label_->SetEnabledColor(kColorAshAssistantTextColorPrimary);
// Spacer.
spacer_ = AddChildView(std::make_unique<views::View>());

@ -172,13 +172,13 @@ LauncherSearchIphView::LauncherSearchIphView(
title_label_ = text_container->AddChildView(std::make_unique<views::Label>(
l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_TITLE)));
title_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_TO_HEAD);
title_label_->SetEnabledColorId(kColorAshTextColorPrimary);
title_label_->SetEnabledColor(kColorAshTextColorPrimary);
title_label_->GetViewAccessibility().SetRole(ax::mojom::Role::kHeading);
views::Label* description_label = text_container->AddChildView(
std::make_unique<views::Label>(l10n_util::GetStringUTF16(
IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_DESCRIPTION)));
description_label->SetEnabledColorId(kColorAshTextColorPrimary);
description_label->SetEnabledColor(kColorAshTextColorPrimary);
const TypographyProvider* typography_provider = TypographyProvider::Get();
DCHECK(typography_provider) << "TypographyProvider must not be null";

@ -99,7 +99,7 @@ AuthHeaderView::AuthHeaderView(const AccountId& account_id,
views::style::STYLE_PRIMARY);
title_label_->SetMultiLine(true);
title_label_->SizeToFit(kTitleLineWidthDp);
title_label_->SetEnabledColorId(kTitleColorId);
title_label_->SetEnabledColor(kTitleColorId);
title_label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kTitleFont));
title_label_->GetViewAccessibility().SetRole(ax::mojom::Role::kTitleBar);
@ -115,7 +115,7 @@ AuthHeaderView::AuthHeaderView(const AccountId& account_id,
description, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY);
description_label_->SetMultiLine(true);
description_label_->SizeToFit(kDescriptionLineWidthDp);
description_label_->SetEnabledColorId(kDescriptionColorId);
description_label_->SetEnabledColor(kDescriptionColorId);
description_label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kDescriptionFont));
decorate_label(description_label_);
@ -140,7 +140,7 @@ gfx::Size AuthHeaderView::CalculatePreferredSize(
void AuthHeaderView::SetErrorTitle(const std::u16string& error_str) {
title_label_->SetText(error_str);
title_label_->SetEnabledColorId(kTitleErrorColorId);
title_label_->SetEnabledColor(kTitleErrorColorId);
NotifyTitleChanged(error_str);
title_label_->GetViewAccessibility().SetName(error_str);
title_label_->NotifyAccessibilityEventDeprecated(
@ -152,7 +152,7 @@ void AuthHeaderView::SetErrorTitle(const std::u16string& error_str) {
void AuthHeaderView::RestoreTitle() {
if (title_label_->GetText() != title_str_) {
title_label_->SetText(title_str_);
title_label_->SetEnabledColorId(kTitleColorId);
title_label_->SetEnabledColor(kTitleColorId);
NotifyTitleChanged(title_str_);
}
}

@ -170,7 +170,7 @@ FingerprintView::FingerprintView() {
label_->SetAutoColorReadabilityEnabled(false);
// kTextColorId, kTextFont defined in auth_common.h
label_->SetEnabledColorId(kTextColorId);
label_->SetEnabledColor(kTextColorId);
label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kTextFont));

@ -102,7 +102,7 @@ PinStatusView::PinStatusView() {
views::style::STYLE_PRIMARY);
text_label_->SetMultiLine(true);
text_label_->SizeToFit(kTextLineWidthDp);
text_label_->SetEnabledColorId(kTextColorId);
text_label_->SetEnabledColor(kTextColorId);
text_label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kTextFont));
decorate_label(text_label_);

@ -85,7 +85,7 @@ void ApplyStyle(views::Label* label,
TypographyToken style,
ui::ColorId text_color_id) {
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColorId(text_color_id);
label->SetEnabledColor(text_color_id);
TypographyProvider::Get()->StyleLabel(style, *label);
}

@ -119,7 +119,7 @@ ActionButtonContainerView::ErrorView::ErrorView()
AddChildView(
views::Builder<views::Label>()
.CopyAddressTo(&error_label_)
.SetEnabledColorId(cros_tokens::kCrosSysSecondary)
.SetEnabledColor(cros_tokens::kCrosSysSecondary)
.SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosAnnotation1))
.Build());
@ -131,7 +131,7 @@ ActionButtonContainerView::ErrorView::ErrorView()
IDS_ASH_SCANNER_ERROR_TRY_AGAIN_LINK_TEXT))
.SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosButton2))
.SetEnabledColorId(cros_tokens::kCrosSysPrimary)
.SetEnabledColor(cros_tokens::kCrosSysPrimary)
.SetForceUnderline(false)
.SetProperty(views::kMarginsKey, kErrorViewTryAgainLinkPadding)
.SetVisible(false)

@ -175,7 +175,7 @@ CaptureLabelView::CaptureLabelView(
label_ = AddChildView(std::make_unique<views::Label>(std::u16string()));
label_->SetPaintToLayer();
label_->layer()->SetFillsBoundsOpaquely(false);
label_->SetEnabledColorId(kColorAshTextColorPrimary);
label_->SetEnabledColor(kColorAshTextColorPrimary);
label_->SetBackgroundColor(SK_ColorTRANSPARENT);
capture_mode_util::SetHighlightBorder(

@ -3020,7 +3020,7 @@ void CaptureModeSession::UpdateDimensionsLabelWidget(bool is_resizing) {
views::Widget::VisibilityTransition::ANIMATE_SHOW);
auto size_label = std::make_unique<views::Label>();
size_label->SetEnabledColorId(kColorAshTextColorPrimary);
size_label->SetEnabledColor(kColorAshTextColorPrimary);
size_label->SetBackground(views::CreateThemedRoundedRectBackground(
kColorAshShieldAndBase80, kSizeLabelBorderRadius));
size_label->SetAutoColorReadabilityEnabled(false);

@ -320,7 +320,7 @@ std::unique_ptr<views::View> CreateClipboardShortcutView() {
clipboard_shortcut_view->AddChildView(std::make_unique<views::Label>());
shortcut_label->SetText(label_text);
shortcut_label->SetBackgroundColor(cros_tokens::kCrosSysPrimary);
shortcut_label->SetEnabledColorId(cros_tokens::kCrosSysOnPrimary);
shortcut_label->SetEnabledColor(cros_tokens::kCrosSysOnPrimary);
ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosBody2,
*shortcut_label);
return clipboard_shortcut_view;
@ -351,7 +351,7 @@ std::unique_ptr<views::View> CreateBannerView() {
IDS_ASH_SCREEN_CAPTURE_SCREENSHOT_COPIED_TO_CLIPBOARD)));
label->SetBackgroundColor(kColorAshControlBackgroundColorActive);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColorId(cros_tokens::kCrosSysOnPrimary);
label->SetEnabledColor(cros_tokens::kCrosSysOnPrimary);
ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosBody2,
*label);
@ -492,7 +492,7 @@ aura::Window* GetPreferredRootWindow(
}
void ConfigLabelView(views::Label* label_view) {
label_view->SetEnabledColorId(kColorAshTextColorPrimary);
label_view->SetEnabledColor(kColorAshTextColorPrimary);
label_view->SetBackgroundColor(SK_ColorTRANSPARENT);
label_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_view->SetVerticalAlignment(gfx::VerticalAlignment::ALIGN_MIDDLE);

@ -164,7 +164,7 @@ DisclaimerView::DisclaimerView(
.SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosDisplay7))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT)
.SetText(GetTextTitle())

@ -131,7 +131,7 @@ void KeyItemView::SetIcon(const gfx::VectorIcon& icon) {
void KeyItemView::SetText(const std::u16string& text) {
if (!label_) {
label_ = AddChildView(std::make_unique<views::Label>());
label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
label_->SetElideBehavior(gfx::ElideBehavior::NO_ELIDE);
label_->SetFontList(gfx::FontList({kGoogleSansFont}, gfx::Font::NORMAL,
kKeyItemViewFontSize,

@ -193,7 +193,7 @@ SearchResultsPanel::SearchResultsPanel() {
.SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosTitle1))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface),
.SetEnabledColor(cros_tokens::kCrosSysOnSurface),
// Close Button, aligned to the right by setting a
// `FlexSpecification` with unbounded maximum flex size and
// `LayoutAlignment::kEnd`.

@ -20,7 +20,7 @@ ClipboardHistoryLabel::ClipboardHistoryLabel(const std::u16string& text,
: views::Label(text) {
SetAutoColorReadabilityEnabled(false);
SetElideBehavior(elide_behavior);
SetEnabledColorId(cros_tokens::kTextColorPrimary);
SetEnabledColor(cros_tokens::kTextColorPrimary);
SetHorizontalAlignment(gfx::ALIGN_LEFT);
SetMaxLines(max_lines);

@ -74,7 +74,7 @@ ContextualNudge::ContextualNudge(views::View* anchor,
label_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
label_->SetBackgroundColor(SK_ColorTRANSPARENT);
label_->SetBorder(views::CreateEmptyBorder(margins));
label_->SetEnabledColorId(cros_tokens::kCrosSysSecondary);
label_->SetEnabledColor(cros_tokens::kCrosSysSecondary);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosAnnotation1,
*label_);

@ -212,7 +212,7 @@ void GameDashboardButton::UpdateViews() {
: cros_tokens::kCrosSysDisabled;
gamepad_icon_view_->SetImage(ui::ImageModel::FromVectorIcon(
chromeos::kGameDashboardGamepadIcon, icon_and_label_color, kIconHeight));
title_view_->SetEnabledColorId(icon_and_label_color);
title_view_->SetEnabledColor(icon_and_label_color);
UpdateArrowIcon();
}

@ -351,10 +351,10 @@ class FeatureHeader : public views::View {
: cros_tokens::kCrosSysDisabled;
icon_view_->SetImage(ui::ImageModel::FromVectorIcon(*vector_icon_, color_id,
/*icon_size=*/20));
title_->SetEnabledColorId(color_id);
sub_title_->SetEnabledColorId(is_enabled
? cros_tokens::kCrosSysOnSurfaceVariant
: cros_tokens::kCrosSysDisabled);
title_->SetEnabledColor(color_id);
sub_title_->SetEnabledColor(is_enabled
? cros_tokens::kCrosSysOnSurfaceVariant
: cros_tokens::kCrosSysDisabled);
}
void UpdateSubtitle(const std::u16string& text) {
@ -1383,7 +1383,7 @@ void GameDashboardMainMenuView::AddWelcomeDialogSettingsRow() {
std::make_unique<views::Label>(l10n_util::GetStringUTF16(
IDS_ASH_GAME_DASHBOARD_SETTINGS_WELCOME_DIALOG_TITLE)));
feature_title->SetAutoColorReadabilityEnabled(false);
feature_title->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
feature_title->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
feature_title->SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosTitle2));
feature_title->SetHorizontalAlignment(gfx::ALIGN_LEFT);

@ -147,7 +147,7 @@ std::unique_ptr<views::BoxLayoutView> BuildAssignmentTitleLabels(
.SetText(base::UTF8ToUTF16(assignment->course_work_title))
.SetID(base::to_underlying(
GlanceablesViewId::kClassroomItemCourseWorkTitleLabel))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetFontList(typography_provider->ResolveTypographyToken(
kAssignmentCourseWorkTypography))
.SetLineHeight(typography_provider->ResolveLineHeight(
@ -156,7 +156,7 @@ std::unique_ptr<views::BoxLayoutView> BuildAssignmentTitleLabels(
.SetText(base::UTF8ToUTF16(assignment->course_title))
.SetID(base::to_underlying(
GlanceablesViewId::kClassroomItemCourseTitleLabel))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant)
.SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant)
.SetFontList(typography_provider->ResolveTypographyToken(
kAssignmentCourseTypography))
.SetLineHeight(typography_provider->ResolveLineHeight(
@ -179,7 +179,7 @@ std::unique_ptr<views::BoxLayoutView> BuildDueLabels(
.SetText(due_date)
.SetID(base::to_underlying(
GlanceablesViewId::kClassroomItemDueDateLabel))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant)
.SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant)
.SetFontList(typography_provider->ResolveTypographyToken(
kDueLabelsTypography))
// Use the course work line height to align with the
@ -190,7 +190,7 @@ std::unique_ptr<views::BoxLayoutView> BuildDueLabels(
.SetText(due_time)
.SetID(base::to_underlying(
GlanceablesViewId::kClassroomItemDueTimeLabel))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant)
.SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant)
.SetFontList(typography_provider->ResolveTypographyToken(
kDueLabelsTypography))
.SetLineHeight(typography_provider->ResolveLineHeight(

@ -163,7 +163,7 @@ GlanceablesClassroomStudentView::GlanceablesClassroomStudentView()
empty_list_label_ = content_scroll_view()->contents()->AddChildView(
views::Builder<views::Label>()
.SetProperty(views::kMarginsKey, kEmptyListLabelMargins)
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetFontList(typography_provider->ResolveTypographyToken(
TypographyToken::kCrosButton2))
.SetLineHeight(typography_provider->ResolveLineHeight(

@ -92,7 +92,7 @@ GlanceablesListFooterView::GlanceablesListFooterView(
title_label_ = AddChildView(
views::Builder<views::Label>()
.SetID(base::to_underlying(GlanceablesViewId::kListFooterTitleLabel))
.SetEnabledColorId(cros_tokens::kCrosSysSecondary)
.SetEnabledColor(cros_tokens::kCrosSysSecondary)
.SetFontList(typography_provider->ResolveTypographyToken(
TypographyToken::kCrosBody2))
.SetLineHeight(typography_provider->ResolveLineHeight(

@ -196,8 +196,7 @@ GlanceablesTimeManagementBubbleView::GlanceablesTimeManagementBubbleView(
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosTitle1,
*combobox_replacement_label_);
combobox_replacement_label_->SetAutoColorReadabilityEnabled(false);
combobox_replacement_label_->SetEnabledColorId(
cros_tokens::kCrosSysOnSurface);
combobox_replacement_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
combobox_replacement_label_->SetVisible(false);
expand_button_ = header_container->AddChildView(

@ -380,7 +380,7 @@ GlanceablesTaskView::GlanceablesTaskView(
TypographyToken::kCrosAnnotation1));
due_date_label->SetLineHeight(TypographyProvider::Get()->ResolveLineHeight(
TypographyToken::kCrosAnnotation1));
due_date_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
due_date_label->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
}
if (task && task->has_subtasks) {
@ -581,7 +581,7 @@ void GlanceablesTaskView::AddExtraContentForEditState() {
assigned_task_notice_label->SetLineHeight(
TypographyProvider::Get()->ResolveLineHeight(
TypographyToken::kCrosAnnotation1));
assigned_task_notice_label->SetEnabledColorId(
assigned_task_notice_label->SetEnabledColor(
cros_tokens::kCrosSysOnSurfaceVariant);
extra_content->AddChildView(std::move(assigned_task_notice));

@ -155,7 +155,7 @@ class AuthDialogContentsView::FingerprintView : public views::View {
label_ = AddChildView(std::make_unique<FingerprintLabel>());
label_->SetSubpixelRenderingEnabled(false);
label_->SetAutoColorReadabilityEnabled(false);
label_->SetEnabledColorId(kColorAshTextColorPrimary);
label_->SetEnabledColor(kColorAshTextColorPrimary);
label_->SetMultiLine(true);
label_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
}
@ -361,14 +361,14 @@ class AuthDialogContentsView::TitleLabel : public views::Label {
std::u16string title =
l10n_util::GetStringUTF16(IDS_ASH_IN_SESSION_AUTH_TITLE);
SetText(title);
SetEnabledColorId(kColorAshTextColorPrimary);
SetEnabledColor(kColorAshTextColorPrimary);
is_showing_error_ = false;
GetViewAccessibility().SetName(title);
}
void ShowError(const std::u16string& error_text) {
SetText(error_text);
SetEnabledColorId(kColorAshTextColorAlert);
SetEnabledColor(kColorAshTextColorAlert);
is_showing_error_ = true;
GetViewAccessibility().SetName(error_text);
NotifyAccessibilityEventDeprecated(ax::mojom::Event::kAlert,
@ -493,7 +493,7 @@ void AuthDialogContentsView::AddTitleView() {
void AuthDialogContentsView::AddOriginNameView() {
origin_name_view_ =
container_->AddChildView(std::make_unique<views::Label>());
origin_name_view_->SetEnabledColorId(kColorAshTextColorSecondary);
origin_name_view_->SetEnabledColor(kColorAshTextColorSecondary);
origin_name_view_->SetSubpixelRenderingEnabled(false);
origin_name_view_->SetAutoColorReadabilityEnabled(false);
origin_name_view_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);

@ -199,13 +199,13 @@ void InSessionAuthDialogContentsView::AddTitle() {
std::u16string title_text =
l10n_util::GetStringUTF16(IDS_ASH_IN_SESSION_AUTH_TITLE);
title_->SetText(title_text);
title_->SetEnabledColorId(kColorAshTextColorPrimary);
title_->SetEnabledColor(kColorAshTextColorPrimary);
title_->GetViewAccessibility().SetName(title_text);
}
void InSessionAuthDialogContentsView::AddPrompt(const std::string& prompt) {
prompt_view_ = AddChildView(std::make_unique<views::Label>());
prompt_view_->SetEnabledColorId(kColorAshTextColorSecondary);
prompt_view_->SetEnabledColor(kColorAshTextColorSecondary);
prompt_view_->SetSubpixelRenderingEnabled(false);
prompt_view_->SetAutoColorReadabilityEnabled(false);
prompt_view_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
@ -259,7 +259,7 @@ void InSessionAuthDialogContentsView::ShowAuthError(AshAuthFactor factor) {
break;
}
title_->SetEnabledColorId(cros_tokens::kCrosSysError);
title_->SetEnabledColor(cros_tokens::kCrosSysError);
}
bool InSessionAuthDialogContentsView::OnKeyPressed(const ui::KeyEvent& event) {

@ -48,7 +48,7 @@ class AuthFactorsLabel : public views::Label {
AuthFactorsLabel(bool visible_to_screen_reader) {
SetSubpixelRenderingEnabled(false);
SetAutoColorReadabilityEnabled(false);
SetEnabledColorId(kColorAshTextColorSecondary);
SetEnabledColor(kColorAshTextColorSecondary);
SetMultiLine(true);
SetMaxLines(kLabelMaxLines);
SetLineHeight(kLabelLineHeightDp);

@ -184,7 +184,7 @@ DisabledAuthMessageView::DisabledAuthMessageView() {
message_title_->SetFontList(gfx::FontList().Derive(
kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
decorate_label(message_title_);
message_title_->SetEnabledColorId(kColorAshTextColorPrimary);
message_title_->SetEnabledColor(kColorAshTextColorPrimary);
message_contents_ = AddChildView(std::make_unique<views::Label>(
std::u16string(), views::style::CONTEXT_LABEL,
@ -193,7 +193,7 @@ DisabledAuthMessageView::DisabledAuthMessageView() {
kContentsFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::NORMAL));
decorate_label(message_contents_);
message_contents_->SetMultiLine(true);
message_contents_->SetEnabledColorId(kColorAshTextColorPrimary);
message_contents_->SetEnabledColor(kColorAshTextColorPrimary);
GetViewAccessibility().SetRole(ax::mojom::Role::kPane);
UpdateAccessibleName();
@ -215,9 +215,9 @@ void DisabledAuthMessageView::SetAuthDisabledMessage(
CHECK(!message.icon.IsEmpty());
message_icon_->SetImage(message.icon);
message_title_->SetText(message.title);
message_title_->SetEnabledColorId(kColorAshTextColorPrimary);
message_title_->SetEnabledColor(kColorAshTextColorPrimary);
message_contents_->SetText(message.content);
message_contents_->SetEnabledColorId(kColorAshTextColorPrimary);
message_contents_->SetEnabledColor(kColorAshTextColorPrimary);
}
void DisabledAuthMessageView::SetAuthDisabledMessage(

@ -62,7 +62,7 @@ KioskAppDefaultMessage::KioskAppDefaultMessage()
title_->SetText(l10n_util::GetStringUTF16(IDS_SHELF_KIOSK_APP_SETUP));
title_->SetLineHeight(kTitleLineHeight);
title_->SetMultiLine(true);
title_->SetEnabledColorId(kColorAshTextColorPrimary);
title_->SetEnabledColor(kColorAshTextColorPrimary);
title_->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2, *title_);
}

@ -257,7 +257,7 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
label->SetSubpixelRenderingEnabled(false);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
label->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
};
@ -343,7 +343,7 @@ void LocalAuthenticationRequestView::UpdateState(
: cros_tokens::kCrosSysError;
title_label_->SetText(title);
description_label_->SetText(description);
description_label_->SetEnabledColorId(color_id);
description_label_->SetEnabledColor(color_id);
}
gfx::Size LocalAuthenticationRequestView::CalculatePreferredSize(

@ -2341,7 +2341,7 @@ bool LockContentsView::GetSystemInfoVisibility() const {
void LockContentsView::UpdateSystemInfoColors() {
for (views::View* child : system_info_->children()) {
views::Label* label = static_cast<views::Label*>(child);
label->SetEnabledColorId(kColorAshTextColorPrimary);
label->SetEnabledColor(kColorAshTextColorPrimary);
}
}

@ -1260,7 +1260,7 @@ void LockDebugView::UpdatePerUserActionContainer() {
auto* name = new views::Label();
name->SetText(debug_data_dispatcher_->GetDisplayNameForUserIndex(i));
name->SetSubpixelRenderingEnabled(false);
name->SetEnabledColorId(kColorAshTextColorPrimary);
name->SetEnabledColor(kColorAshTextColorPrimary);
name->SetAutoColorReadabilityEnabled(false);
row->AddChildView(name);

@ -61,7 +61,7 @@ LockedTpmMessageView::LockedTpmMessageView() {
kLockScreenAlertIcon, kColorAshIconColorPrimary, kIconSizeDp));
message_warning_ = CreateLabel();
message_warning_->SetEnabledColorId(kColorAshTextColorPrimary);
message_warning_->SetEnabledColor(kColorAshTextColorPrimary);
message_description_ = CreateLabel();
@ -69,7 +69,7 @@ LockedTpmMessageView::LockedTpmMessageView() {
std::u16string message_description =
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_POD_TPM_LOCKED_ISSUE_DESCRIPTION);
message_description_->SetText(message_description);
message_description_->SetEnabledColorId(kColorAshTextColorPrimary);
message_description_->SetEnabledColor(kColorAshTextColorPrimary);
}
LockedTpmMessageView::~LockedTpmMessageView() = default;

@ -265,7 +265,7 @@ LoginAuthFactorsView::LoginAuthFactorsView(
label_wrapper_->SetProperty(
views::kMarginsKey,
gfx::Insets::TLBR(kSpacingBetweenIconsAndLabelDp, 0, 0, 0));
label_wrapper_->label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label_wrapper_->label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
}
LoginAuthFactorsView::~LoginAuthFactorsView() = default;

@ -277,7 +277,7 @@ class LoginAuthUserView::ChallengeResponseView : public views::View {
GetTextForLabel(), views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY));
label_->SetAutoColorReadabilityEnabled(false);
label_->SetEnabledColorId(kColorAshTextColorSecondary);
label_->SetEnabledColor(kColorAshTextColorSecondary);
label_->SetSubpixelRenderingEnabled(false);
label_->SetFontList(views::Label::GetDefaultFontList().Derive(
/*size_delta=*/1, gfx::Font::FontStyle::ITALIC,

@ -43,7 +43,7 @@ views::Label* CreateLabel(const std::u16string& text, const int font_delta) {
{views::Label::GetDefaultFontList().DeriveWithSizeDelta(font_delta)});
label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColorId(kColorAshTextColorPrimary);
label->SetEnabledColor(kColorAshTextColorPrimary);
label->SetSubpixelRenderingEnabled(false);
return label;
}

@ -102,7 +102,7 @@ views::Label* CreateLabel(const std::u16string& text, ui::ColorId color_id) {
label->SetFontList(views::Label::GetDefaultFontList().Derive(
0, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColorId(color_id);
label->SetEnabledColor(color_id);
return label;
}
@ -263,7 +263,7 @@ class SelectionButtonView : public LoginButton {
}
void SetTextColorId(ui::ColorId color_id) {
label_->SetEnabledColorId(color_id);
label_->SetEnabledColor(color_id);
}
void SetText(const std::u16string& text) {
GetViewAccessibility().SetName(text);

@ -246,7 +246,7 @@ class LoginPinView::DigitPinButton : public BasePinButton {
label_->SetFontList(base_font_list.Derive(8 /*size_delta*/,
gfx::Font::FontStyle::NORMAL,
gfx::Font::Weight::NORMAL));
label_->SetEnabledColorId(kColorAshIconColorPrimary);
label_->SetEnabledColor(kColorAshIconColorPrimary);
if (show_sub_label) {
sub_label_ = AddChildView(new views::Label(
@ -257,7 +257,7 @@ class LoginPinView::DigitPinButton : public BasePinButton {
sub_label_->SetFontList(
base_font_list.Derive(-1 /*size_delta*/, gfx::Font::FontStyle::NORMAL,
gfx::Font::Weight::NORMAL));
sub_label_->SetEnabledColorId(kColorAshTextColorSecondary);
sub_label_->SetEnabledColor(kColorAshTextColorSecondary);
}
}

@ -37,7 +37,7 @@ LoginTooltipView::LoginTooltipView(const std::u16string& message,
kInfoIconSizeDp));
label_ = AddChildView(login_views_utils::CreateBubbleLabel(message, this));
label_->SetEnabledColorId(
label_->SetEnabledColor(
static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface));
GetViewAccessibility().SetRole(ax::mojom::Role::kTooltip);

@ -281,7 +281,7 @@ class LoginUserView::UserLabel : public NonAccessibleView {
user_name_ = new views::Label();
user_name_->SetSubpixelRenderingEnabled(false);
user_name_->SetAutoColorReadabilityEnabled(false);
user_name_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
user_name_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
const gfx::FontList& base_font_list = views::Label::GetDefaultFontList();
const gfx::FontList font_list(

@ -70,7 +70,7 @@ std::unique_ptr<views::Label> CreateLabel(const std::u16string& text,
label->SetAutoColorReadabilityEnabled(false);
label->SetTextStyle(style);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColorId(
label->SetEnabledColor(
static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface));
label->SetMultiLine(true);
return label;

@ -280,7 +280,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
label->SetSubpixelRenderingEnabled(false);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
label->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
};
@ -294,7 +294,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
title_label_->SetFontList(gfx::FontList().Derive(
kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
decorate_label(title_label_);
title_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
AddChildView(title_label_.get());
add_spacer(kTitleToDescriptionDistanceDp);
@ -310,7 +310,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
description_label_->SetFontList(
gfx::FontList().Derive(kDescriptionFontSizeDeltaDp, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL));
description_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
description_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
decorate_label(description_label_);
AddChildView(description_label_.get());
@ -475,13 +475,13 @@ void PinRequestView::UpdateState(PinRequestViewState state,
case PinRequestViewState::kNormal: {
const ui::ColorId normal_color_id = cros_tokens::kCrosSysOnSurface;
access_code_view_->SetInputColorId(normal_color_id);
title_label_->SetEnabledColorId(normal_color_id);
title_label_->SetEnabledColor(normal_color_id);
return;
}
case PinRequestViewState::kError: {
const ui::ColorId error_color_id = cros_tokens::kCrosSysError;
access_code_view_->SetInputColorId(error_color_id);
title_label_->SetEnabledColorId(error_color_id);
title_label_->SetEnabledColor(error_color_id);
// Read out the error.
title_label_->NotifyAccessibilityEventDeprecated(ax::mojom::Event::kAlert,
true);

@ -72,7 +72,7 @@ PinStatusMessageView::PinStatusMessageView(OnPinUnlock on_pin_unlock)
message_->SetSubpixelRenderingEnabled(false);
message_->SetAutoColorReadabilityEnabled(false);
message_->SetMultiLine(true);
message_->SetEnabledColorId(kColorAshTextColorPrimary);
message_->SetEnabledColor(kColorAshTextColorPrimary);
message_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
message_->GetViewAccessibility().SetName(
std::u16string(), ax::mojom::NameFrom::kAttributeExplicitlyEmpty);

@ -162,7 +162,7 @@ std::unique_ptr<views::Label> CreateThemedBubbleLabel(
int line_height) {
auto label = CreateUnthemedBubbleLabel(message, view_defining_max_width,
font_list, line_height);
label->SetEnabledColorId(enabled_color_type);
label->SetEnabledColor(enabled_color_type);
return label;
}

@ -63,7 +63,7 @@ QuickInsertEmojiItemView::QuickInsertEmojiItemView(
.Build());
if (style == Style::kEmoticon || style == Style::kSymbol) {
label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
}
if (style == Style::kEmoticon) {
label_->SetBorder(views::CreateEmptyBorder(kEmoticonItemMargins));

@ -445,7 +445,7 @@ void QuickInsertSectionView::AddTitleTrailingLink(
.SetCallback(link_callback)
.SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosAnnotation2))
.SetEnabledColorId(cros_tokens::kCrosSysPrimary)
.SetEnabledColor(cros_tokens::kCrosSysPrimary)
.SetForceUnderline(false)
.SetProperty(views::kMarginsKey, kSectionTitleTrailingLinkMargins)
.Build());

@ -33,7 +33,7 @@ std::unique_ptr<views::Label> CreateShortcutTextLabel(
auto label = std::make_unique<views::Label>(text);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosAnnotation2,
*label);
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
return label;
}

@ -97,7 +97,7 @@ void SetupLabelView(views::Label* label,
label->GetViewAccessibility().SetIsIgnored(true);
label->SetBackgroundColor(SK_ColorTRANSPARENT);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColorId(color_id);
label->SetEnabledColor(color_id);
label->SetFontList(font_list);
label->SetVisible(true);
label->SetElideBehavior(gfx::ELIDE_TAIL);

@ -707,7 +707,7 @@ void HomeButton::CreateNudgeLabel() {
nudge_label_->layer()->SetFillsBoundsOpaquely(false);
nudge_label_->SetTextContext(CONTEXT_LAUNCHER_NUDGE_LABEL);
nudge_label_->SetTextStyle(views::style::STYLE_EMPHASIZED);
nudge_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
nudge_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*nudge_label_);
expandable_container_->SetVisible(false);

@ -375,7 +375,7 @@ Combobox::Combobox(ui::ComboboxModel* model)
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosTitle1,
*title_.get());
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColorId(kInactiveTitleAndIconColorId);
title_->SetEnabledColor(kInactiveTitleAndIconColorId);
title_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
@ -605,7 +605,7 @@ void Combobox::ShowDropDownMenu() {
SetBackground(views::CreateThemedRoundedRectBackground(
kComboboxActiveColorId, kComboboxRoundedCorners));
title_->SetEnabledColorId(kActiveTitleAndIconColorId);
title_->SetEnabledColor(kActiveTitleAndIconColorId);
drop_down_arrow_->SetImage(ui::ImageModel::FromVectorIcon(
kDropDownArrowIcon, kActiveTitleAndIconColorId, kArrowIconSize));
@ -620,7 +620,7 @@ void Combobox::CloseDropDownMenu() {
closed_time_ = base::TimeTicks::Now();
SetBackground(nullptr);
title_->SetEnabledColorId(kInactiveTitleAndIconColorId);
title_->SetEnabledColor(kInactiveTitleAndIconColorId);
drop_down_arrow_->SetImage(ui::ImageModel::FromVectorIcon(
kDropDownArrowIcon, kInactiveTitleAndIconColorId, kArrowIconSize));

@ -285,7 +285,7 @@ DropDownCheckbox::DropDownCheckbox(const std::u16string& title,
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosTitle1,
*title_.get());
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColorId(kInactiveTitleAndIconColorId);
title_->SetEnabledColor(kInactiveTitleAndIconColorId);
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
@ -454,7 +454,7 @@ void DropDownCheckbox::ShowDropDownMenu() {
SetBackground(views::CreateThemedRoundedRectBackground(
kDropDownCheckboxActiveColorId, kDropDownCheckboxRoundedCorners));
title_->SetEnabledColorId(kActiveTitleAndIconColorId);
title_->SetEnabledColor(kActiveTitleAndIconColorId);
drop_down_arrow_->SetImage(ui::ImageModel::FromVectorIcon(
kDropDownArrowIcon, kActiveTitleAndIconColorId, kArrowIconSize));
@ -468,7 +468,7 @@ void DropDownCheckbox::CloseDropDownMenu() {
closed_time_ = base::TimeTicks::Now();
SetBackground(nullptr);
title_->SetEnabledColorId(kInactiveTitleAndIconColorId);
title_->SetEnabledColor(kInactiveTitleAndIconColorId);
drop_down_arrow_->SetImage(ui::ImageModel::FromVectorIcon(
kDropDownArrowIcon, kInactiveTitleAndIconColorId, kArrowIconSize));
NotifyAccessibilityEventDeprecated(ax::mojom::Event::kStateChanged, true);

@ -80,7 +80,7 @@ ErrorMessageToast::ErrorMessageToast(views::Button::PressedCallback callback,
const auto* const typography_provider = TypographyProvider::Get();
error_message_label_ = AddChildView(
views::Builder<views::Label>()
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetFontList(typography_provider->ResolveTypographyToken(
TypographyToken::kCrosAnnotation1))
.SetLineHeight(typography_provider->ResolveLineHeight(

@ -86,7 +86,7 @@ gfx::Size OptionButtonBase::GetMinimumSize() const {
}
void OptionButtonBase::SetLabelColorId(ui::ColorId color_id) {
label()->SetEnabledColorId(color_id);
label()->SetEnabledColor(color_id);
}
void OptionButtonBase::Layout(PassKey) {

@ -25,7 +25,7 @@ RoundedLabel::RoundedLabel(int horizontal_padding,
SetBorder(views::CreateEmptyBorder(
gfx::Insets::VH(vertical_padding, horizontal_padding)));
SetBackground(views::CreateThemedSolidBackground(kColorAshShieldAndBase80));
SetEnabledColorId(kColorAshTextColorPrimary);
SetEnabledColor(kColorAshTextColorPrimary);
SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY);
SetHorizontalAlignment(gfx::ALIGN_CENTER);

@ -248,7 +248,7 @@ SystemDialogDelegateView::SystemDialogDelegateView() {
typography_provider->StyleLabel(kTitleFont, *title_);
title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColorId(kTitleColorId);
title_->SetEnabledColor(kTitleColorId);
title_->SetVisible(false);
title_->GetViewAccessibility().SetRole(ax::mojom::Role::kHeading);
title_->SetProperty(views::kElementIdentifierKey, kTitleTextIdForTesting);
@ -265,7 +265,7 @@ SystemDialogDelegateView::SystemDialogDelegateView() {
description_->SetMultiLine(true);
description_->SetAllowCharacterBreak(true);
description_->SetAutoColorReadabilityEnabled(false);
description_->SetEnabledColorId(kBodyColorId);
description_->SetEnabledColor(kBodyColorId);
description_->SetVisible(false);
description_->SetProperty(views::kElementIdentifierKey,
kDescriptionTextIdForTesting);

@ -12,6 +12,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
#include "ui/color/color_id.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/paint_vector_icon.h"
@ -107,7 +108,7 @@ void TabSliderButton::SetSelected(bool selected) {
OnSelectedChanged();
}
SkColor TabSliderButton::GetColorIdOnButtonState() {
ui::ColorId TabSliderButton::GetColorIdOnButtonState() {
const bool enabled = GetEnabled();
return selected()
? (enabled ? kSelectedColorId : kDisabledSelectedColorId)
@ -192,7 +193,7 @@ LabelSliderButton::LabelSliderButton(PressedCallback callback,
LabelSliderButton::~LabelSliderButton() = default;
void LabelSliderButton::UpdateLabelColor() {
label_->SetEnabledColorId(GetColorIdOnButtonState());
label_->SetEnabledColor(GetColorIdOnButtonState());
SchedulePaint();
}
@ -282,7 +283,7 @@ IconLabelSliderButton::IconLabelSliderButton(PressedCallback callback,
IconLabelSliderButton::~IconLabelSliderButton() = default;
void IconLabelSliderButton::UpdateColors() {
label_->SetEnabledColorId(GetColorIdOnButtonState());
label_->SetEnabledColor(GetColorIdOnButtonState());
// `SchedulePaint()` will result in the `gfx::VectorIcon` for `image_view_`
// getting re-generated with the proper color.
SchedulePaint();

@ -36,8 +36,10 @@ class ASH_EXPORT TabSliderButton : public views::Button {
public:
TabSliderButton(PressedCallback callback, const std::u16string& tooltip_text);
TabSliderButton(const TabSliderButton&) = delete;
TabSliderButton& operator=(const TabSliderButton&) = delete;
~TabSliderButton() override;
bool selected() const { return selected_; }
@ -49,7 +51,7 @@ class ASH_EXPORT TabSliderButton : public views::Button {
void SetSelected(bool selected);
// Returns the recommended color id for the current button state.
SkColor GetColorIdOnButtonState();
ui::ColorId GetColorIdOnButtonState();
private:
// Called when the button selected state is changed.

@ -62,7 +62,7 @@ std::unique_ptr<views::Label> CreateLabelView(
return views::Builder<views::Label>()
.CopyAddressTo(destination_view)
.SetText(text)
.SetEnabledColorId(enabled_color_id)
.SetEnabledColor(enabled_color_id)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.SetMultiLine(false)
.Build();

@ -54,7 +54,7 @@ std::unique_ptr<views::Label> CreateLabelView(
return views::Builder<views::Label>()
.CopyAddressTo(destination_view)
.SetText(text)
.SetEnabledColorId(enabled_color_id)
.SetEnabledColor(enabled_color_id)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER)
.SetMultiLine(false)
.SetFontList(rb->GetFontList(kKeyLabelFontStyle))

@ -38,7 +38,7 @@ std::unique_ptr<views::Label> CreateLabelView(
raw_ptr<views::Label>* destination_view) {
return views::Builder<views::Label>()
.SetText(text)
.SetEnabledColorId(enabled_color_id)
.SetEnabledColor(enabled_color_id)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.SetMultiLine(false)
.CopyAddressTo(destination_view)

@ -53,7 +53,7 @@ SwitchAccessMenuButton::SwitchAccessMenuButton(std::string action_name,
.SetText(label_text)
.SetTextContext(views::style::CONTEXT_BUTTON)
.SetAutoColorReadabilityEnabled(false)
.SetEnabledColorId(kColorAshTextColorPrimary)
.SetEnabledColor(kColorAshTextColorPrimary)
.SetMultiLine(true)
.SetMaximumWidth(kLabelMaxWidthDip))
.BuildChildren();

@ -255,7 +255,7 @@ void AudioDetailedView::AddAudioSubHeader(views::View* container,
const int text_id) {
auto* sub_header_label_ = TrayPopupUtils::CreateDefaultLabel();
sub_header_label_->SetText(l10n_util::GetStringUTF16(text_id));
sub_header_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
sub_header_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
sub_header_label_->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*sub_header_label_);
@ -301,7 +301,7 @@ void AudioDetailedView::CreateLiveCaptionView() {
live_caption_view_->AddViewAndLabel(
std::move(toggle_icon),
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_LIVE_CAPTION));
live_caption_view_->text_label()->SetEnabledColorId(
live_caption_view_->text_label()->SetEnabledColor(
cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton1,
*live_caption_view_->text_label());
@ -351,7 +351,7 @@ std::unique_ptr<TriView> AudioDetailedView::CreateNbsWarningView() {
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO_NBS_MESSAGE));
label->SetMultiLine(/*multi_line=*/true);
label->SetBackground(views::CreateSolidBackground(SK_ColorTRANSPARENT));
label->SetEnabledColorId(kColorAshTextColorWarning);
label->SetEnabledColor(kColorAshTextColorWarning);
label->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2, *label);
@ -379,7 +379,7 @@ AudioDetailedView::CreateNoiseCancellationToggleRow(const AudioDevice& device) {
IDS_ASH_STATUS_TRAY_AUDIO_INPUT_NOISE_CANCELLATION));
views::Label* noise_cancellation_label =
noise_cancellation_view->text_label();
noise_cancellation_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
noise_cancellation_label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*noise_cancellation_label);
@ -433,7 +433,7 @@ AudioDetailedView::CreateStyleTransferToggleRow(const AudioDevice& device) {
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_AUDIO_INPUT_STYLE_TRANSFER));
views::Label* style_transfer_label = style_transfer_view->text_label();
style_transfer_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
style_transfer_label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*style_transfer_label);

@ -21,7 +21,7 @@ void UpdateDeviceContainerColor(HoverHighlightView* device_name_view,
is_active ? (is_muted ? cros_tokens::kCrosSysOnSurface
: cros_tokens::kCrosSysSystemOnPrimaryContainer)
: cros_tokens::kCrosSysOnSurfaceVariant;
device_name_view->text_label()->SetEnabledColorId(color_id);
device_name_view->text_label()->SetEnabledColor(color_id);
TrayPopupUtils::UpdateCheckMarkColor(device_name_view, color_id);
}

@ -222,7 +222,7 @@ void BluetoothDetailedViewImpl::CreateTopContainer() {
auto icon = std::make_unique<views::ImageView>();
toggle_icon_ = icon.get();
toggle_row_->AddViewAndLabel(std::move(icon), u"");
toggle_row_->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
toggle_row_->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton1,
*toggle_row_->text_label());
@ -269,7 +269,7 @@ void BluetoothDetailedViewImpl::CreateMainContainer() {
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIR_NEW_DEVICE));
views::Label* label = pair_new_device_view_->text_label();
label->SetEnabledColorId(cros_tokens::kCrosSysPrimary);
label->SetEnabledColor(cros_tokens::kCrosSysPrimary);
ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton2,
*label);

@ -78,7 +78,7 @@ void BluetoothDeviceListItemBatteryView::UpdateBatteryInfo(
label_->SetText(l10n_util::GetStringFUTF16(
message_id, base::NumberToString16(new_battery_percentage)));
label_->SetAutoColorReadabilityEnabled(false);
label_->SetEnabledColorId(color_id);
label_->SetEnabledColor(color_id);
if (last_shown_battery_percentage_ &&
ApproximatelyEqual(last_shown_battery_percentage_.value(),

@ -198,7 +198,7 @@ void BluetoothDeviceListItemView::UpdateDeviceProperties(
GetDeviceIcon(device_type),
static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface)),
GetPairedDeviceName(device_properties_));
text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton2,
*text_label());

@ -225,7 +225,7 @@ void CastDetailedView::AddAccessCodeCastButton(
// image with an updated `ui::ImageModel`.
add_access_code_device_->icon()->SetImage(ui::ImageModel::FromVectorIcon(
vector_icons::kKeyboardIcon, cros_tokens::kCrosSysPrimary));
add_access_code_device_->text_label()->SetEnabledColorId(
add_access_code_device_->text_label()->SetEnabledColor(
cros_tokens::kCrosSysPrimary);
}

@ -56,7 +56,7 @@ CastZeroStateView::CastZeroStateView() {
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_ZERO_STATE_TITLE)));
title->SetMultiLine(true);
bubble_utils::ApplyStyle(title, TypographyToken::kCrosTitle1);
title->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
title->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(32, 0, 0, 0));
title->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
@ -64,7 +64,7 @@ CastZeroStateView::CastZeroStateView() {
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_ZERO_STATE_SUBTITLE)));
subtitle->SetMultiLine(true);
bubble_utils::ApplyStyle(subtitle, TypographyToken::kCrosBody1);
subtitle->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
subtitle->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
subtitle->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(8, 0, 0, 0));
subtitle->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
}

@ -169,7 +169,7 @@ void MediaCastListView::CreateCastingHeader() {
label->SetText(l10n_util::GetStringUTF16(
IDS_ASH_GLOBAL_MEDIA_CONTROLS_CAST_LIST_HEADER));
label->SetBackground(views::CreateSolidBackground(SK_ColorTRANSPARENT));
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
label->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2, *label);
casting_header->AddView(TriView::Container::CENTER, std::move(label));

@ -100,7 +100,7 @@ void ChannelIndicatorView::OnThemeChanged() {
label()->SetBackground(views::CreateThemedRoundedRectBackground(
channel_indicator_utils::GetBgColorJelly(channel_),
kIndicatorBgCornerRadius));
label()->SetEnabledColorId(
label()->SetEnabledColor(
channel_indicator_utils::GetFgColorJelly(channel_));
}
}
@ -176,8 +176,7 @@ void ChannelIndicatorView::SetImageOrText() {
label()->SetBackground(views::CreateThemedRoundedRectBackground(
channel_indicator_utils::GetBgColorJelly(channel_),
kIndicatorBgCornerRadius));
label()->SetEnabledColorId(
channel_indicator_utils::GetFgColorJelly(channel_));
label()->SetEnabledColor(channel_indicator_utils::GetFgColorJelly(channel_));
label()->SetText(l10n_util::GetStringUTF16(
channel_indicator_utils::GetChannelNameStringResourceID(

@ -195,7 +195,7 @@ void ConfigureLabelText(views::Label* title) {
title->SetProperty(views::kCrossAxisAlignmentKey,
views::LayoutAlignment::kStretch);
title->SetHorizontalAlignment(gfx::ALIGN_CENTER);
title->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosHeadline1,
*title);
}

@ -41,7 +41,7 @@ std::unique_ptr<views::Label> CreateTimerLabel(
label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(alignment);
TypographyProvider::Get()->StyleLabel(token, *label);
label->SetEnabledColorId(color_id);
label->SetEnabledColor(color_id);
return label;
}

@ -517,7 +517,7 @@ void FocusModeDetailedView::CreateToggleView() {
l10n_util::GetStringUTF16(
in_focus_session ? IDS_ASH_STATUS_TRAY_FOCUS_MODE_TOGGLE_ACTIVE_LABEL
: IDS_ASH_STATUS_TRAY_FOCUS_MODE));
toggle_view_->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
toggle_view_->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton1,
*toggle_view_->text_label());
@ -531,7 +531,7 @@ void FocusModeDetailedView::CreateToggleView() {
if (in_focus_session) {
toggle_view_->SetSubText(focus_mode_util::GetFormattedEndTimeString(
focus_mode_controller->GetActualEndTime()));
toggle_view_->sub_text_label()->SetEnabledColorId(
toggle_view_->sub_text_label()->SetEnabledColor(
cros_tokens::kCrosSysSecondary);
TypographyProvider::Get()->StyleLabel(
ash::TypographyToken::kCrosAnnotation1,
@ -643,7 +643,7 @@ void FocusModeDetailedView::CreateTimerView() {
gfx::HorizontalAlignment::ALIGN_LEFT);
timer_view_header->SetBorder(
views::CreateEmptyBorder(kTimerViewHeaderInsets));
timer_view_header->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
timer_view_header->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*timer_view_header);
timer_view_container_->AddChildView(std::move(timer_view_header));
@ -730,7 +730,7 @@ void FocusModeDetailedView::CreateTimerView() {
end_time_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosAnnotation1,
*end_time_label_);
end_time_label_->SetEnabledColorId(cros_tokens::kCrosSysSecondary);
end_time_label_->SetEnabledColor(cros_tokens::kCrosSysSecondary);
end_time_label_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::VH(0, kTimerSettingViewBetweenChildSpacing)));
@ -821,7 +821,7 @@ void FocusModeDetailedView::CreateTaskView(bool is_network_connected) {
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_FOCUS_MODE_TASK_SUBHEADER));
task_view_header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
task_view_header->SetBorder(views::CreateEmptyBorder(kTaskViewHeaderInsets));
task_view_header->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
task_view_header->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*task_view_header);
@ -873,7 +873,7 @@ void FocusModeDetailedView::CreateDoNotDisturbContainer() {
toggle_row->AddViewAndLabel(
std::move(icon),
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_FOCUS_MODE_DO_NOT_DISTURB));
toggle_row->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
toggle_row->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton1,
*toggle_row->text_label());

@ -48,7 +48,7 @@ std::unique_ptr<views::Label> CreateTextLabel(
label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(alignment);
TypographyProvider::Get()->StyleLabel(token, *label);
label->SetEnabledColorId(color_id);
label->SetEnabledColor(color_id);
label->SetText(text);
label->SetMultiLine(allow_multiline);
label->SetMaxLines(allow_multiline ? 2 : 1);

@ -114,9 +114,9 @@ class FocusModeTray::TaskItemView : public views::BoxLayoutView {
task_title_ = AddChildView(std::make_unique<views::Label>());
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*task_title_);
task_title_->SetEnabledColorId(is_network_connected
? cros_tokens::kCrosSysOnSurface
: cros_tokens::kCrosSysDisabled);
task_title_->SetEnabledColor(is_network_connected
? cros_tokens::kCrosSysOnSurface
: cros_tokens::kCrosSysDisabled);
task_title_->SetText(title);
task_title_->SetCustomTooltipText(title);
task_title_->SetBorder(views::CreateEmptyBorder(kTaskTitleLabelInsets));
@ -156,7 +156,7 @@ class FocusModeTray::TaskItemView : public views::BoxLayoutView {
TypographyProvider::Get()
->ResolveTypographyToken(TypographyToken::kCrosButton2)
.DeriveWithStyle(gfx::Font::FontStyle::STRIKE_THROUGH));
task_title_->SetEnabledColorId(cros_tokens::kCrosSysSecondary);
task_title_->SetEnabledColor(cros_tokens::kCrosSysSecondary);
}
private:

@ -91,7 +91,7 @@ std::unique_ptr<views::BoxLayoutView> CreateYouTubeMusicAlternateViewBase(
label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER);
label->SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosBody2));
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
auto* button = box_view->AddChildView(std::make_unique<PillButton>(
std::move(callback), l10n_util::GetStringUTF16(button_message_id),
@ -142,7 +142,7 @@ std::unique_ptr<views::Label> CreateOfflineLabel(const int message_id) {
std::make_unique<views::Label>(l10n_util::GetStringUTF16(message_id));
label->SetFontList(ash::TypographyProvider::Get()->ResolveTypographyToken(
ash::TypographyToken::kCrosBody2));
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER);
return label;
@ -422,8 +422,7 @@ void FocusModeSoundsView::CreateHeader(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_SOUNDSCAPE_BUTTON));
focus_sounds_label->SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT);
focus_sounds_label->SetEnabledColorId(
cros_tokens::kCrosSysOnSurfaceVariant);
focus_sounds_label->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*focus_sounds_label);
return;

@ -67,7 +67,7 @@ PlaylistView::PlaylistView(focus_mode_util::SoundType type,
title_label_->SetMaximumWidthSingleLine(kSinglePlaylistViewWidth);
title_label_->SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosAnnotation2));
title_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
title_label_->SetLineHeight(kPlaylistTitleLineHeight);
title_label_->GetViewAccessibility().SetName(
std::u16string(), ax::mojom::NameFrom::kAttributeExplicitlyEmpty);

@ -245,8 +245,8 @@ class DragImageItemChipView : public DragImageItemView {
// `this` is never added to widget, enabled color id will never be resolved.
// Thus we need to manually resolve it and set the color as the enabled
// color for the label.
if (auto enabled_color_id = label->GetEnabledColorId()) {
label->SetEnabledColor(color_provider()->GetColor(*enabled_color_id));
if (auto enabled_color = label->GetRequestedEnabledColor()) {
label->SetEnabledColor(enabled_color->ConvertToSkColor(color_provider()));
}
label->SetElideBehavior(gfx::ElideBehavior::ELIDE_MIDDLE);

@ -625,22 +625,22 @@ void HoldingSpaceItemChipView::UpdateLabels() {
// Primary.
primary_label_->SetText(item()->GetText());
primary_label_->SetEnabledColorId(selected() && multiselect
? kColorAshMultiSelectTextColor
: kColorAshTextColorPrimary);
primary_label_->SetEnabledColor(selected() && multiselect
? kColorAshMultiSelectTextColor
: kColorAshTextColorPrimary);
// Secondary.
secondary_label_->SetText(
item()->secondary_text().value_or(std::u16string()));
if (selected() && multiselect) {
secondary_label_->SetEnabledColorId(kColorAshMultiSelectTextColor);
secondary_label_->SetEnabledColor(kColorAshMultiSelectTextColor);
} else if (const std::optional<HoldingSpaceColorVariant>& color_variant =
item()->secondary_text_color_variant()) {
// Handle the case where the `color_variant` is set.
std::visit(base::Overloaded{
[&](const ui::ColorId& color_id) {
secondary_label_->SetEnabledColorId(color_id);
secondary_label_->SetEnabledColor(color_id);
},
[&](const HoldingSpaceColors& colors) {
secondary_label_->SetEnabledColor(
@ -652,7 +652,7 @@ void HoldingSpaceItemChipView::UpdateLabels() {
*color_variant);
} else {
// Use the default color.
secondary_label_->SetEnabledColorId(kColorAshTextColorSecondary);
secondary_label_->SetEnabledColor(kColorAshTextColorSecondary);
}
secondary_label_->SetVisible(!secondary_label_->GetText().empty());

@ -140,7 +140,7 @@ void HotspotDetailedView::CreateContainer() {
const std::u16string text_label = l10n_util::GetStringFUTF16(
IDS_ASH_HOTSPOT_DETAILED_VIEW_TITLE, ui::GetChromeOSDeviceName());
entry_row_->text_label()->SetText(text_label);
entry_row_->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
entry_row_->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton1,
*entry_row_->text_label());
entry_row_->GetViewAccessibility().SetName(text_label);
@ -247,7 +247,7 @@ void HotspotDetailedView::UpdateSubText(const HotspotInfoPtr& hotspot_info) {
return;
}
// Set color for the subtext that shows hotspot is connected.
entry_row_->sub_text_label()->SetEnabledColorId(
entry_row_->sub_text_label()->SetEnabledColor(
cros_tokens::kCrosSysPositive);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosAnnotation1,
*entry_row_->sub_text_label());

@ -84,7 +84,7 @@ class ImeListItemView : public views::Button {
// |id_label| contains the IME short name (e.g., 'US', 'GB', 'IT').
views::Label* id_label = TrayPopupUtils::CreateDefaultLabel();
id_label->SetEnabledColorId(
id_label->SetEnabledColor(
static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface));
id_label->SetAutoColorReadabilityEnabled(false);
id_label->SetText(id);
@ -108,7 +108,7 @@ class ImeListItemView : public views::Button {
// The label shows the IME full name.
auto* label_view = TrayPopupUtils::CreateDefaultLabel();
label_view->SetText(label);
label_view->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label_view->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*label_view);
label_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
@ -192,7 +192,7 @@ class KeyboardStatusRow : public views::View {
auto* label = TrayPopupUtils::CreateDefaultLabel();
label->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD));
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*label);
tri_view->AddView(TriView::Container::CENTER, label);

@ -211,7 +211,7 @@ class ImeTitleView : public views::BoxLayoutView {
title_label->SetBorder(
views::CreateEmptyBorder(gfx::Insets::TLBR(0, 0, 1, 0)));
title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label->SetEnabledColorId(kColorAshTextColorPrimary);
title_label->SetEnabledColor(kColorAshTextColorPrimary);
title_label->SetAutoColorReadabilityEnabled(false);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosTitle1,
*title_label);
@ -685,7 +685,7 @@ void ImeMenuTray::UpdateTrayImageOrLabelColor(bool is_image) {
return;
}
label_->SetEnabledColorId(color_id);
label_->SetEnabledColor(color_id);
}
BEGIN_METADATA(ImeMenuTray)

@ -54,7 +54,7 @@ class UnifiedKeyboardBacklightToggleView
AddChildView(std::make_unique<views::Label>(l10n_util::GetStringUTF16(
toggled_on ? IDS_ASH_STATUS_AREA_TOAST_KBL_ON
: IDS_ASH_STATUS_AREA_TOAST_KBL_OFF)));
toast_label_->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
toast_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*toast_label_);
slider()->SetVisible(false);

@ -61,7 +61,7 @@ class LocaleItemView : public views::Button {
SetLayoutManager(std::make_unique<views::FillLayout>());
views::Label* iso_code_label = TrayPopupUtils::CreateDefaultLabel();
iso_code_label->SetEnabledColorId(
iso_code_label->SetEnabledColor(
static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface));
iso_code_label->SetAutoColorReadabilityEnabled(false);
iso_code_label->SetText(base::i18n::ToUpper(
@ -74,7 +74,7 @@ class LocaleItemView : public views::Button {
auto* display_name_view = TrayPopupUtils::CreateDefaultLabel();
display_name_view->SetText(display_name);
display_name_view->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
display_name_view->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*display_name_view);
display_name_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);

@ -224,7 +224,7 @@ MagicBoostDisclaimerView::MagicBoostDisclaimerView(
TypographyProvider::Get()
->ResolveTypographyToken(
TypographyToken::kCrosDisplay7))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT)
.SetID(magic_boost::ViewId::DisclaimerViewTitle)

@ -86,7 +86,7 @@ class ErrorContentsView : public views::FlexLayoutView,
}))
.CopyAddressTo(&error_status_text_)
.SetBorder(views::CreateEmptyBorder(kLabelPaddings))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER)
.SetID(mahi_constants::ViewId::kErrorStatusLabel)
.SetMultiLine(true)

@ -822,7 +822,7 @@ std::unique_ptr<views::View> MahiPanelView::CreateHeaderRow() {
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.SetFontList(TypographyProvider::Get()->ResolveTypographyToken(
TypographyToken::kCrosButton1))
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface),
.SetEnabledColor(cros_tokens::kCrosSysOnSurface),
// Experimental badge
views::Builder<views::View>(
std::make_unique<chromeos::ExperimentBadge>())

@ -158,7 +158,7 @@ views::Builder<views::FlexLayoutView> CreateTextBubbleBuilder(
.SetTooltipText(text)
.SetHorizontalAlignment(is_question ? gfx::ALIGN_RIGHT
: gfx::ALIGN_LEFT)
.SetEnabledColorId(
.SetEnabledColor(
is_question ? cros_tokens::kCrosSysSystemOnPrimaryContainer
: cros_tokens::kCrosSysOnSurface)
.SetAutoColorReadabilityEnabled(false)

@ -113,7 +113,7 @@ RefreshBannerView::RefreshBannerView(MahiUiController* ui_controller)
manager ? manager->GetContentTitle()
: base::EmptyString16()))
.SetAutoColorReadabilityEnabled(false)
.SetEnabledColorId(
.SetEnabledColor(
cros_tokens::kCrosSysSystemOnPrimaryContainer)
.SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(

@ -60,7 +60,7 @@ std::unique_ptr<views::View> CreateSectionHeader(const gfx::VectorIcon& icon,
auto label =
std::make_unique<views::Label>(l10n_util::GetStringUTF16(name_id));
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2, *label);
view->AddChildView(std::move(label));
@ -103,7 +103,7 @@ SummaryOutlinesElucidationSection::SummaryOutlinesElucidationSection(
.SetID(mahi_constants::ViewId::kSummaryElucidationIndicator)
.SetSelectable(false)
.SetMultiLine(false)
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.AfterBuild(base::BindOnce([](views::Label* self) {
TypographyProvider::Get()->StyleLabel(
@ -124,7 +124,7 @@ SummaryOutlinesElucidationSection::SummaryOutlinesElucidationSection(
// so we impose a maximum width constraint so that the first
// layout handle the width and height constraint correctly.
.SetMaximumWidth(kTextLabelDefaultMaximumWidth)
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.AfterBuild(base::BindOnce([](views::Label* self) {
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
@ -249,7 +249,7 @@ void SummaryOutlinesElucidationSection::HandleOutlinesLoaded(
.SetText(outline.outline_content)
.SetSelectable(true)
.SetMultiLine(true)
.SetEnabledColorId(cros_tokens::kCrosSysOnSurface)
.SetEnabledColor(cros_tokens::kCrosSysOnSurface)
.SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT)
.AfterBuild(base::BindOnce([](views::Label* self) {
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,

@ -47,9 +47,9 @@ void FormatVisibilityRow(ash::HoverHighlightView* visibility_row,
visibility_row->AddIconAndLabel(
ui::ImageModel::FromVectorIcon(vector_icon, /*color_id=*/color_id),
label);
visibility_row->text_label()->SetEnabledColorId(color_id);
visibility_row->text_label()->SetEnabledColor(color_id);
visibility_row->SetSubText(sublabel);
visibility_row->sub_text_label()->SetEnabledColorId(color_id);
visibility_row->sub_text_label()->SetEnabledColor(color_id);
visibility_row->AddRightIcon(ui::ImageModel::FromVectorIcon(
ash::kHollowCheckCircleIcon,
/*color_id=*/cros_tokens::kCrosSysOnSurface),
@ -201,7 +201,7 @@ void NearbyShareDetailedViewImpl::CreateIsEnabledContainer() {
: l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NEARBY_SHARE_TILE_LABEL_OFF),
/*start_inset=*/0);
toggle_row_->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
toggle_row_->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton1,
*toggle_row_->text_label());
@ -312,9 +312,9 @@ void NearbyShareDetailedViewImpl::FormatEveryoneRow(
ui::ImageModel::FromVectorIcon(kQuickSettingsQuickShareEveryoneIcon,
/*color_id=*/color_id),
GetEveryoneLabel());
everyone_row_->text_label()->SetEnabledColorId(color_id);
everyone_row_->text_label()->SetEnabledColor(color_id);
everyone_row_->SetSubText(GetEveryoneSublabel());
everyone_row_->sub_text_label()->SetEnabledColorId(color_id);
everyone_row_->sub_text_label()->SetEnabledColor(color_id);
auto toggle_switch = std::make_unique<Switch>(
base::BindRepeating(&NearbyShareDetailedViewImpl::OnEveryoneToggleClicked,
weak_factory_.GetWeakPtr()));

@ -169,7 +169,7 @@ HoverHighlightView* NetworkDetailedNetworkViewImpl::AddConfigureNetworkEntry(
entry->AddViewAndLabel(std::move(image_view),
GetLabelForConfigureNetworkEntry(type));
views::Label* label = entry->text_label();
label->SetEnabledColorId(cros_tokens::kCrosSysPrimary);
label->SetEnabledColor(cros_tokens::kCrosSysPrimary);
TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton2,
*label);

@ -89,7 +89,7 @@ NetworkInfoBubble::NetworkInfoBubble(base::WeakPtr<Delegate> delegate,
}
std::unique_ptr<views::Label> label = std::make_unique<views::Label>(
info_text.empty() ? ComputeInfoText() : info_text);
label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2, *label);
label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD);
label->SetID(kNetworkInfoBubbleLabelViewId);
@ -157,10 +157,10 @@ std::u16string NetworkInfoBubble::ComputeInfoText() {
address_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD);
address_label->SetSelectable(true);
title_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
title_label->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*title_label);
address_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant);
address_label->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*address_label);
container->AddChildView(title_label.release());

@ -50,7 +50,7 @@ NetworkListNetworkHeaderView::NetworkListNetworkHeaderView(
// The tooltip provides a better accessibility label than the default
// provided by AddViewAndLabel() above.
entry_row()->GetViewAccessibility().SetName(u"");
entry_row()->text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
entry_row()->text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosButton1,
*entry_row()->text_label());
entry_row()->SetExpandable(true);

@ -285,7 +285,7 @@ void NetworkListNetworkItemView::UpdateViewForNetwork(
}
if (text_label()) {
text_label()->SetEnabledColorId(cros_tokens::kCrosSysOnSurface);
text_label()->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*text_label());
}
@ -345,7 +345,7 @@ void NetworkListNetworkItemView::SetupCellularSubtext() {
}
SetSubText(l10n_util::GetStringUTF16(cellular_subtext_message_id));
sub_text_label()->SetEnabledColorId(cros_tokens::kCrosSysWarning);
sub_text_label()->SetEnabledColor(cros_tokens::kCrosSysWarning);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosAnnotation1,
*sub_text_label());
}

Some files were not shown because too many files have changed in this diff Show More