Skip to content

Commit

Permalink
Rename cros_colors to cros_styles.
Browse files Browse the repository at this point in the history
This name is changing to reflect that the generated styles are used
for more than just colors.

Bug: 1018654

Change-Id: Iec6590be397b1da0740f2608f7cf279a5ec620f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3059821
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Bo Majewski <majewski@chromium.org>
Reviewed-by: Zain Afzal <zafzal@google.com>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Bo Majewski <majewski@chromium.org>
Auto-Submit: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#908832}
  • Loading branch information
nik3daz authored and Chromium LUCI CQ committed Aug 5, 2021
1 parent fc8c598 commit 90bc54c
Show file tree
Hide file tree
Showing 42 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1971,9 +1971,9 @@ component("ash") {
"//ui/base/ime/chromeos",
"//ui/base/ime/init",
"//ui/chromeos",
"//ui/chromeos/colors:cros_colors_views",
"//ui/chromeos/events",
"//ui/chromeos/resources",
"//ui/chromeos/styles:cros_styles_views",
"//ui/compositor",
"//ui/compositor_extra",
"//ui/display",
Expand Down Expand Up @@ -2589,8 +2589,8 @@ test("ash_unittests") {
"//ui/base/ime",
"//ui/base/ime/chromeos",
"//ui/chromeos",
"//ui/chromeos/colors:cros_colors_views",
"//ui/chromeos/events",
"//ui/chromeos/styles:cros_styles_views",
"//ui/compositor",
"//ui/compositor:test_support",
"//ui/compositor_extra:compositor_extra",
Expand Down
2 changes: 1 addition & 1 deletion ash/assistant/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ component("ui") {
"//chromeos/services/libassistant/public/cpp:structs",
"//chromeos/ui/vector_icons",
"//ui/aura",
"//ui/chromeos/colors:cros_colors_views",
"//ui/chromeos/styles:cros_styles_views",
"//ui/compositor",
"//ui/gfx",
"//ui/views",
Expand Down
2 changes: 1 addition & 1 deletion ash/assistant/ui/colors/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import("//tools/style_variable_generator/style_variable_generator.gni")

style_variable_generator("assistant_colors") {
sources = [
"//ui/chromeos/colors/cros_palette.json5",
"//ui/chromeos/styles/cros_palette.json5",
"assistant_colors.json5",
]
}
Expand Down
10 changes: 5 additions & 5 deletions ash/assistant/ui/main_stage/assistant_query_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "net/base/escape.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/layout/flex_layout.h"
Expand Down Expand Up @@ -79,20 +79,20 @@ void AssistantQueryView::OnThemeChanged() {

// TODO(crbug.com/1176919): We cannot use ScopedLightModeAsDefault from
// ash/assistant/ui as it causes a circular dependency. Find a better way to
// resolve cros_colors color.
// resolve cros_styles color.
SkColor text_color_primary =
features::IsDarkLightModeEnabled()
? ColorProvider::Get()->GetContentLayerColor(
ColorProvider::ContentLayerType::kTextColorPrimary)
: cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
: cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false);
SkColor text_color_secondary =
features::IsDarkLightModeEnabled()
? ColorProvider::Get()->GetContentLayerColor(
ColorProvider::ContentLayerType::kTextColorSecondary)
: cros_colors::ResolveColor(
cros_colors::ColorName::kTextColorSecondary,
: cros_styles::ResolveColor(
cros_styles::ColorName::kTextColorSecondary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false);

Expand Down
10 changes: 5 additions & 5 deletions ash/assistant/ui/main_stage/assistant_query_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "base/feature_list.h"
#include "base/test/scoped_feature_list.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/views/background.h"
#include "ui/views/controls/label.h"
#include "ui/views/view.h"
Expand Down Expand Up @@ -49,7 +49,7 @@ TEST_F(AssistantQueryViewUnittest, ThemeDarkLightMode) {
assistant_colors::ColorName::kBgAssistantPlate,
/*is_dark_mode=*/false, /*use_debug_colors=*/false));
EXPECT_EQ(high_confidence_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false));
EXPECT_EQ(low_confidence_label->GetBackgroundColor(),
Expand All @@ -58,7 +58,7 @@ TEST_F(AssistantQueryViewUnittest, ThemeDarkLightMode) {
/*is_dark_mode=*/false, /*use_debug_colors=*/false));
EXPECT_EQ(
low_confidence_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorSecondary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorSecondary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false));

Expand All @@ -74,7 +74,7 @@ TEST_F(AssistantQueryViewUnittest, ThemeDarkLightMode) {
assistant_colors::ColorName::kBgAssistantPlate,
/*is_dark_mode=*/true, /*use_debug_colors=*/false));
EXPECT_EQ(high_confidence_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/true,
/*use_debug_colors=*/false));
EXPECT_EQ(low_confidence_label->GetBackgroundColor(),
Expand All @@ -83,7 +83,7 @@ TEST_F(AssistantQueryViewUnittest, ThemeDarkLightMode) {
/*is_dark_mode=*/true, /*use_debug_colors=*/false));
EXPECT_EQ(
low_confidence_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorSecondary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorSecondary,
/*is_dark_mode=*/true,
/*use_debug_colors=*/false));
}
Expand Down
6 changes: 3 additions & 3 deletions ash/assistant/ui/main_stage/assistant_zero_state_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "chromeos/services/assistant/public/cpp/features.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/label.h"
Expand Down Expand Up @@ -74,12 +74,12 @@ void AssistantZeroStateView::OnThemeChanged() {

// TODO(crbug.com/1176919): We cannot use ScopedLightModeAsDefault from
// ash/assistant/ui as it causes a circular dependency. Find a better way to
// resolve cros_colors color.
// resolve cros_styles color.
SkColor text_color_primary =
features::IsDarkLightModeEnabled()
? ColorProvider::Get()->GetContentLayerColor(
ColorProvider::ContentLayerType::kTextColorPrimary)
: cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
: cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false);
greeting_label_->SetEnabledColor(text_color_primary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "ash/style/ash_color_provider.h"
#include "base/test/scoped_feature_list.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/views/controls/label.h"

namespace ash {
Expand Down Expand Up @@ -50,7 +50,7 @@ TEST_F(AssistantZeroStateViewUnittest, ThemeDarkLightMode) {
assistant_colors::ColorName::kBgAssistantPlate,
/*is_dark_mode=*/false, /*use_debug_colors=*/false));
EXPECT_EQ(greeting_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/false,
/*use_debug_colors=*/false));

