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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
// 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 "build/build_config.h"
#include "ui/color/color_mixers.h"
#include "ui/color/color_mixer.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_recipe.h"
#include "ui/color/color_transform.h"
#include "ui/gfx/color_palette.h"
namespace ui {
void AddUiColorMixer(ColorProvider* provider,
bool dark_window,
bool high_contrast) {
ColorMixer& mixer = provider->AddMixer();
mixer[kColorAvatarHeaderArt] = {kColorMidground};
mixer[kColorAvatarIconGuest] = {kColorSecondaryForeground};
mixer[kColorAvatarIconIncognito] = {kColorPrimaryForeground};
mixer[kColorBubbleBackground] = {kColorPrimaryBackground};
mixer[kColorBubbleBorder] = {kColorMidground};
mixer[kColorBubbleBorderShadowLarge] = {SetAlpha(kColorShadowBase, 0x1A)};
mixer[kColorBubbleBorderShadowSmall] = {SetAlpha(kColorShadowBase, 0x33)};
mixer[kColorBubbleBorderWhenShadowPresent] = {SetAlpha(SK_ColorBLACK, 0x26)};
mixer[kColorBubbleFooterBackground] = {kColorSubtleEmphasisBackground};
mixer[kColorBubbleFooterBorder] = {kColorMidground};
mixer[kColorButtonBackground] = {kColorPrimaryBackground};
mixer[kColorButtonBackgroundPressed] = {kColorButtonBackground};
mixer[kColorButtonBackgroundProminent] = {kColorAccent};
mixer[kColorButtonBackgroundProminentDisabled] = {
kColorSubtleEmphasisBackground};
mixer[kColorButtonBackgroundProminentFocused] = {
kColorButtonBackgroundProminent};
mixer[kColorButtonBorder] = {kColorMidground};
mixer[kColorButtonBorderDisabled] = {kColorSubtleEmphasisBackground};
mixer[kColorButtonForeground] = {kColorAccent};
mixer[kColorButtonForegroundChecked] = {kColorButtonForeground};
mixer[kColorButtonForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorButtonForegroundProminent] =
GetColorWithMaxContrast(kColorButtonBackgroundProminent);
mixer[kColorButtonForegroundUnchecked] = {kColorSecondaryForeground};
mixer[kColorDialogBackground] = {kColorPrimaryBackground};
mixer[kColorDialogForeground] = {kColorSecondaryForeground};
mixer[kColorDropdownBackground] = {kColorPrimaryBackground};
mixer[kColorDropdownBackgroundSelected] = {kColorMenuSelectionBackground};
mixer[kColorDropdownForeground] = {kColorPrimaryForeground};
mixer[kColorDropdownForegroundSelected] = {kColorPrimaryForeground};
mixer[kColorFocusableBorderFocused] = {kColorItemHighlight};
mixer[kColorFocusableBorderUnfocused] = {kColorMidground};
mixer[kColorFocusAura] = SetAlpha(kColorAccent, 0x3D);
mixer[kColorFrameActive] = {dark_window ? gfx::kGoogleGrey900
: SkColorSetRGB(0xDE, 0xE1, 0xE6)};
mixer[kColorFrameInactive] = {dark_window ? gfx::kGoogleGrey800
: gfx::kGoogleGrey200};
mixer[kColorHelpIconActive] = {kColorPrimaryForeground};
mixer[kColorHelpIconInactive] = {kColorSecondaryForeground};
mixer[kColorIcon] = {kColorSecondaryForeground};
mixer[kColorIconDisabled] = SetAlpha(kColorIcon, gfx::kDisabledControlAlpha);
mixer[kColorIconSecondary] = {gfx::kGoogleGrey600};
mixer[kColorLabelForeground] = {kColorPrimaryForeground};
mixer[kColorLabelForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorLabelForegroundSecondary] = {kColorSecondaryForeground};
mixer[kColorLabelSelectionBackground] = {kColorTextSelectionBackground};
mixer[kColorLabelSelectionForeground] = {kColorTextSelectionForeground};
mixer[kColorLinkForeground] = {kColorAccent};
mixer[kColorLinkForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorLinkForegroundPressed] = {kColorLinkForeground};
mixer[kColorMenuBackground] = {kColorPrimaryBackground};
mixer[kColorMenuBorder] = {kColorMidground};
mixer[kColorMenuDropmarker] = {kColorPrimaryForeground};
mixer[kColorMenuIcon] = {kColorIcon};
mixer[kColorMenuItemBackgroundAlertedInitial] = SetAlpha(kColorAccent, 0x4D);
mixer[kColorMenuItemBackgroundAlertedTarget] =
SetAlpha(kColorAccent, gfx::kGoogleGreyAlpha200);
mixer[kColorMenuItemBackgroundHighlighted] = {kColorSubtleEmphasisBackground};
mixer[kColorMenuItemBackgroundSelected] = {kColorMenuSelectionBackground};
mixer[kColorMenuItemForeground] = {kColorPrimaryForeground};
mixer[kColorMenuItemForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorMenuItemForegroundHighlighted] = {kColorMenuItemForeground};
mixer[kColorMenuItemForegroundSecondary] = {kColorSecondaryForeground};
mixer[kColorMenuItemForegroundSelected] = {kColorMenuItemForeground};
mixer[kColorMenuSeparator] = {kColorMidground};
mixer[kColorNotificationActionsBackground] = {
kColorNotificationBackgroundActive};
mixer[kColorNotificationBackgroundActive] = {kColorSubtleEmphasisBackground};
mixer[kColorNotificationBackgroundInactive] = {kColorPrimaryBackground};
mixer[kColorNotificationHeaderForeground] = {kColorSecondaryForeground};
mixer[kColorNotificationIconBackground] = {
kColorNotificationHeaderForeground};
mixer[kColorNotificationIconForeground] = {
kColorNotificationBackgroundInactive};
mixer[kColorNotificationImageBackground] = {
kColorNotificationBackgroundActive};
mixer[kColorNotificationInputBackground] = {kColorAccent};
mixer[kColorNotificationInputForeground] =
GetColorWithMaxContrast(kColorNotificationInputBackground);
mixer[kColorNotificationInputPlaceholderForeground] =
SetAlpha(kColorNotificationInputForeground, gfx::kGoogleGreyAlpha700);
mixer[kColorOverlayScrollbarFill] =
SetAlpha(kColorEndpointForeground, gfx::kGoogleGreyAlpha700);
mixer[kColorOverlayScrollbarFillHovered] =
SetAlpha(kColorEndpointForeground, gfx::kGoogleGreyAlpha800);
mixer[kColorOverlayScrollbarStroke] =
SetAlpha(kColorEndpointBackground, gfx::kGoogleGreyAlpha400);
mixer[kColorOverlayScrollbarStrokeHovered] =
SetAlpha(kColorEndpointBackground, gfx::kGoogleGreyAlpha500);
mixer[kColorPwaSecurityChipForeground] = {kColorSecondaryForeground};
mixer[kColorPwaSecurityChipForegroundDangerous] = {kColorAlertHighSeverity};
mixer[kColorPwaSecurityChipForegroundPolicyCert] = {kColorDisabledForeground};
mixer[kColorPwaSecurityChipForegroundSecure] = {
kColorPwaSecurityChipForeground};
mixer[kColorPwaToolbarBackground] = {kColorEndpointBackground};
mixer[kColorPwaToolbarForeground] = {kColorEndpointForeground};
mixer[kColorSeparator] = {kColorMidground};
mixer[kColorShadowBase] = {dark_window ? SK_ColorBLACK : gfx::kGoogleGrey800};
mixer[kColorShadowValueAmbientShadowElevationThree] =
SetAlpha(kColorShadowBase, 0x40);
mixer[kColorShadowValueKeyShadowElevationThree] =
SetAlpha(kColorShadowBase, 0x66);
mixer[kColorShadowValueAmbientShadowElevationSixteen] =
SetAlpha(kColorShadowBase, 0x3d);
mixer[kColorShadowValueKeyShadowElevationSixteen] =
SetAlpha(kColorShadowBase, 0x1a);
mixer[kColorSliderThumb] = {kColorAccent};
mixer[kColorSliderThumbMinimal] = {kColorSecondaryForeground};
mixer[kColorSliderTrack] = {kColorSubtleAccent};
mixer[kColorSliderTrackMinimal] = {kColorMidground};
mixer[kColorSyncInfoBackground] = {kColorSubtleEmphasisBackground};
mixer[kColorSyncInfoBackgroundError] =
SetAlpha(kColorAlertHighSeverity, gfx::kGoogleGreyAlpha100);
mixer[kColorSyncInfoBackgroundPaused] =
SetAlpha(kColorAccent, gfx::kGoogleGreyAlpha100);
mixer[kColorTabBackgroundHighlighted] = SetAlpha(gfx::kGoogleBlue300, 0x2B);
mixer[kColorTabBackgroundHighlightedFocused] =
SetAlpha(gfx::kGoogleBlue300, 0x53);
mixer[kColorTabBorderSelected] = {kColorAccent};
mixer[kColorTabContentSeparator] = {kColorMidground};
mixer[kColorTabForeground] = {kColorSecondaryForeground};
mixer[kColorTabForegroundSelected] = {kColorAccent};
mixer[kColorTableBackground] = {kColorPrimaryBackground};
mixer[kColorTableBackgroundAlternate] = {kColorTableBackground};
mixer[kColorTableBackgroundSelectedFocused] = {kColorItemSelectionBackground};
mixer[kColorTableBackgroundSelectedUnfocused] = {
kColorTableBackgroundSelectedFocused};
mixer[kColorTableForeground] = {kColorPrimaryForeground};
mixer[kColorTableForegroundSelectedFocused] = {kColorTableForeground};
mixer[kColorTableForegroundSelectedUnfocused] = {
kColorTableForegroundSelectedFocused};
mixer[kColorTableGroupingIndicator] = {kColorItemHighlight};
mixer[kColorTableHeaderBackground] = {kColorTableBackground};
mixer[kColorTableHeaderForeground] = {kColorTableForeground};
mixer[kColorTableHeaderSeparator] = {kColorMidground};
mixer[kColorTextfieldBackground] = {kColorEndpointBackground};
mixer[kColorTextfieldBackgroundDisabled] = {kColorPrimaryBackground};
mixer[kColorTextfieldForeground] = {kColorPrimaryForeground};
mixer[kColorTextfieldForegroundDisabled] = {kColorDisabledForeground};
mixer[kColorTextfieldForegroundPlaceholder] = {
kColorTextfieldForegroundDisabled};
mixer[kColorTextfieldSelectionBackground] = {kColorTextSelectionBackground};
mixer[kColorTextfieldSelectionForeground] = {kColorTextSelectionForeground};
mixer[kColorThrobber] = {kColorAccent};
mixer[kColorThrobberPreconnect] = {kColorSubtleAccent};
mixer[kColorToggleButtonShadow] = {kColorMidground};
mixer[kColorToggleButtonThumbOff] = {kColorSecondaryForeground};
mixer[kColorToggleButtonThumbOn] = {kColorAccent};
if (dark_window) {
mixer[kColorToggleButtonThumbOff] +=
AlphaBlend(kColorPrimaryForeground, FromTransformInput(), 0x0D);
mixer[kColorToggleButtonThumbOn] +=
AlphaBlend(kColorPrimaryForeground, FromTransformInput(), 0x0D);
}
mixer[kColorToggleButtonTrackOff] = {
dark_window ? ColorTransform(gfx::kGoogleGrey700) : kColorMidground};
mixer[kColorToggleButtonTrackOn] = {dark_window ? gfx::kGoogleBlue600
: gfx::kGoogleBlue300};
mixer[kColorTooltipBackground] = SetAlpha(kColorPrimaryBackground, 0xCC);
mixer[kColorTooltipForeground] = SetAlpha(kColorPrimaryForeground, 0xDE);
mixer[kColorTreeBackground] = {kColorPrimaryBackground};
mixer[kColorTreeNodeBackgroundSelectedFocused] = {
kColorItemSelectionBackground};
mixer[kColorTreeNodeBackgroundSelectedUnfocused] = {
kColorTreeNodeBackgroundSelectedFocused};
mixer[kColorTreeNodeForeground] = {kColorPrimaryForeground};
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
kColorTreeNodeForegroundSelectedFocused};
mixer[kColorWindowBackground] = {kColorPrimaryBackground};
}
} // namespace ui
|