1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/examples/examples_color_mixer.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/color_mixer.h"
#include "ui/color/color_recipe.h"
#include "ui/color/color_transform.h"
#include "ui/gfx/color_palette.h"
#include "ui/views/examples/examples_color_id.h"
namespace views::examples {
void AddExamplesColorMixers(ui::ColorProvider* color_provider,
const ui::ColorProviderKey& key) {
const bool dark_mode =
key.color_mode == ui::ColorProviderKey::ColorMode::kDark;
using Ids = ExamplesColorIds;
ui::ColorMixer& mixer = color_provider->AddMixer();
mixer[Ids::kColorAnimatedImageViewExampleBorder] = {SK_ColorBLACK};
mixer[Ids::kColorAnimationExampleForeground] = {SK_ColorBLACK};
mixer[Ids::kColorAnimationExampleBackground] = {SK_ColorWHITE};
mixer[Ids::kColorAccessibilityExampleBackground] = {SK_ColorWHITE};
mixer[Ids::kColorBubbleExampleBackground1] = {SK_ColorWHITE};
mixer[Ids::kColorBubbleExampleBackground2] = {SK_ColorGRAY};
mixer[Ids::kColorBubbleExampleBackground3] = {SK_ColorCYAN};
mixer[Ids::kColorBubbleExampleBackground4] = {
SkColorSetRGB(0xC1, 0xB1, 0xE1)};
mixer[Ids::kColorDesignerGrabHandle] = {gfx::kGoogleGrey500};
mixer[Ids::kColorDesignerGrid] = {SK_ColorBLACK};
mixer[Ids::kColorFadeAnimationExampleBorder] = {gfx::kGoogleGrey900};
mixer[Ids::kColorFadeAnimationExampleBackground] = {SK_ColorWHITE};
mixer[Ids::kColorFadeAnimationExampleForeground] = {gfx::kGoogleBlue800};
mixer[Ids::kColorInkDropExampleBase] = {SK_ColorBLACK};
mixer[Ids::kColorInkDropExampleBorder] = {SK_ColorBLACK};
mixer[Ids::kColorLabelExampleBlueLabel] = {SK_ColorBLUE};
mixer[Ids::kColorLabelExampleBorder] = {SK_ColorGRAY};
mixer[Ids::kColorLabelExampleThickBorder] = {SK_ColorRED};
mixer[Ids::kColorLabelExampleLowerShadow] = {SK_ColorGRAY};
mixer[Ids::kColorLabelExampleUpperShadow] = {SK_ColorRED};
mixer[Ids::kColorLabelExampleCustomBackground] = {SK_ColorLTGRAY};
mixer[Ids::kColorLabelExampleCustomBorder] = {SK_ColorGRAY};
mixer[Ids::kColorMenuButtonExampleBorder] = {SK_ColorGRAY};
mixer[Ids::kColorMultilineExampleBorder] = {SK_ColorGRAY};
mixer[Ids::kColorMultilineExampleColorRange] = {SK_ColorRED};
mixer[Ids::kColorMultilineExampleForeground] = {SK_ColorBLACK};
mixer[Ids::kColorMultilineExampleLabelBorder] = {SK_ColorCYAN};
mixer[Ids::kColorMultilineExampleSelectionBackground] = {SK_ColorGRAY};
mixer[Ids::kColorMultilineExampleSelectionForeground] = {SK_ColorBLACK};
mixer[Ids::kColorNotificationExampleImage] = {SK_ColorGREEN};
mixer[Ids::kColorScrollViewExampleBigSquareFrom] = {SK_ColorRED};
mixer[Ids::kColorScrollViewExampleBigSquareTo] = {SK_ColorGREEN};
mixer[Ids::kColorScrollViewExampleSmallSquareFrom] = {SK_ColorYELLOW};
mixer[Ids::kColorScrollViewExampleSmallSquareTo] = {SK_ColorGREEN};
mixer[Ids::kColorScrollViewExampleTallFrom] = {SK_ColorRED};
mixer[Ids::kColorScrollViewExampleTallTo] = {SK_ColorCYAN};
mixer[Ids::kColorScrollViewExampleWideFrom] = {SK_ColorYELLOW};
mixer[Ids::kColorScrollViewExampleWideTo] = {SK_ColorCYAN};
mixer[Ids::kColorTableExampleEvenRowIcon] = {SK_ColorRED};
mixer[Ids::kColorTableExampleOddRowIcon] = {SK_ColorBLUE};
mixer[Ids::kColorTextfieldExampleBigRange] = {SK_ColorBLUE};
mixer[Ids::kColorTextfieldExampleName] = {SK_ColorGREEN};
mixer[Ids::kColorTextfieldExampleSmallRange] = {SK_ColorRED};
mixer[Ids::kColorVectorExampleImageBorder] = {SK_ColorBLACK};
mixer[Ids::kColorWidgetExampleContentBorder] = {SK_ColorGRAY};
mixer[Ids::kColorWidgetExampleDialogBorder] = {SK_ColorGRAY};
mixer[Ids::kColorButtonBackgroundFab] = {dark_mode ? ui::kColorRefSecondary30
: ui::kColorRefPrimary90};
}
} // namespace views::examples
|