Commit d83ecc53 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Correct some minor color inconsistencies in desktop browser UI.

Both GoogleRed600 and GoogleRed700 were in use. Consolidate on 600.
Both GoogleGreen600 and GoogleGreen700 were in use. Consolidate on 700.

Change some code that hardcodes these colors to instead consult the
NativeTheme.

Bug: 990402
Change-Id: Ie99d58859bac22df7f71134650ab094ce8c1a94a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733094
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686237}
parent 96bb7bcb
......@@ -24,7 +24,6 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/safe_integer_conversions.h"
#include "ui/gfx/paint_vector_icon.h"
......@@ -145,11 +144,10 @@ void CardUnmaskPromptViews::GotVerificationResult(
// Replace the throbber with a warning icon. Since this is a permanent
// error we do not intend to return to a previous state.
auto error_icon = std::make_unique<views::ImageView>();
// The icon doesn't look good with the dark mode warning text color,
// so use the same color in light mode and dark mode.
// See https://crbug.com/924507
error_icon->SetImage(
gfx::CreateVectorIcon(kBrowserToolsErrorIcon, gfx::kGoogleRed700));
error_icon->SetImage(gfx::CreateVectorIcon(
kBrowserToolsErrorIcon,
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh)));
layout->StartRow(1.0, 0);
layout->AddView(std::move(error_icon));
......
......@@ -17,11 +17,11 @@
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
......@@ -124,7 +124,9 @@ void LocalCardMigrationErrorDialogView::Init() {
error_view->SetBorder(views::CreateEmptyBorder(kMigrationDialogInsets));
auto* error_image = new views::ImageView();
error_image->SetImage(
gfx::CreateVectorIcon(kBrowserToolsErrorIcon, gfx::kGoogleRed700));
gfx::CreateVectorIcon(kBrowserToolsErrorIcon,
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh)));
error_view->AddChildView(error_image);
auto* error_message = new views::Label(
......
......@@ -15,8 +15,8 @@
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
......@@ -63,11 +63,9 @@ MigratableCardView::MigratableCardView(
CONTEXT_BODY_TEXT_SMALL, ChromeTextStyle::STYLE_RED);
checkbox_uncheck_text_container_->AddChildView(checkbox_uncheck_text_);
// TODO(estade): Check whether kColorId_BubbleFooterBackground can be used for
// the colors here.
checkbox_uncheck_text_container_->SetBackground(views::CreateSolidBackground(
GetNativeTheme()->ShouldUseDarkColors() ? gfx::kGoogleGrey800
: gfx::kGoogleGrey050));
checkbox_uncheck_text_container_->SetBackground(
views::CreateSolidBackground(GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_BubbleFooterBackground)));
checkbox_uncheck_text_container_->SetVisible(false);
AddChildView(checkbox_uncheck_text_container_);
......@@ -125,8 +123,8 @@ MigratableCardView::GetMigratableCardDescriptionView(
auto* migration_succeeded_image = new views::ImageView();
migration_succeeded_image->SetImage(gfx::CreateVectorIcon(
vector_icons::kCheckCircleIcon, kMigrationResultImageSize,
GetNativeTheme()->ShouldUseDarkColors() ? gfx::kGoogleGreen200
: gfx::kGoogleGreen700));
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityLow)));
migratable_card_description_view->AddChildView(migration_succeeded_image);
break;
}
......@@ -134,8 +132,8 @@ MigratableCardView::GetMigratableCardDescriptionView(
auto* migration_failed_image = new views::ImageView();
migration_failed_image->SetImage(gfx::CreateVectorIcon(
vector_icons::kErrorIcon, kMigrationResultImageSize,
GetNativeTheme()->ShouldUseDarkColors() ? gfx::kGoogleRed300
: gfx::kGoogleRed700));
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh)));
migratable_card_description_view->AddChildView(migration_failed_image);
break;
}
......
......@@ -230,7 +230,7 @@ SkColor ChromeTypographyProvider::GetColor(const views::View& view,
: gfx::kGoogleGrey700;
case STYLE_RED:
return native_theme->ShouldUseDarkColors() ? gfx::kGoogleRed300
: gfx::kGoogleRed700;
: gfx::kGoogleRed600;
case STYLE_GREEN:
return native_theme->ShouldUseDarkColors() ? gfx::kGoogleGreen300
: gfx::kGoogleGreen700;
......
......@@ -20,6 +20,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/label_button.h"
......@@ -98,8 +99,10 @@ void EnterpriseStartupDialogView::DisplayErrorMessage(
ResetDialog(accept_button.has_value());
std::unique_ptr<views::Label> text = CreateText(error_message);
auto error_icon = std::make_unique<views::ImageView>();
error_icon->SetImage(gfx::CreateVectorIcon(kBrowserToolsErrorIcon, kIconSize,
gfx::kGoogleRed700));
error_icon->SetImage(
gfx::CreateVectorIcon(kBrowserToolsErrorIcon, kIconSize,
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh)));
if (accept_button)
GetDialogClientView()->ok_button()->SetText(*accept_button);
......
......@@ -67,15 +67,15 @@ gfx::ImageSkia ImageForBadgeType(BadgedProfilePhoto::BadgeType badge_type) {
native_theme->GetSystemColor(
ui::NativeTheme::kColorId_DefaultIconColor));
case BadgedProfilePhoto::BADGE_TYPE_SYNC_COMPLETE:
return gfx::CreateVectorIcon(kSyncCircleIcon, kBadgeIconSize,
native_theme->ShouldUseDarkColors()
? gfx::kGoogleGreen300
: gfx::kGoogleGreen700);
return gfx::CreateVectorIcon(
kSyncCircleIcon, kBadgeIconSize,
native_theme->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityLow));
case BadgedProfilePhoto::BADGE_TYPE_SYNC_ERROR:
return gfx::CreateVectorIcon(kSyncErrorCircleIcon, kBadgeIconSize,
native_theme->ShouldUseDarkColors()
? gfx::kGoogleRed300
: gfx::kGoogleRed700);
return gfx::CreateVectorIcon(
kSyncErrorCircleIcon, kBadgeIconSize,
native_theme->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh));
case BadgedProfilePhoto::BADGE_TYPE_SYNC_PAUSED:
return gfx::CreateVectorIcon(
kSyncPausedCircleIcon, kBadgeIconSize,
......
......@@ -8,11 +8,9 @@
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
......@@ -55,6 +53,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/accessibility/view_accessibility.h"
namespace {
......@@ -491,8 +490,10 @@ void ProfileChooserView::AddPreDiceSyncErrorView(
int content_string_id) {
AddMenuGroup();
auto sync_problem_icon = std::make_unique<views::ImageView>();
sync_problem_icon->SetImage(gfx::CreateVectorIcon(
kSyncProblemIcon, BadgedProfilePhoto::kImageSize, gfx::kGoogleRed700));
sync_problem_icon->SetImage(
gfx::CreateVectorIcon(kSyncProblemIcon, BadgedProfilePhoto::kImageSize,
GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_AlertSeverityHigh)));
views::Button* button = CreateAndAddTitleCard(
std::move(sync_problem_icon),
l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_TITLE),
......
......@@ -9,6 +9,7 @@
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
......@@ -93,10 +94,8 @@ AuthenticatorClientPinEntryView::AuthenticatorClientPinEntryView(
layout->StartRow(views::GridLayout::kFixedSize, 0);
auto error_label = std::make_unique<views::Label>(
base::string16(), views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY);
base::string16(), views::style::CONTEXT_LABEL, STYLE_RED);
error_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
error_label->SetEnabledColor(gfx::kGoogleRed500);
error_label_ = layout->AddView(std::move(error_label), 3 /* col_span */,
1 /* row_span */);
}
......
......@@ -370,7 +370,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id,
// Alert icon colors
case NativeTheme::kColorId_AlertSeverityLow:
return gfx::kGoogleGreen600;
return gfx::kGoogleGreen700;
case NativeTheme::kColorId_AlertSeverityMedium:
return gfx::kGoogleYellow700;
case NativeTheme::kColorId_AlertSeverityHigh:
......
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