Commit 8cd3c1a4 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Removed the need to specify input/result color in transforms.

Removed the need to specify FromInputColor/FromOutputColor in
ColorTransforms. All references to color are now taken to mean
FromOutputColor as we do not currently have a use for FromInputColor
in the code. This significantly reduces the verbosity of recipe
code.

Bug: 1887666
Change-Id: I1fa3816f738e5479eb24ae30b86e6851792913b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918640
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715703}
parent 5a68c9c5
...@@ -18,49 +18,46 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) { ...@@ -18,49 +18,46 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) {
high_contrast ? 6.0f : color_utils::kMinimumReadableContrastRatio; high_contrast ? 6.0f : color_utils::kMinimumReadableContrastRatio;
// Omnibox background colors. // Omnibox background colors.
mixer[kColorOmniboxBackground] = ui::GetResultingPaintColor( mixer[kColorOmniboxBackground] =
ui::FromTransformInput(), ui::FromInputColor(kColorToolbar)); ui::GetResultingPaintColor(ui::FromTransformInput(), kColorToolbar);
mixer[kColorOmniboxBackgroundHovered] = ui::BlendTowardMaxContrast( mixer[kColorOmniboxBackgroundHovered] =
ui::FromResultColor(kColorOmniboxBackground), 0x0A); ui::BlendTowardMaxContrast(kColorOmniboxBackground, 0x0A);
// Omnibox text colors. // Omnibox text colors.
mixer[kColorOmniboxText] = ui::GetResultingPaintColor( mixer[kColorOmniboxText] = ui::GetResultingPaintColor(
ui::FromTransformInput(), ui::FromResultColor(kColorOmniboxBackground)); ui::FromTransformInput(), kColorOmniboxBackground);
{ {
auto& selected_text = mixer[kColorOmniboxResultsTextSelected]; auto& selected_text = mixer[kColorOmniboxResultsTextSelected];
selected_text = ui::FromResultColor(kColorOmniboxText); selected_text = {kColorOmniboxText};
if (high_contrast) if (high_contrast)
selected_text += ui::ContrastInvert(ui::FromTransformInput()); selected_text += ui::ContrastInvert(ui::FromTransformInput());
} }
mixer[kColorOmniboxSelectedKeyword] = ui::SelectBasedOnDarkInput( mixer[kColorOmniboxSelectedKeyword] = ui::SelectBasedOnDarkInput(
ui::FromResultColor(kColorOmniboxBackground), gfx::kGoogleGrey100, kColorOmniboxBackground, gfx::kGoogleGrey100, kColorOmniboxResultsUrl);
ui::FromResultColor(kColorOmniboxResultsUrl));
// Bubble outline colors. // Bubble outline colors.
mixer[kColorOmniboxBubbleOutline] = ui::SelectBasedOnDarkInput( mixer[kColorOmniboxBubbleOutline] =
ui::FromResultColor(kColorOmniboxBackground), gfx::kGoogleGrey100, ui::SelectBasedOnDarkInput(kColorOmniboxBackground, gfx::kGoogleGrey100,
SkColorSetA(gfx::kGoogleGrey900, 0x24)); SkColorSetA(gfx::kGoogleGrey900, 0x24));
mixer[kColorOmniboxBubbleOutlineExperimentalKeywordMode] = mixer[kColorOmniboxBubbleOutlineExperimentalKeywordMode] = {
ui::FromResultColor(kColorOmniboxSelectedKeyword); kColorOmniboxSelectedKeyword};
// Results background colors. // Results background colors.
mixer[kColorOmniboxResultsBackground] = mixer[kColorOmniboxResultsBackground] =
ui::GetColorWithMaxContrast(ui::FromResultColor(kColorOmniboxText)); ui::GetColorWithMaxContrast(kColorOmniboxText);
mixer[kColorOmniboxResultsBackgroundHovered] = ui::BlendTowardMaxContrast( mixer[kColorOmniboxResultsBackgroundHovered] = ui::BlendTowardMaxContrast(
ui::FromResultColor(kColorOmniboxResultsBackground), kColorOmniboxResultsBackground, gfx::kGoogleGreyAlpha200);
gfx::kGoogleGreyAlpha200);
mixer[kColorOmniboxResultsBackgroundSelected] = ui::BlendTowardMaxContrast( mixer[kColorOmniboxResultsBackgroundSelected] = ui::BlendTowardMaxContrast(
ui::GetColorWithMaxContrast( ui::GetColorWithMaxContrast(kColorOmniboxResultsTextSelected),
ui::FromResultColor(kColorOmniboxResultsTextSelected)),
gfx::kGoogleGreyAlpha300); gfx::kGoogleGreyAlpha300);
// Results icon colors. // Results icon colors.
{ {
const auto results_icon = [minimum_contrast](ui::ColorId text_id, const auto results_icon = [minimum_contrast](ui::ColorId text_id,
ui::ColorId background_id) { ui::ColorId background_id) {
return ui::BlendForMinContrast( return ui::BlendForMinContrast(ui::DeriveDefaultIconColor(text_id),
ui::DeriveDefaultIconColor(ui::FromResultColor(text_id)), background_id, base::nullopt,
ui::FromResultColor(background_id), base::nullopt, minimum_contrast); minimum_contrast);
}; };
mixer[kColorOmniboxResultsIcon] = mixer[kColorOmniboxResultsIcon] =
results_icon(kColorOmniboxText, kColorOmniboxResultsBackground); results_icon(kColorOmniboxText, kColorOmniboxResultsBackground);
...@@ -75,11 +72,9 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) { ...@@ -75,11 +72,9 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) {
ui::ColorId foreground_id, ui::ColorId foreground_id,
ui::ColorId background_id) { ui::ColorId background_id) {
return ui::BlendForMinContrast( return ui::BlendForMinContrast(
ui::FromResultColor(foreground_id), foreground_id, foreground_id,
ui::FromResultColor(foreground_id), ui::BlendForMinContrast(background_id, background_id, base::nullopt,
ui::BlendForMinContrast(ui::FromResultColor(background_id), minimum_contrast),
ui::FromResultColor(background_id),
base::nullopt, minimum_contrast),
minimum_contrast); minimum_contrast);
}; };
mixer[kColorOmniboxResultsTextDimmed] = blend_with_clamped_contrast( mixer[kColorOmniboxResultsTextDimmed] = blend_with_clamped_contrast(
...@@ -95,9 +90,9 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) { ...@@ -95,9 +90,9 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) {
{ {
const auto url_color = [minimum_contrast](ui::ColorId id) { const auto url_color = [minimum_contrast](ui::ColorId id) {
return ui::BlendForMinContrast( return ui::BlendForMinContrast(
gfx::kGoogleBlue500, ui::FromResultColor(id), gfx::kGoogleBlue500, id,
ui::SelectBasedOnDarkInput(ui::FromResultColor(id), ui::SelectBasedOnDarkInput(id, gfx::kGoogleBlue050,
gfx::kGoogleBlue050, gfx::kGoogleBlue900), gfx::kGoogleBlue900),
minimum_contrast); minimum_contrast);
}; };
mixer[kColorOmniboxResultsUrl] = mixer[kColorOmniboxResultsUrl] =
...@@ -111,19 +106,16 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) { ...@@ -111,19 +106,16 @@ void AddOmniboxColorMixer(ui::ColorProvider* provider, bool high_contrast) {
const auto security_chip_color = const auto security_chip_color =
[minimum_contrast](ui::ColorTransform transform) { [minimum_contrast](ui::ColorTransform transform) {
return ui::SelectBasedOnDarkInput( return ui::SelectBasedOnDarkInput(
ui::FromResultColor(kColorOmniboxBackground), kColorOmniboxBackground,
ui::BlendTowardMaxContrast(ui::FromResultColor(kColorOmniboxText), ui::BlendTowardMaxContrast(kColorOmniboxText, 0x18),
0x18), ui::BlendForMinContrast(std::move(transform),
ui::BlendForMinContrast( kColorOmniboxBackgroundHovered,
std::move(transform),
ui::FromResultColor(kColorOmniboxBackgroundHovered),
base::nullopt, minimum_contrast)); base::nullopt, minimum_contrast));
}; };
mixer[kColorOmniboxSecurityChipDangerous] = mixer[kColorOmniboxSecurityChipDangerous] =
security_chip_color(gfx::kGoogleRed600); security_chip_color(gfx::kGoogleRed600);
mixer[kColorOmniboxSecurityChipSecure] = security_chip_color( mixer[kColorOmniboxSecurityChipSecure] =
ui::DeriveDefaultIconColor(ui::FromResultColor(kColorOmniboxText))); security_chip_color(ui::DeriveDefaultIconColor(kColorOmniboxText));
} }
mixer[kColorOmniboxSecurityChipDefault] = mixer[kColorOmniboxSecurityChipDefault] = {kColorOmniboxSecurityChipSecure};
ui::FromResultColor(kColorOmniboxSecurityChipSecure);
} }
...@@ -230,8 +230,7 @@ TEST(ColorMixerTest, GetResultColorChained) { ...@@ -230,8 +230,7 @@ TEST(ColorMixerTest, GetResultColorChained) {
mixer[kColorTest1] = BlendTowardMaxContrast( mixer[kColorTest1] = BlendTowardMaxContrast(
GetColorWithMaxContrast(FromTransformInput()), 0x29); GetColorWithMaxContrast(FromTransformInput()), 0x29);
mixer[kColorTest2] = mixer[kColorTest2] =
BlendForMinContrast(gfx::kGoogleBlue500, FromResultColor(kColorTest1), BlendForMinContrast(gfx::kGoogleBlue500, kColorTest1, kColorTest0);
FromResultColor(kColorTest0));
EXPECT_EQ(SkColorSetRGB(0x89, 0xB3, 0xF8), mixer.GetResultColor(kColorTest2)); EXPECT_EQ(SkColorSetRGB(0x89, 0xB3, 0xF8), mixer.GetResultColor(kColorTest2));
} }
......
...@@ -29,7 +29,7 @@ TEST(ColorRecipeTest, EmptyRecipeIsPassthrough) { ...@@ -29,7 +29,7 @@ TEST(ColorRecipeTest, EmptyRecipeIsPassthrough) {
// Tests that a transform in a recipe has an effect. // Tests that a transform in a recipe has an effect.
TEST(ColorRecipeTest, OneTransform) { TEST(ColorRecipeTest, OneTransform) {
constexpr SkColor kOutput = SK_ColorGREEN; constexpr SkColor kOutput = SK_ColorGREEN;
ColorRecipe recipe = ColorTransform(kOutput); ColorRecipe recipe = {kOutput};
const auto verify_transform = [&](SkColor input) { const auto verify_transform = [&](SkColor input) {
EXPECT_EQ(kOutput, recipe.GenerateResult(input, ColorMixer())); EXPECT_EQ(kOutput, recipe.GenerateResult(input, ColorMixer()));
}; };
...@@ -40,9 +40,8 @@ TEST(ColorRecipeTest, OneTransform) { ...@@ -40,9 +40,8 @@ TEST(ColorRecipeTest, OneTransform) {
// Tests that in a recipe with multiple transforms, each is applied. // Tests that in a recipe with multiple transforms, each is applied.
TEST(ColorRecipeTest, ChainedTransforms) { TEST(ColorRecipeTest, ChainedTransforms) {
ColorRecipe recipe = ColorRecipe recipe = DeriveDefaultIconColor(FromTransformInput()) +
DeriveDefaultIconColor(FromTransformInput()) + BlendForMinContrast(FromTransformInput(), kColorTest0);
BlendForMinContrast(FromTransformInput(), FromInputColor(kColorTest0));
constexpr SkColor kBackground = SK_ColorWHITE; constexpr SkColor kBackground = SK_ColorWHITE;
ColorMixer mixer; ColorMixer mixer;
mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}}); mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}});
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ui/color/color_transform.h" #include "ui/color/color_transform.h"
#include "base/bind.h" #include "base/bind.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/color_mixer.h" #include "ui/color/color_mixer.h"
namespace ui { namespace ui {
...@@ -18,6 +19,15 @@ ColorTransform::ColorTransform(SkColor color) { ...@@ -18,6 +19,15 @@ ColorTransform::ColorTransform(SkColor color) {
callback_ = base::Bind(generator, color); callback_ = base::Bind(generator, color);
} }
ColorTransform::ColorTransform(ColorId id) {
DCHECK_COLOR_ID_VALID(id);
const auto generator = [](ColorId id, SkColor input_color,
const ColorMixer& mixer) {
return mixer.GetResultColor(id);
};
callback_ = base::Bind(generator, id);
}
ColorTransform::ColorTransform(const ColorTransform&) = default; ColorTransform::ColorTransform(const ColorTransform&) = default;
ColorTransform& ColorTransform::operator=(const ColorTransform&) = default; ColorTransform& ColorTransform::operator=(const ColorTransform&) = default;
...@@ -125,24 +135,6 @@ ColorTransform FromOriginalColorFromSet(ColorId id, ColorSetId set_id) { ...@@ -125,24 +135,6 @@ ColorTransform FromOriginalColorFromSet(ColorId id, ColorSetId set_id) {
return base::Bind(generator, id, set_id); return base::Bind(generator, id, set_id);
} }
ColorTransform FromInputColor(ColorId id) {
DCHECK_COLOR_ID_VALID(id);
const auto generator = [](ColorId id, SkColor input_color,
const ColorMixer& mixer) {
return mixer.GetInputColor(id);
};
return base::Bind(generator, id);
}
ColorTransform FromResultColor(ColorId id) {
DCHECK_COLOR_ID_VALID(id);
const auto generator = [](ColorId id, SkColor input_color,
const ColorMixer& mixer) {
return mixer.GetResultColor(id);
};
return base::Bind(generator, id);
}
ColorTransform FromTransformInput() { ColorTransform FromTransformInput() {
const auto generator = [](SkColor input_color, const ColorMixer& mixer) { const auto generator = [](SkColor input_color, const ColorMixer& mixer) {
return input_color; return input_color;
......
...@@ -29,6 +29,8 @@ class COMPONENT_EXPORT(COLOR) ColorTransform { ...@@ -29,6 +29,8 @@ class COMPONENT_EXPORT(COLOR) ColorTransform {
ColorTransform(Callback callback); ColorTransform(Callback callback);
// Creates a transform that returns the supplied |color|. // Creates a transform that returns the supplied |color|.
ColorTransform(SkColor color); ColorTransform(SkColor color);
// Creates a transform that returns the result color for the supplied |id|.
ColorTransform(ColorId id);
ColorTransform(const ColorTransform&); ColorTransform(const ColorTransform&);
ColorTransform& operator=(const ColorTransform&); ColorTransform& operator=(const ColorTransform&);
~ColorTransform(); ~ColorTransform();
...@@ -86,12 +88,6 @@ ColorTransform DeriveDefaultIconColor(ColorTransform transform); ...@@ -86,12 +88,6 @@ ColorTransform DeriveDefaultIconColor(ColorTransform transform);
COMPONENT_EXPORT(COLOR) COMPONENT_EXPORT(COLOR)
ColorTransform FromOriginalColorFromSet(ColorId id, ColorSetId set_id); ColorTransform FromOriginalColorFromSet(ColorId id, ColorSetId set_id);
// A transform which returns the input color |id|.
COMPONENT_EXPORT(COLOR) ColorTransform FromInputColor(ColorId id);
// A transform which returns the result color |id|.
COMPONENT_EXPORT(COLOR) ColorTransform FromResultColor(ColorId id);
// A transform which returns the transform's input color (i.e. does nothing). // A transform which returns the transform's input color (i.e. does nothing).
// This is useful to supply as an argument to other transforms to control how // This is useful to supply as an argument to other transforms to control how
// the input color is routed. // the input color is routed.
......
...@@ -41,7 +41,7 @@ TEST(ColorTransformTest, AlphaBlend) { ...@@ -41,7 +41,7 @@ TEST(ColorTransformTest, AlphaBlend) {
// background color. // background color.
TEST(ColorTransformTest, BlendForMinContrast) { TEST(ColorTransformTest, BlendForMinContrast) {
const ColorTransform transform = const ColorTransform transform =
BlendForMinContrast(FromTransformInput(), FromInputColor(kColorTest0)); BlendForMinContrast(FromTransformInput(), kColorTest0);
constexpr SkColor kBackground = SK_ColorWHITE; constexpr SkColor kBackground = SK_ColorWHITE;
ColorMixer mixer; ColorMixer mixer;
mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}}); mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}});
...@@ -60,9 +60,8 @@ TEST(ColorTransformTest, BlendForMinContrast) { ...@@ -60,9 +60,8 @@ TEST(ColorTransformTest, BlendForMinContrast) {
// ratio. // ratio.
TEST(ColorTransformTest, BlendForMinContrastOptionalArgs) { TEST(ColorTransformTest, BlendForMinContrastOptionalArgs) {
constexpr float kMinContrast = 6.0f; constexpr float kMinContrast = 6.0f;
const ColorTransform transform = const ColorTransform transform = BlendForMinContrast(
BlendForMinContrast(FromTransformInput(), FromInputColor(kColorTest0), FromTransformInput(), kColorTest0, kColorTest1, kMinContrast);
FromInputColor(kColorTest1), kMinContrast);
constexpr SkColor kBackground = SK_ColorWHITE; constexpr SkColor kBackground = SK_ColorWHITE;
ColorMixer mixer; ColorMixer mixer;
mixer.AddSet( mixer.AddSet(
...@@ -172,31 +171,15 @@ TEST(ColorTransformTest, FromOriginalColorFromSet) { ...@@ -172,31 +171,15 @@ TEST(ColorTransformTest, FromOriginalColorFromSet) {
verify_color(SK_ColorRED); verify_color(SK_ColorRED);
} }
// Tests that FromInputColor() produces a transform that ignores // Tests that a transform created from a ColorId produces a transform that
// the input color and always outputs a specified input color. // ignores the input color and always outputs a specified result color.
TEST(ColorTransformTest, FromInputColor) { TEST(ColorTransformTest, FromColorId) {
const ColorTransform transform = FromInputColor(kColorTest0); const ColorTransform transform = {kColorTest0};
constexpr SkColor kTest0Color = SK_ColorGREEN;
ColorMixer mixer;
mixer.AddSet({kColorSetTest0,
{{kColorTest0, kTest0Color}, {kColorTest1, SK_ColorRED}}});
const auto verify_color = [&](SkColor input) {
EXPECT_EQ(kTest0Color, transform.Run(input, mixer));
};
verify_color(SK_ColorBLACK);
verify_color(SK_ColorWHITE);
verify_color(SK_ColorRED);
} // namespace
// Tests that FromResultColor() produces a transform that ignores
// the input color and always outputs a specified result color.
TEST(ColorTransformTest, FromResultColor) {
const ColorTransform transform = FromResultColor(kColorTest0);
constexpr SkColor kTest1Color = SK_ColorRED; constexpr SkColor kTest1Color = SK_ColorRED;
ColorMixer mixer; ColorMixer mixer;
mixer.AddSet({kColorSetTest0, mixer.AddSet({kColorSetTest0,
{{kColorTest0, SK_ColorGREEN}, {kColorTest1, kTest1Color}}}); {{kColorTest0, SK_ColorGREEN}, {kColorTest1, kTest1Color}}});
mixer[kColorTest0] = FromInputColor(kColorTest1); mixer[kColorTest0] = {kColorTest1};
const auto verify_color = [&](SkColor input) { const auto verify_color = [&](SkColor input) {
EXPECT_EQ(kTest1Color, transform.Run(input, mixer)); EXPECT_EQ(kTest1Color, transform.Run(input, mixer));
}; };
...@@ -234,7 +217,7 @@ TEST(ColorTransformTest, GetColorWithMaxContrast) { ...@@ -234,7 +217,7 @@ TEST(ColorTransformTest, GetColorWithMaxContrast) {
// opaquely. // opaquely.
TEST(ColorTransformTest, GetResultingPaintColor) { TEST(ColorTransformTest, GetResultingPaintColor) {
const ColorTransform transform = const ColorTransform transform =
GetResultingPaintColor(FromTransformInput(), FromInputColor(kColorTest0)); GetResultingPaintColor(FromTransformInput(), kColorTest0);
constexpr SkColor kBackground = SK_ColorWHITE; constexpr SkColor kBackground = SK_ColorWHITE;
ColorMixer mixer; ColorMixer mixer;
mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}}); mixer.AddSet({kColorSetTest0, {{kColorTest0, kBackground}}});
......
...@@ -67,12 +67,11 @@ ColorMixer& AddMixerForLightMode(ColorProvider* provider) { ...@@ -67,12 +67,11 @@ ColorMixer& AddMixerForLightMode(ColorProvider* provider) {
void AddCoreDefaultColorMixers(ColorProvider* provider, bool dark_window) { void AddCoreDefaultColorMixers(ColorProvider* provider, bool dark_window) {
ColorMixer& mixer = dark_window ? AddMixerForDarkMode(provider) ColorMixer& mixer = dark_window ? AddMixerForDarkMode(provider)
: AddMixerForLightMode(provider); : AddMixerForLightMode(provider);
mixer[kColorSecondaryBackground] = BlendForMinContrastWithSelf( mixer[kColorSecondaryBackground] =
FromResultColor(kColorPrimaryBackground), 1.67f); BlendForMinContrastWithSelf(kColorPrimaryBackground, 1.67f);
mixer[kColorSecondaryForeground] = mixer[kColorSecondaryForeground] =
BlendForMinContrast(FromResultColor(kColorDisabledForeground), BlendForMinContrast(kColorDisabledForeground, kColorPrimaryBackground,
FromResultColor(kColorPrimaryBackground), kColorPrimaryForeground);
FromResultColor(kColorPrimaryForeground));
// TODO(pkasting): High contrast? // TODO(pkasting): High contrast?
} }
......
...@@ -15,96 +15,77 @@ namespace ui { ...@@ -15,96 +15,77 @@ namespace ui {
void AddUiColorMixers(ColorProvider* provider) { void AddUiColorMixers(ColorProvider* provider) {
ColorMixer& mixer = provider->AddMixer(); ColorMixer& mixer = provider->AddMixer();
mixer[kColorBubbleBackground] = FromInputColor(kColorPrimaryBackground); mixer[kColorBubbleBackground] = {kColorPrimaryBackground};
mixer[kColorBubbleFooterBackground] = mixer[kColorBubbleFooterBackground] = {kColorSecondaryBackgroundSubtle};
FromInputColor(kColorSecondaryBackgroundSubtle); mixer[kColorButtonBackground] = {kColorPrimaryBackground};
mixer[kColorButtonBackground] = FromInputColor(kColorPrimaryBackground); mixer[kColorButtonBorder] = {kColorSecondaryBackground};
mixer[kColorButtonBorder] = FromInputColor(kColorSecondaryBackground); mixer[kColorButtonDisabledForeground] = {kColorDisabledForeground};
mixer[kColorButtonDisabledForeground] = mixer[kColorButtonProminentBackground] = {kColorAccent};
FromInputColor(kColorDisabledForeground); mixer[kColorButtonProminentDisabledBackground] =
mixer[kColorButtonProminentBackground] = FromInputColor(kColorAccent); AlphaBlend(kColorSecondaryBackground, kColorButtonBackground,
mixer[kColorButtonProminentDisabledBackground] = AlphaBlend( gfx::kDisabledControlAlpha);
FromInputColor(kColorSecondaryBackground), mixer[kColorButtonProminentFocusedBackground] =
FromResultColor(kColorButtonBackground), gfx::kDisabledControlAlpha); BlendForMinContrastWithSelf(kColorButtonProminentBackground, 1.3f);
mixer[kColorButtonProminentFocusedBackground] = BlendForMinContrastWithSelf(
FromResultColor(kColorButtonProminentBackground), 1.3f);
mixer[kColorButtonProminentForeground] = mixer[kColorButtonProminentForeground] =
GetColorWithMaxContrast(FromResultColor(kColorButtonProminentBackground)); GetColorWithMaxContrast(kColorButtonProminentBackground);
mixer[kColorDialogBackground] = FromInputColor(kColorPrimaryBackground); mixer[kColorDialogBackground] = {kColorPrimaryBackground};
mixer[kColorFocusableBorderFocused] = mixer[kColorFocusableBorderFocused] = SetAlpha(kColorAccent, 0x4D);
SetAlpha(FromInputColor(kColorAccent), 0x4D); mixer[kColorFocusableBorderUnfocused] = {kColorSecondaryBackground};
mixer[kColorFocusableBorderUnfocused] = mixer[kColorLabelDisabledForeground] =
FromInputColor(kColorSecondaryBackground); SetAlpha(kColorLabelForeground, gfx::kDisabledControlAlpha);
mixer[kColorLabelDisabledForeground] = SetAlpha( mixer[kColorLabelForeground] = {kColorPrimaryForeground};
FromResultColor(kColorLabelForeground), gfx::kDisabledControlAlpha); mixer[kColorLabelSelectionBackground] = {kColorTextSelectionBackground};
mixer[kColorLabelForeground] = FromInputColor(kColorPrimaryForeground); mixer[kColorLabelSelectionForeground] = {kColorLabelForeground};
mixer[kColorLabelSelectionBackground] = mixer[kColorLinkDisabledForeground] = {kColorPrimaryForeground};
FromInputColor(kColorTextSelectionBackground); mixer[kColorLinkPressedForeground] = {kColorLinkForeground};
mixer[kColorLabelSelectionForeground] = mixer[kColorMenuBackground] = {kColorPrimaryBackground};
FromResultColor(kColorLabelForeground); mixer[kColorMenuBorder] = {kColorSecondaryBackground};
mixer[kColorLinkDisabledForeground] = FromInputColor(kColorPrimaryForeground); mixer[kColorMenuItemAlertedBackground] = {kColorAccent};
mixer[kColorLinkPressedForeground] = FromInputColor(kColorLinkForeground); mixer[kColorMenuItemDisabledForeground] = {kColorDisabledForeground};
mixer[kColorMenuBackground] = FromInputColor(kColorPrimaryBackground); mixer[kColorMenuItemForeground] = {kColorPrimaryForeground};
mixer[kColorMenuBorder] = FromInputColor(kColorSecondaryBackground); mixer[kColorMenuItemHighlightedBackground] = {
mixer[kColorMenuItemAlertedBackground] = FromInputColor(kColorAccent); kColorSecondaryBackgroundSubtle};
mixer[kColorMenuItemDisabledForeground] = mixer[kColorMenuItemHighlightedForeground] = {kColorMenuItemForeground};
FromInputColor(kColorDisabledForeground); mixer[kColorMenuItemSecondaryForeground] = {kColorSecondaryForeground};
mixer[kColorMenuItemForeground] = FromInputColor(kColorPrimaryForeground); mixer[kColorMenuItemSelectedBackground] = {kColorSecondaryBackground};
mixer[kColorMenuItemHighlightedBackground] = mixer[kColorMenuItemSelectedForeground] = {kColorMenuItemForeground};
FromInputColor(kColorSecondaryBackgroundSubtle); mixer[kColorMenuSeparator] = {kColorSeparatorForeground};
mixer[kColorMenuItemHighlightedForeground] = mixer[kColorTabContentSeparator] = {kColorSecondaryBackground};
FromResultColor(kColorMenuItemForeground); mixer[kColorTabForeground] = {kColorSecondaryForeground};
mixer[kColorMenuItemSecondaryForeground] = mixer[kColorTabSelectedForeground] = {kColorAccent};
FromInputColor(kColorSecondaryForeground); mixer[kColorTableBackground] = {kColorPrimaryBackground};
mixer[kColorMenuItemSelectedBackground] = mixer[kColorTableForeground] = {kColorPrimaryForeground};
FromInputColor(kColorSecondaryBackground); mixer[kColorTableGroupingIndicator] = {kColorTableSelectedFocusedBackground};
mixer[kColorMenuItemSelectedForeground] = mixer[kColorTableHeaderBackground] = {kColorTableBackground};
FromResultColor(kColorMenuItemForeground); mixer[kColorTableHeaderForeground] = {kColorTableForeground};
mixer[kColorMenuSeparator] = FromInputColor(kColorSeparatorForeground); mixer[kColorTableHeaderSeparator] = {kColorSeparatorForeground};
mixer[kColorTabContentSeparator] = FromInputColor(kColorSecondaryBackground); mixer[kColorTableSelectedFocusedBackground] = {kColorSecondaryBackground};
mixer[kColorTabForeground] = FromInputColor(kColorSecondaryForeground); mixer[kColorTableSelectedFocusedForeground] = {kColorTableForeground};
mixer[kColorTabSelectedForeground] = FromInputColor(kColorAccent); mixer[kColorTableSelectedUnfocusedBackground] = {
mixer[kColorTableBackground] = FromInputColor(kColorPrimaryBackground); kColorTableSelectedFocusedBackground};
mixer[kColorTableForeground] = FromInputColor(kColorPrimaryForeground); mixer[kColorTableSelectedUnfocusedForeground] = {
mixer[kColorTableGroupingIndicator] = kColorTableSelectedFocusedForeground};
FromResultColor(kColorTableSelectedFocusedBackground); mixer[kColorTextfieldBackground] = {kColorPrimaryBackground};
mixer[kColorTableHeaderBackground] = FromResultColor(kColorTableBackground); mixer[kColorTextfieldDisabledBackground] = {kColorTextfieldBackground};
mixer[kColorTableHeaderForeground] = FromResultColor(kColorTableForeground); mixer[kColorTextfieldDisabledForeground] =
mixer[kColorTableHeaderSeparator] = FromInputColor(kColorSeparatorForeground); SetAlpha(kColorTextfieldForeground, gfx::kDisabledControlAlpha);
mixer[kColorTableSelectedFocusedBackground] = mixer[kColorTextfieldForeground] = {kColorPrimaryForeground};
FromInputColor(kColorSecondaryBackground); mixer[kColorTextfieldSelectionBackground] = {kColorTextSelectionBackground};
mixer[kColorTableSelectedFocusedForeground] = mixer[kColorTextfieldSelectionForeground] = {kColorTextfieldForeground};
FromResultColor(kColorTableForeground); mixer[kColorThrobber] = {kColorAccent};
mixer[kColorTableSelectedUnfocusedBackground] = mixer[kColorTooltipBackground] =
FromResultColor(kColorTableSelectedFocusedBackground); SetAlpha(GetColorWithMaxContrast(kColorPrimaryBackground), 0xE9);
mixer[kColorTableSelectedUnfocusedForeground] = mixer[kColorTooltipForeground] =
FromResultColor(kColorTableSelectedFocusedForeground); SetAlpha(GetColorWithMaxContrast(kColorTooltipBackground), 0xDE);
mixer[kColorTextfieldBackground] = FromInputColor(kColorPrimaryBackground); mixer[kColorTreeBackground] = {kColorPrimaryBackground};
mixer[kColorTextfieldDisabledBackground] = mixer[kColorTreeNodeForeground] = {kColorPrimaryForeground};
FromResultColor(kColorTextfieldBackground); mixer[kColorTreeNodeSelectedFocusedBackground] = {kColorSecondaryBackground};
mixer[kColorTextfieldDisabledForeground] = SetAlpha( mixer[kColorTreeNodeSelectedFocusedForeground] = {kColorTreeNodeForeground};
FromResultColor(kColorTextfieldForeground), gfx::kDisabledControlAlpha); mixer[kColorTreeNodeSelectedUnfocusedBackground] = {
mixer[kColorTextfieldForeground] = FromInputColor(kColorPrimaryForeground); kColorTreeNodeSelectedFocusedBackground};
mixer[kColorTextfieldSelectionBackground] = mixer[kColorTreeNodeSelectedUnfocusedForeground] = {
FromInputColor(kColorTextSelectionBackground); kColorTreeNodeSelectedFocusedForeground};
mixer[kColorTextfieldSelectionForeground] = mixer[kColorWindowBackground] = {kColorPrimaryBackground};
FromResultColor(kColorTextfieldForeground);
mixer[kColorThrobber] = FromInputColor(kColorAccent);
mixer[kColorTooltipBackground] = SetAlpha(
GetColorWithMaxContrast(FromInputColor(kColorPrimaryBackground)), 0xE9);
mixer[kColorTooltipForeground] = SetAlpha(
GetColorWithMaxContrast(FromResultColor(kColorTooltipBackground)), 0xDE);
mixer[kColorTreeBackground] = FromInputColor(kColorPrimaryBackground);
mixer[kColorTreeNodeForeground] = FromInputColor(kColorPrimaryForeground);
mixer[kColorTreeNodeSelectedFocusedBackground] =
FromInputColor(kColorSecondaryBackground);
mixer[kColorTreeNodeSelectedFocusedForeground] =
FromResultColor(kColorTreeNodeForeground);
mixer[kColorTreeNodeSelectedUnfocusedBackground] =
FromResultColor(kColorTreeNodeSelectedFocusedBackground);
mixer[kColorTreeNodeSelectedUnfocusedForeground] =
FromResultColor(kColorTreeNodeSelectedFocusedForeground);
mixer[kColorWindowBackground] = FromInputColor(kColorPrimaryBackground);
} }
} // namespace ui } // namespace ui
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