Line data Source code
1 : /**
2 : Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
3 :
4 : Permission is hereby granted, free of charge, to any person obtaining a copy
5 : of this software and associated documentation files (the "Software"), to deal
6 : in the Software without restriction, including without limitation the rights
7 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 : copies of the Software, and to permit persons to whom the Software is
9 : furnished to do so, subject to the following conditions:
10 :
11 : The above copyright notice and this permission notice shall be included in
12 : all copies or substantial portions of the Software.
13 :
14 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 : THE SOFTWARE.
21 : **/
22 :
23 : #include "MaterialColorScheme.h"
24 :
25 : namespace STAPPLER_VERSIONIZED stappler::xenolith::material2d {
26 :
27 10 : CorePalette::CorePalette(const Color4F &color, bool isContentColor)
28 10 : : CorePalette(geom::Cam16::create(color), isContentColor) { }
29 :
30 10 : CorePalette::CorePalette(const geom::Cam16 &cam, bool isContentColor)
31 10 : : CorePalette(cam.hue, cam.chroma, isContentColor) { }
32 :
33 3020 : CorePalette::CorePalette(geom::Cam16Float hue, geom::Cam16Float chroma, bool is_content)
34 3020 : : primary(hue, is_content ? chroma : std::fmax(chroma, geom::Cam16Float(48)))
35 3020 : , secondary(hue, is_content ? chroma / 3 : 16)
36 3020 : , tertiary(hue + 60, is_content ? chroma / 2 : 24)
37 3020 : , neutral(hue, is_content ? std::fmin(chroma / geom::Cam16Float(12), geom::Cam16Float(4)) : 4)
38 3020 : , neutralVariant(hue, is_content ? std::fmin(chroma / geom::Cam16Float(6), geom::Cam16Float(8)) : 8)
39 3020 : , error(25, 84) { }
40 :
41 81894 : ColorRole ColorScheme::getColorRoleOn(ColorRole role, ThemeType type) {
42 81894 : switch (role) {
43 2492 : case ColorRole::Primary: return ColorRole::OnPrimary; break;
44 1490 : case ColorRole::OnPrimary: return ColorRole::Primary; break;
45 15026 : case ColorRole::PrimaryContainer: return ColorRole::OnPrimaryContainer; break;
46 1490 : case ColorRole::OnPrimaryContainer: return ColorRole::PrimaryContainer; break;
47 1490 : case ColorRole::Secondary: return ColorRole::OnSecondary; break;
48 1490 : case ColorRole::OnSecondary: return ColorRole::Secondary; break;
49 1720 : case ColorRole::SecondaryContainer: return ColorRole::OnSecondaryContainer; break;
50 1490 : case ColorRole::OnSecondaryContainer: return ColorRole::SecondaryContainer; break;
51 1490 : case ColorRole::Tertiary: return ColorRole::OnTertiary; break;
52 1490 : case ColorRole::OnTertiary: return ColorRole::Tertiary; break;
53 1490 : case ColorRole::TertiaryContainer: return ColorRole::OnTertiaryContainer; break;
54 1490 : case ColorRole::OnTertiaryContainer: return ColorRole::TertiaryContainer; break;
55 1490 : case ColorRole::Error: return ColorRole::OnError; break;
56 1490 : case ColorRole::OnError: return ColorRole::Error; break;
57 1490 : case ColorRole::ErrorContainer: return ColorRole::OnErrorContainer; break;
58 1490 : case ColorRole::OnErrorContainer: return ColorRole::ErrorContainer; break;
59 1490 : case ColorRole::Background: return ColorRole::OnBackground; break;
60 1490 : case ColorRole::OnBackground: return ColorRole::Background; break;
61 23006 : case ColorRole::Surface: return ColorRole::OnSurface; break;
62 1490 : case ColorRole::OnSurface: return ColorRole::Surface; break;
63 2230 : case ColorRole::SurfaceVariant: return ColorRole::OnSurfaceVariant; break;
64 1660 : case ColorRole::OnSurfaceVariant: return ColorRole::SurfaceVariant; break;
65 1490 : case ColorRole::Outline: return ColorRole::OnBackground; break;
66 1490 : case ColorRole::OutlineVariant: return ColorRole::OnBackground; break;
67 1490 : case ColorRole::Shadow: return (type == ThemeType::LightTheme) ? ColorRole::Background : ColorRole::OnBackground; break;
68 1490 : case ColorRole::Scrim: return (type == ThemeType::LightTheme) ? ColorRole::Background : ColorRole::OnBackground; break;
69 1490 : case ColorRole::InverseSurface: return ColorRole::InverseOnSurface; break;
70 1490 : case ColorRole::InverseOnSurface: return ColorRole::InverseSurface; break;
71 1490 : case ColorRole::InversePrimary: return ColorRole::OnBackground; break;
72 1490 : case ColorRole::Undefined: break;
73 0 : case ColorRole::Max: break;
74 : }
75 1490 : return role;
76 : }
77 :
78 1510 : ColorScheme::ColorScheme(ThemeType t, const CorePalette &p) : type(t), palette(p) {
79 1510 : set(type, palette);
80 1510 : }
81 :
82 0 : ColorScheme::ColorScheme(ThemeType t, const Color4F &color, bool isContent)
83 0 : : ColorScheme(t, CorePalette(color, isContent)) { }
84 :
85 1510 : ColorScheme::ColorScheme(ThemeType t, const ColorHCT &color, bool isContent)
86 1510 : : ColorScheme(t, CorePalette(color.data.hue, color.data.chroma, isContent)) { }
87 :
88 3020 : void ColorScheme::set(ThemeType t, const CorePalette &p) {
89 3020 : type = t;
90 3020 : switch (type) {
91 3020 : case ThemeType::LightTheme:
92 : case ThemeType::Custom:
93 3020 : colors[toInt(ColorRole::Primary)] = Color4F(p.primary.get(40));
94 3020 : colors[toInt(ColorRole::OnPrimary)] = Color4F(p.primary.get(100));
95 3020 : colors[toInt(ColorRole::PrimaryContainer)] = Color4F(p.primary.get(90));
96 3020 : colors[toInt(ColorRole::OnPrimaryContainer)] = Color4F(p.primary.get(10));
97 3020 : colors[toInt(ColorRole::Secondary)] = Color4F(p.secondary.get(40));
98 3020 : colors[toInt(ColorRole::OnSecondary)] = Color4F(p.secondary.get(100));
99 3020 : colors[toInt(ColorRole::SecondaryContainer)] = Color4F(p.secondary.get(90));
100 3020 : colors[toInt(ColorRole::OnSecondaryContainer)] = Color4F(p.secondary.get(10));
101 3020 : colors[toInt(ColorRole::Tertiary)] = Color4F(p.tertiary.get(40));
102 3020 : colors[toInt(ColorRole::OnTertiary)] = Color4F(p.tertiary.get(100));
103 3020 : colors[toInt(ColorRole::TertiaryContainer)] = Color4F(p.tertiary.get(90));
104 3020 : colors[toInt(ColorRole::OnTertiaryContainer)] = Color4F(p.tertiary.get(10));
105 3020 : colors[toInt(ColorRole::Error)] = Color4F(p.error.get(40));
106 3020 : colors[toInt(ColorRole::OnError)] = Color4F(p.error.get(100));
107 3020 : colors[toInt(ColorRole::ErrorContainer)] = Color4F(p.error.get(90));
108 3020 : colors[toInt(ColorRole::OnErrorContainer)] = Color4F(p.error.get(10));
109 3020 : colors[toInt(ColorRole::Background)] = Color4F(p.neutral.get(99));
110 3020 : colors[toInt(ColorRole::OnBackground)] = Color4F(p.neutral.get(10));
111 3020 : colors[toInt(ColorRole::Surface)] = Color4F(p.neutral.get(99));
112 3020 : colors[toInt(ColorRole::OnSurface)] = Color4F(p.neutral.get(10));
113 3020 : colors[toInt(ColorRole::SurfaceVariant)] = Color4F(p.neutralVariant.get(90));
114 3020 : colors[toInt(ColorRole::OnSurfaceVariant)] = Color4F(p.neutralVariant.get(30));
115 3020 : colors[toInt(ColorRole::Outline)] = Color4F(p.neutralVariant.get(50));
116 3020 : colors[toInt(ColorRole::OutlineVariant)] = Color4F(p.neutralVariant.get(80));
117 3020 : colors[toInt(ColorRole::Shadow)] = Color4F(p.neutral.get(0));
118 3020 : colors[toInt(ColorRole::Scrim)] = Color4F(p.neutral.get(0));
119 3020 : colors[toInt(ColorRole::InverseSurface)] = Color4F(p.neutral.get(20));
120 3020 : colors[toInt(ColorRole::InverseOnSurface)] = Color4F(p.neutral.get(95));
121 3020 : colors[toInt(ColorRole::InversePrimary)] = Color4F(p.primary.get(80));
122 3020 : break;
123 0 : case ThemeType::DarkTheme:
124 0 : colors[toInt(ColorRole::Primary)] = Color4F(p.primary.get(80));
125 0 : colors[toInt(ColorRole::OnPrimary)] = Color4F(p.primary.get(20));
126 0 : colors[toInt(ColorRole::PrimaryContainer)] = Color4F(p.primary.get(30));
127 0 : colors[toInt(ColorRole::OnPrimaryContainer)] = Color4F(p.primary.get(90));
128 0 : colors[toInt(ColorRole::Secondary)] = Color4F(p.secondary.get(80));
129 0 : colors[toInt(ColorRole::OnSecondary)] = Color4F(p.secondary.get(20));
130 0 : colors[toInt(ColorRole::SecondaryContainer)] = Color4F(p.secondary.get(30));
131 0 : colors[toInt(ColorRole::OnSecondaryContainer)] = Color4F(p.secondary.get(90));
132 0 : colors[toInt(ColorRole::Tertiary)] = Color4F(p.tertiary.get(80));
133 0 : colors[toInt(ColorRole::OnTertiary)] = Color4F(p.tertiary.get(20));
134 0 : colors[toInt(ColorRole::TertiaryContainer)] = Color4F(p.tertiary.get(30));
135 0 : colors[toInt(ColorRole::OnTertiaryContainer)] = Color4F(p.tertiary.get(90));
136 0 : colors[toInt(ColorRole::Error)] = Color4F(p.error.get(80));
137 0 : colors[toInt(ColorRole::OnError)] = Color4F(p.error.get(20));
138 0 : colors[toInt(ColorRole::ErrorContainer)] = Color4F(p.error.get(30));
139 0 : colors[toInt(ColorRole::OnErrorContainer)] = Color4F(p.error.get(80));
140 0 : colors[toInt(ColorRole::Background)] = Color4F(p.neutral.get(10));
141 0 : colors[toInt(ColorRole::OnBackground)] = Color4F(p.neutral.get(90));
142 0 : colors[toInt(ColorRole::Surface)] = Color4F(p.neutral.get(10));
143 0 : colors[toInt(ColorRole::OnSurface)] = Color4F(p.neutral.get(90));
144 0 : colors[toInt(ColorRole::SurfaceVariant)] = Color4F(p.neutralVariant.get(30));
145 0 : colors[toInt(ColorRole::OnSurfaceVariant)] = Color4F(p.neutralVariant.get(80));
146 0 : colors[toInt(ColorRole::Outline)] = Color4F(p.neutralVariant.get(60));
147 0 : colors[toInt(ColorRole::OutlineVariant)] = Color4F(p.neutralVariant.get(30));
148 0 : colors[toInt(ColorRole::Shadow)] = Color4F(p.neutral.get(0));
149 0 : colors[toInt(ColorRole::Scrim)] = Color4F(p.neutral.get(0));
150 0 : colors[toInt(ColorRole::InverseSurface)] = Color4F(p.neutral.get(90));
151 0 : colors[toInt(ColorRole::InverseOnSurface)] = Color4F(p.neutral.get(20));
152 0 : colors[toInt(ColorRole::InversePrimary)] = Color4F(p.primary.get(40));
153 0 : break;
154 : }
155 :
156 3020 : this->palette = p;
157 3020 : }
158 :
159 10 : void ColorScheme::set(ThemeType t, const Color4F &color, bool isContent) {
160 10 : set(t, CorePalette(color, isContent));
161 10 : }
162 :
163 1500 : void ColorScheme::set(ThemeType t, const ColorHCT &color, bool isContent) {
164 1500 : set(t, CorePalette(color.data.hue, color.data.chroma, isContent));
165 1500 : }
166 :
167 0 : ColorHCT ColorScheme::hct(ColorRole name, float alpha) const {
168 0 : switch (type) {
169 0 : case ThemeType::LightTheme:
170 0 : switch (name) {
171 0 : case ColorRole::Primary: return palette.primary.hct(40, alpha); break;
172 0 : case ColorRole::OnPrimary: return palette.primary.hct(100, alpha); break;
173 0 : case ColorRole::PrimaryContainer: return palette.primary.hct(90, alpha); break;
174 0 : case ColorRole::OnPrimaryContainer: return palette.primary.hct(10, alpha); break;
175 0 : case ColorRole::Secondary: return palette.secondary.hct(40, alpha); break;
176 0 : case ColorRole::OnSecondary: return palette.secondary.hct(100, alpha); break;
177 0 : case ColorRole::SecondaryContainer: return palette.secondary.hct(90, alpha); break;
178 0 : case ColorRole::OnSecondaryContainer: return palette.secondary.hct(10, alpha); break;
179 0 : case ColorRole::Tertiary: return palette.tertiary.hct(40, alpha); break;
180 0 : case ColorRole::OnTertiary: return palette.tertiary.hct(100, alpha); break;
181 0 : case ColorRole::TertiaryContainer: return palette.tertiary.hct(90, alpha); break;
182 0 : case ColorRole::OnTertiaryContainer: return palette.tertiary.hct(10, alpha); break;
183 0 : case ColorRole::Error: return palette.error.hct(40, alpha); break;
184 0 : case ColorRole::OnError: return palette.error.hct(100, alpha); break;
185 0 : case ColorRole::ErrorContainer: return palette.error.hct(90, alpha); break;
186 0 : case ColorRole::OnErrorContainer: return palette.error.hct(10, alpha); break;
187 0 : case ColorRole::Background: return palette.neutral.hct(99, alpha); break;
188 0 : case ColorRole::OnBackground: return palette.neutral.hct(10, alpha); break;
189 0 : case ColorRole::Surface: return palette.neutral.hct(99, alpha); break;
190 0 : case ColorRole::OnSurface: return palette.neutral.hct(10, alpha); break;
191 0 : case ColorRole::SurfaceVariant: return palette.neutralVariant.hct(90, alpha); break;
192 0 : case ColorRole::OnSurfaceVariant: return palette.neutralVariant.hct(30, alpha); break;
193 0 : case ColorRole::Outline: return palette.neutralVariant.hct(50, alpha); break;
194 0 : case ColorRole::OutlineVariant: return palette.neutralVariant.hct(80, alpha); break;
195 0 : case ColorRole::Shadow: return palette.neutral.hct(0, alpha); break;
196 0 : case ColorRole::Scrim: return palette.neutral.hct(0, alpha); break;
197 0 : case ColorRole::InverseSurface: return palette.neutral.hct(20, alpha); break;
198 0 : case ColorRole::InverseOnSurface: return palette.neutral.hct(95, alpha); break;
199 0 : case ColorRole::InversePrimary: return palette.primary.hct(80, alpha); break;
200 0 : case ColorRole::Undefined: break;
201 0 : case ColorRole::Max: break;
202 : }
203 0 : break;
204 0 : case ThemeType::DarkTheme:
205 0 : switch (name) {
206 0 : case ColorRole::Primary: return palette.primary.hct(80, alpha); break;
207 0 : case ColorRole::OnPrimary: return palette.primary.hct(20, alpha); break;
208 0 : case ColorRole::PrimaryContainer: return palette.primary.hct(30, alpha); break;
209 0 : case ColorRole::OnPrimaryContainer: return palette.primary.hct(90, alpha); break;
210 0 : case ColorRole::Secondary: return palette.secondary.hct(80, alpha); break;
211 0 : case ColorRole::OnSecondary: return palette.secondary.hct(20, alpha); break;
212 0 : case ColorRole::SecondaryContainer: return palette.secondary.hct(30, alpha); break;
213 0 : case ColorRole::OnSecondaryContainer: return palette.secondary.hct(90, alpha); break;
214 0 : case ColorRole::Tertiary: return palette.tertiary.hct(80, alpha); break;
215 0 : case ColorRole::OnTertiary: return palette.tertiary.hct(20, alpha); break;
216 0 : case ColorRole::TertiaryContainer: return palette.tertiary.hct(30, alpha); break;
217 0 : case ColorRole::OnTertiaryContainer: return palette.tertiary.hct(90, alpha); break;
218 0 : case ColorRole::Error: return palette.error.hct(80, alpha); break;
219 0 : case ColorRole::OnError: return palette.error.hct(20, alpha); break;
220 0 : case ColorRole::ErrorContainer: return palette.error.hct(30, alpha); break;
221 0 : case ColorRole::OnErrorContainer: return palette.error.hct(80, alpha); break;
222 0 : case ColorRole::Background: return palette.neutral.hct(10, alpha); break;
223 0 : case ColorRole::OnBackground: return palette.neutral.hct(90, alpha); break;
224 0 : case ColorRole::Surface: return palette.neutral.hct(10, alpha); break;
225 0 : case ColorRole::OnSurface: return palette.neutral.hct(90, alpha); break;
226 0 : case ColorRole::SurfaceVariant: return palette.neutralVariant.hct(30, alpha); break;
227 0 : case ColorRole::OnSurfaceVariant: return palette.neutralVariant.hct(80, alpha); break;
228 0 : case ColorRole::Outline: return palette.neutralVariant.hct(60, alpha); break;
229 0 : case ColorRole::OutlineVariant: return palette.neutralVariant.hct(30, alpha); break;
230 0 : case ColorRole::Shadow: return palette.neutral.hct(0, alpha); break;
231 0 : case ColorRole::Scrim: return palette.neutral.hct(0, alpha); break;
232 0 : case ColorRole::InverseSurface: return palette.neutral.hct(90, alpha); break;
233 0 : case ColorRole::InverseOnSurface: return palette.neutral.hct(20, alpha); break;
234 0 : case ColorRole::InversePrimary: return palette.primary.hct(40, alpha); break;
235 0 : case ColorRole::Undefined: break;
236 0 : case ColorRole::Max: break;
237 : }
238 0 : break;
239 0 : case ThemeType::Custom:
240 0 : return ColorHCT(colors[toInt(name)], alpha);
241 : break;
242 : }
243 0 : return ColorHCT();
244 : }
245 :
246 117822 : ColorHCT::Values ColorScheme::values(ColorRole name, float alpha) const {
247 117822 : switch (type) {
248 117822 : case ThemeType::LightTheme:
249 117822 : switch (name) {
250 17134 : case ColorRole::Primary: return palette.primary.values(40, alpha); break;
251 1002 : case ColorRole::OnPrimary: return palette.primary.values(100, alpha); break;
252 27072 : case ColorRole::PrimaryContainer: return palette.primary.values(90, alpha); break;
253 13536 : case ColorRole::OnPrimaryContainer: return palette.primary.values(10, alpha); break;
254 626 : case ColorRole::Secondary: return palette.secondary.values(40, alpha); break;
255 0 : case ColorRole::OnSecondary: return palette.secondary.values(100, alpha); break;
256 460 : case ColorRole::SecondaryContainer: return palette.secondary.values(90, alpha); break;
257 230 : case ColorRole::OnSecondaryContainer: return palette.secondary.values(10, alpha); break;
258 0 : case ColorRole::Tertiary: return palette.tertiary.values(40, alpha); break;
259 0 : case ColorRole::OnTertiary: return palette.tertiary.values(100, alpha); break;
260 0 : case ColorRole::TertiaryContainer: return palette.tertiary.values(90, alpha); break;
261 0 : case ColorRole::OnTertiaryContainer: return palette.tertiary.values(10, alpha); break;
262 0 : case ColorRole::Error: return palette.error.values(40, alpha); break;
263 0 : case ColorRole::OnError: return palette.error.values(100, alpha); break;
264 0 : case ColorRole::ErrorContainer: return palette.error.values(90, alpha); break;
265 0 : case ColorRole::OnErrorContainer: return palette.error.values(10, alpha); break;
266 8704 : case ColorRole::Background: return palette.neutral.values(99, alpha); break;
267 0 : case ColorRole::OnBackground: return palette.neutral.values(10, alpha); break;
268 24590 : case ColorRole::Surface: return palette.neutral.values(99, alpha); break;
269 21698 : case ColorRole::OnSurface: return palette.neutral.values(10, alpha); break;
270 1650 : case ColorRole::SurfaceVariant: return palette.neutralVariant.values(90, alpha); break;
271 1080 : case ColorRole::OnSurfaceVariant: return palette.neutralVariant.values(30, alpha); break;
272 40 : case ColorRole::Outline: return palette.neutralVariant.values(50, alpha); break;
273 0 : case ColorRole::OutlineVariant: return palette.neutralVariant.values(80, alpha); break;
274 0 : case ColorRole::Shadow: return palette.neutral.values(0, alpha); break;
275 0 : case ColorRole::Scrim: return palette.neutral.values(0, alpha); break;
276 0 : case ColorRole::InverseSurface: return palette.neutral.values(20, alpha); break;
277 0 : case ColorRole::InverseOnSurface: return palette.neutral.values(95, alpha); break;
278 0 : case ColorRole::InversePrimary: return palette.primary.values(80, alpha); break;
279 0 : case ColorRole::Undefined: break;
280 0 : case ColorRole::Max: break;
281 : }
282 0 : break;
283 0 : case ThemeType::DarkTheme:
284 0 : switch (name) {
285 0 : case ColorRole::Primary: return palette.primary.values(80, alpha); break;
286 0 : case ColorRole::OnPrimary: return palette.primary.values(20, alpha); break;
287 0 : case ColorRole::PrimaryContainer: return palette.primary.values(30, alpha); break;
288 0 : case ColorRole::OnPrimaryContainer: return palette.primary.values(90, alpha); break;
289 0 : case ColorRole::Secondary: return palette.secondary.values(80, alpha); break;
290 0 : case ColorRole::OnSecondary: return palette.secondary.values(20, alpha); break;
291 0 : case ColorRole::SecondaryContainer: return palette.secondary.values(30, alpha); break;
292 0 : case ColorRole::OnSecondaryContainer: return palette.secondary.values(90, alpha); break;
293 0 : case ColorRole::Tertiary: return palette.tertiary.values(80, alpha); break;
294 0 : case ColorRole::OnTertiary: return palette.tertiary.values(20, alpha); break;
295 0 : case ColorRole::TertiaryContainer: return palette.tertiary.values(30, alpha); break;
296 0 : case ColorRole::OnTertiaryContainer: return palette.tertiary.values(90, alpha); break;
297 0 : case ColorRole::Error: return palette.error.values(80, alpha); break;
298 0 : case ColorRole::OnError: return palette.error.values(20, alpha); break;
299 0 : case ColorRole::ErrorContainer: return palette.error.values(30, alpha); break;
300 0 : case ColorRole::OnErrorContainer: return palette.error.values(80, alpha); break;
301 0 : case ColorRole::Background: return palette.neutral.values(10, alpha); break;
302 0 : case ColorRole::OnBackground: return palette.neutral.values(90, alpha); break;
303 0 : case ColorRole::Surface: return palette.neutral.values(10, alpha); break;
304 0 : case ColorRole::OnSurface: return palette.neutral.values(90, alpha); break;
305 0 : case ColorRole::SurfaceVariant: return palette.neutralVariant.values(30, alpha); break;
306 0 : case ColorRole::OnSurfaceVariant: return palette.neutralVariant.values(80, alpha); break;
307 0 : case ColorRole::Outline: return palette.neutralVariant.values(60, alpha); break;
308 0 : case ColorRole::OutlineVariant: return palette.neutralVariant.values(30, alpha); break;
309 0 : case ColorRole::Shadow: return palette.neutral.values(0, alpha); break;
310 0 : case ColorRole::Scrim: return palette.neutral.values(0, alpha); break;
311 0 : case ColorRole::InverseSurface: return palette.neutral.values(90, alpha); break;
312 0 : case ColorRole::InverseOnSurface: return palette.neutral.values(20, alpha); break;
313 0 : case ColorRole::InversePrimary: return palette.primary.values(40, alpha); break;
314 0 : case ColorRole::Undefined: break;
315 0 : case ColorRole::Max: break;
316 : }
317 0 : break;
318 0 : case ThemeType::Custom:
319 0 : return ColorHCT(colors[toInt(name)], alpha).data;
320 : break;
321 : }
322 0 : return ColorHCT::Values{0.0f, 50.0f, 0.0f, alpha};
323 : }
324 :
325 : }
|