File: examples_color_mixer.cc

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (74 lines) | stat: -rw-r--r-- 3,967 bytes parent folder | download | duplicates (11)
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