Commit cbe377d8 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Added chrome default color ids

Added color mixer that defines default chrome color ids used by the
omnibox that conform to existing color semantics in color pipeline.

Bug: 1003612
Change-Id: Ie91b66644eacc115efac992cac6ecc277c7a80c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1922971
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716938}
parent 480d3c55
...@@ -2962,8 +2962,6 @@ jumbo_static_library("ui") { ...@@ -2962,8 +2962,6 @@ jumbo_static_library("ui") {
"views/native_file_system/native_file_system_ui_helpers.h", "views/native_file_system/native_file_system_ui_helpers.h",
"views/native_file_system/native_file_system_usage_bubble_view.cc", "views/native_file_system/native_file_system_usage_bubble_view.cc",
"views/native_file_system/native_file_system_usage_bubble_view.h", "views/native_file_system/native_file_system_usage_bubble_view.h",
"views/omnibox/omnibox_color_mixer.cc",
"views/omnibox/omnibox_color_mixer.h",
"views/omnibox/omnibox_match_cell_view.cc", "views/omnibox/omnibox_match_cell_view.cc",
"views/omnibox/omnibox_match_cell_view.h", "views/omnibox/omnibox_match_cell_view.h",
"views/omnibox/omnibox_popup_contents_view.cc", "views/omnibox/omnibox_popup_contents_view.cc",
...@@ -3287,6 +3285,7 @@ jumbo_static_library("ui") { ...@@ -3287,6 +3285,7 @@ jumbo_static_library("ui") {
"webauthn/transport_utils.h", "webauthn/transport_utils.h",
] ]
deps += [ deps += [
"//chrome/browser/ui/color:mixers",
"//chrome/browser/ui/views", "//chrome/browser/ui/views",
"//components/constrained_window", "//components/constrained_window",
"//components/media_message_center", "//components/media_message_center",
......
...@@ -19,6 +19,21 @@ executable("dump_colors") { ...@@ -19,6 +19,21 @@ executable("dump_colors") {
"tools/dump_colors.cc", "tools/dump_colors.cc",
] ]
deps = [
":color",
":mixers",
"//ui/color:mixers",
]
}
source_set("mixers") {
sources = [
"chrome_color_mixers.cc",
"chrome_color_mixers.h",
"omnibox_color_mixers.cc",
"omnibox_color_mixers.h",
]
deps = [ deps = [
":color", ":color",
"//ui/color:mixers", "//ui/color:mixers",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/color/chrome_color_mixers.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "ui/color/color_id.h"
#include "ui/color/color_mixer.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_recipe.h"
void AddChromeColorMixers(ui::ColorProvider* provider) {
ui::ColorMixer& mixer = provider->AddMixer();
mixer[kColorOmniboxBackground] = ui::BlendForMinContrast(
ui::kColorTextfieldBackground, kColorToolbar, base::nullopt, 1.11f);
mixer[kColorOmniboxText] = {ui::kColorTextfieldForeground};
// TODO(tluk) Behavior change for dark mode to a darker toolbar color for
// better color semantics. Follow up with UX team before landing change.
mixer[kColorToolbar] = {ui::kColorPrimaryBackground};
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COLOR_CHROME_COLOR_MIXERS_H_
#define CHROME_BROWSER_UI_COLOR_CHROME_COLOR_MIXERS_H_
namespace ui {
class ColorProvider;
}
// Adds color mixers to |provider| that supply default values for various
// chrome/ colors before taking into account any custom themes.
void AddChromeColorMixers(ui::ColorProvider* provider);
#endif // CHROME_BROWSER_UI_COLOR_CHROME_COLOR_MIXERS_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/omnibox/omnibox_color_mixer.h" #include "chrome/browser/ui/color/omnibox_color_mixers.h"
#include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/color/chrome_color_id.h"
#include "ui/color/color_mixer.h" #include "ui/color/color_mixer.h"
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) { void AddOmniboxColorMixers(ui::ColorProvider* provider, bool high_contrast) {
ui::ColorMixer& mixer = provider->AddMixer(); ui::ColorMixer& mixer = provider->AddMixer();
const float minimum_contrast = const float minimum_contrast =
high_contrast ? 6.0f : color_utils::kMinimumReadableContrastRatio; high_contrast ? 6.0f : color_utils::kMinimumReadableContrastRatio;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_COLOR_MIXER_H_ #ifndef CHROME_BROWSER_UI_COLOR_OMNIBOX_COLOR_MIXERS_H_
#define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_COLOR_MIXER_H_ #define CHROME_BROWSER_UI_COLOR_OMNIBOX_COLOR_MIXERS_H_
namespace ui { namespace ui {
class ColorProvider; class ColorProvider;
...@@ -12,6 +12,6 @@ class ColorProvider; ...@@ -12,6 +12,6 @@ class ColorProvider;
// Adds a color mixer to |provider| that contains recipes for omnibox colors, // Adds a color mixer to |provider| that contains recipes for omnibox colors,
// given whether they should be |high_contrast|. // given whether they should be |high_contrast|.
// TODO(pkasting): Perhaps |high_contrast| should be a bit on the ColorProvider. // TODO(pkasting): Perhaps |high_contrast| should be a bit on the ColorProvider.
void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast); void AddOmniboxColorMixers(ui::ColorProvider* provider, bool high_contrast);
#endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_COLOR_MIXER_H_ #endif // CHROME_BROWSER_UI_COLOR_OMNIBOX_COLOR_MIXERS_H_
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <iostream> #include <iostream>
#include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/color/chrome_color_mixers.h"
#include "chrome/browser/ui/color/omnibox_color_mixers.h"
#include "ui/color/color_mixers.h" #include "ui/color/color_mixers.h"
#include "ui/color/color_provider.h" #include "ui/color/color_provider.h"
...@@ -19,6 +21,8 @@ int main(int argc, const char* argv[]) { ...@@ -19,6 +21,8 @@ int main(int argc, const char* argv[]) {
ui::AddCoreDefaultColorMixers(provider, dark_window); ui::AddCoreDefaultColorMixers(provider, dark_window);
ui::AddNativeColorMixers(provider); ui::AddNativeColorMixers(provider);
ui::AddUiColorMixers(provider); ui::AddUiColorMixers(provider);
AddChromeColorMixers(provider);
AddOmniboxColorMixers(provider, false);
}; };
ui::ColorProvider light_provider, dark_provider; ui::ColorProvider light_provider, dark_provider;
add_mixers(&light_provider, false); add_mixers(&light_provider, false);
......
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