Expand All @@ -62,7 +62,7 @@ TEST_F(AssistantZeroStateViewUnittest, ThemeDarkLightMode) {
assistant_colors::ColorName::kBgAssistantPlate,
/*is_dark_mode=*/true, /*use_debug_colors=*/false));
EXPECT_EQ(greeting_label->GetEnabledColor(),
cros_colors::ResolveColor(cros_colors::ColorName::kTextColorPrimary,
cros_styles::ResolveColor(cros_styles::ColorName::kTextColorPrimary,
/*is_dark_mode=*/true,
/*use_debug_colors=*/false));
}
Expand Down
12 changes: 6 additions & 6 deletions ash/style/ash_color_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
Expand All @@ -34,7 +34,7 @@

namespace ash {

using ColorName = cros_colors::ColorName;
using ColorName = cros_styles::ColorName;

namespace {

Expand Down Expand Up @@ -68,8 +68,8 @@ constexpr SkColor kBackgroundColorDefaultDark = gfx::kGoogleGrey900;
constexpr int kPillButtonImageLabelSpacingDp = 8;

// Get the corresponding ColorName for |type|. ColorName is an enum in
// cros_colors.h file that is generated from cros_colors.json5, which includes
// the color IDs and colors that will be used by ChromeOS WebUI.
// cros_styles.h file that is generated from cros_colors.json5, which
// includes the color IDs and colors that will be used by ChromeOS WebUI.
ColorName TypeToColorName(AshColorProvider::ContentLayerType type) {
switch (type) {
case AshColorProvider::ContentLayerType::kTextColorPrimary:
Expand All @@ -96,11 +96,11 @@ ColorName TypeToColorName(AshColorProvider::ContentLayerType type) {
}
}

// Get the color from cros_colors.h header file that is generated from
// Get the color from cros_styles.h header file that is generated from
// cros_colors.json5. Colors there will also be used by ChromeOS WebUI.
SkColor ResolveColor(AshColorProvider::ContentLayerType type,
bool use_dark_color) {
return cros_colors::ResolveColor(
return cros_styles::ResolveColor(
TypeToColorName(type), use_dark_color,
base::FeatureList::IsEnabled(
ash::features::kSemanticColorsDebugOverride));
Expand Down
2 changes: 1 addition & 1 deletion ash/webui/common/resources/page_toolbar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<style cr-shared-style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<template>
Expand Down
2 changes: 1 addition & 1 deletion ash/webui/scanning/resources/scanning_shared_css.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/cr_elements/md_select_css.html">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/cr_elements/md_select_css.html">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/cr_elements/md_select_css.html">
Expand All @@ -10,4 +10,4 @@
background-color: var(--cros-bg-color);
}
</style>
</template>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
</style>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_styles.css">
<script type="module" src="app.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/chromeos/emoji_picker/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_styles.css">
<meta charset="utf-8">
<title>Emoji Picker</title>
<script type="module" src="emoji_picker.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">


<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_styles.css">

<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/settings/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (optimize_webui) {
"chrome://resources/cr_components/chromeos/cellular_setup/mojo_interface_provider.m.js",
"chrome://resources/cr_components/chromeos/network/mojo_interface_provider.m.js",
"chrome://resources/js/cr.m.js",
"chrome://resources/chromeos/colors/cros_colors.generated.css",
"chrome://resources/chromeos/colors/cros_styles.css",
"chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js",
"chrome://resources/mojo/url/mojom/url.mojom-lite.js",
"chrome://resources/mojo/skia/public/mojom/bitmap.mojom-lite.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>$i18n{settings}</title>
<base href="chrome://os-settings">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_styles.css">
<style>
/* The :not(body) selector allows the variable definitions below to 'win'
against the shared ones. */
Expand Down
2 changes: 1 addition & 1 deletion chromeos/components/personalization_app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static_library("personalization_app") {
"//chromeos/resources:personalization_app_resources",
"//chromeos/strings",
"//content/public/browser",
"//ui/chromeos/colors:cros_colors_views_generator",
"//ui/chromeos/styles:cros_styles_views_generator",
"//ui/resources:webui_generated_resources_grd_grit",
"//ui/resources:webui_resources_grd_grit",
"//ui/webui",
Expand Down
2 changes: 1 addition & 1 deletion chromeos/components/personalization_app/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include_rules = [
"+chromeos/grit/chromeos_personalization_app_resources.h",
"+content/public/browser",
"+content/public/common",
"+ui/chromeos/colors/cros_colors.h",
"+ui/chromeos/styles/cros_styles.h",
"+ui/resources/grit/webui_generated_resources.h",
"+ui/resources/grit/webui_generated_resources_map.h",
"+ui/resources/grit/webui_resources.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta charset="utf-8">
<link rel="stylesheet" href="/common/base.css">
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<script type="module" src="/trusted/personalization_app.js" defer></script>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="/common/base.css">
<link rel="stylesheet" href="/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="/chromeos/colors/cros_styles.css">
<script type="module" src="collections_grid.js" defer></script>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="/common/base.css">
<link rel="stylesheet" href="/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="/chromeos/colors/cros_styles.css">
<script type="module" src="images_grid.js" defer></script>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/url_constants.h"
#include "services/network/public/mojom/content_security_policy.mojom-shared.h"
#include "ui/chromeos/colors/cros_colors.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/resources/grit/webui_generated_resources.h"
#include "ui/resources/grit/webui_generated_resources_map.h"
#include "ui/resources/grit/webui_resources.h"
Expand All @@ -43,13 +43,13 @@ void AddStrings(content::WebUIDataSource* source) {
}

void AddCrosColors(content::WebUIDataSource* source) {
source->AddResourcePath("chromeos/colors/cros_colors.generated.css",
source->AddResourcePath("chromeos/colors/cros_styles.css",
IDR_WEBUI_CROS_COLORS_CSS);

source->AddString(
"crosColorsDebugOverrides",
base::FeatureList::IsEnabled(ash::features::kSemanticColorsDebugOverride)
? cros_colors::kDebugOverrideCssString
? cros_styles::kDebugOverrideCssString
: std::string());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet"
href="chrome://resources/chromeos/colors/cros_colors.generated.css">
href="chrome://resources/chromeos/colors/cros_styles.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf8">
<title>Component Playground</title>
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_colors.generated.css">
<link rel="stylesheet" href="chrome://resources/chromeos/colors/cros_styles.css">
<style>
html {
background-color: var(--cros-bg-color);
Expand Down
Loading

0 comments on commit 90bc54c

Please sign in to comment.