@gradient-ui/gradient-engine 0.6.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +0 -6
  2. package/dist/animation.cjs +13 -13
  3. package/dist/animation.mjs +36 -36
  4. package/dist/core.cjs +1 -1
  5. package/dist/core.mjs +17 -17
  6. package/dist/css-B3xGfmW1.js +17 -0
  7. package/dist/css-CREh0Awz.cjs +1 -0
  8. package/dist/design-tokens.cjs +1 -1
  9. package/dist/design-tokens.mjs +5 -5
  10. package/dist/designTokens-Bw-HZ1f1.js +116 -0
  11. package/dist/designTokens-DsIk5RSi.cjs +1 -0
  12. package/dist/effects.cjs +67 -67
  13. package/dist/effects.mjs +153 -153
  14. package/dist/formatters.cjs +1 -1
  15. package/dist/formatters.mjs +33 -33
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.mjs +63 -63
  18. package/dist/material.cjs +8 -8
  19. package/dist/material.mjs +170 -170
  20. package/dist/presets-DA-6KYJh.cjs +316 -0
  21. package/dist/presets-Du6aTLtD.js +4025 -0
  22. package/dist/svg-B2CaHCLv.js +118 -0
  23. package/dist/svg-BtMrj3fP.cjs +32 -0
  24. package/dist/types/animation/css.d.ts +2 -2
  25. package/dist/types/animation/index.d.ts +1 -1
  26. package/dist/types/colorSystem.d.ts +3 -3
  27. package/dist/types/core.d.ts +7 -7
  28. package/dist/types/designTokens.d.ts +4 -4
  29. package/dist/types/effects/index.d.ts +2 -2
  30. package/dist/types/effects/morph.d.ts +1 -1
  31. package/dist/types/effects/shadow.d.ts +1 -1
  32. package/dist/types/formatters/canvas.d.ts +1 -1
  33. package/dist/types/formatters/css.d.ts +1 -1
  34. package/dist/types/formatters/index.d.ts +3 -3
  35. package/dist/types/formatters/svg.d.ts +1 -1
  36. package/dist/types/index.d.ts +11 -11
  37. package/dist/types/material.d.ts +1 -1
  38. package/dist/types/model.d.ts +3 -3
  39. package/dist/types/palette.d.ts +1 -1
  40. package/dist/types/presets.d.ts +1 -1
  41. package/dist/types/recipes.d.ts +12 -12
  42. package/dist/types/tokens.d.ts +3 -3
  43. package/dist/types/types.d.ts +1 -1
  44. package/dist/types/utils.d.ts +1 -1
  45. package/dist/{types-BFr1fN-7.js → types-B0eCazk8.js} +4 -4
  46. package/dist/types-BFkUlDkW.cjs +1 -0
  47. package/dist/types-cjs/animation/css.d.cts +12 -0
  48. package/dist/types-cjs/animation/index.d.cts +1 -0
  49. package/dist/types-cjs/color.d.cts +11 -0
  50. package/dist/types-cjs/colorMath.d.cts +3 -0
  51. package/dist/types-cjs/colorSeeds.d.cts +22 -0
  52. package/dist/types-cjs/colorSystem.d.cts +20 -0
  53. package/dist/types-cjs/constants.d.cts +3 -0
  54. package/dist/types-cjs/core.d.cts +9 -0
  55. package/dist/types-cjs/designTokens.d.cts +24 -0
  56. package/dist/types-cjs/effects/index.d.cts +2 -0
  57. package/dist/types-cjs/effects/morph.d.cts +8 -0
  58. package/dist/types-cjs/effects/shadow.d.cts +3 -0
  59. package/dist/types-cjs/formatters/canvas.d.cts +2 -0
  60. package/dist/types-cjs/formatters/css.d.cts +3 -0
  61. package/dist/types-cjs/formatters/index.d.cts +3 -0
  62. package/dist/types-cjs/formatters/svg.d.cts +5 -0
  63. package/dist/types-cjs/index.d.cts +11 -0
  64. package/dist/types-cjs/material.d.cts +1 -0
  65. package/dist/types-cjs/model.d.cts +5 -0
  66. package/dist/types-cjs/package.json +3 -0
  67. package/dist/types-cjs/palette.d.cts +13 -0
  68. package/dist/types-cjs/presets.d.cts +239 -0
  69. package/dist/types-cjs/recipes.d.cts +14 -0
  70. package/dist/types-cjs/scheme.d.cts +3 -0
  71. package/dist/types-cjs/tokens.d.cts +107 -0
  72. package/dist/types-cjs/types.d.cts +127 -0
  73. package/dist/types-cjs/utils.d.cts +10 -0
  74. package/dist/utils-Bry9BTmj.cjs +1 -0
  75. package/dist/utils-VaqPefmS.js +76 -0
  76. package/package.json +59 -23
  77. package/dist/css-BVHXLMRl.cjs +0 -1
  78. package/dist/css-DVaTTIqS.js +0 -17
  79. package/dist/designTokens-BnzZfRES.js +0 -116
  80. package/dist/designTokens-C1WdzS3v.cjs +0 -1
  81. package/dist/presets-BBLdqUE4.cjs +0 -316
  82. package/dist/presets-DYXLx_nN.js +0 -4025
  83. package/dist/svg-dGtLYnIJ.cjs +0 -32
  84. package/dist/svg-hZus3ztj.js +0 -118
  85. package/dist/types-BMLEvdee.cjs +0 -1
  86. package/dist/utils-BzSNCfat.js +0 -76
  87. package/dist/utils-D83DMCMa.cjs +0 -1
@@ -1,4025 +0,0 @@
1
- import { c as Ke, i as F, d as je, e as qe, D as Xe } from "./utils-BzSNCfat.js";
2
- /**
3
- * @license
4
- * Copyright 2021 Google LLC
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- function K(t) {
19
- return t < 0 ? -1 : t === 0 ? 0 : 1;
20
- }
21
- function se(t, e, r) {
22
- return (1 - r) * t + r * e;
23
- }
24
- function $e(t, e, r) {
25
- return r < t ? t : r > e ? e : r;
26
- }
27
- function H(t, e, r) {
28
- return r < t ? t : r > e ? e : r;
29
- }
30
- function de(t) {
31
- return t = t % 360, t < 0 && (t = t + 360), t;
32
- }
33
- function Je(t, e) {
34
- return de(e - t) <= 180 ? 1 : -1;
35
- }
36
- function We(t, e) {
37
- return 180 - Math.abs(Math.abs(t - e) - 180);
38
- }
39
- function Se(t, e) {
40
- const r = t[0] * e[0][0] + t[1] * e[0][1] + t[2] * e[0][2], n = t[0] * e[1][0] + t[1] * e[1][1] + t[2] * e[1][2], a = t[0] * e[2][0] + t[1] * e[2][1] + t[2] * e[2][2];
41
- return [r, n, a];
42
- }
43
- /**
44
- * @license
45
- * Copyright 2021 Google LLC
46
- *
47
- * Licensed under the Apache License, Version 2.0 (the "License");
48
- * you may not use this file except in compliance with the License.
49
- * You may obtain a copy of the License at
50
- *
51
- * http://www.apache.org/licenses/LICENSE-2.0
52
- *
53
- * Unless required by applicable law or agreed to in writing, software
54
- * distributed under the License is distributed on an "AS IS" BASIS,
55
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
- * See the License for the specific language governing permissions and
57
- * limitations under the License.
58
- */
59
- const Ze = [
60
- [0.41233895, 0.35762064, 0.18051042],
61
- [0.2126, 0.7152, 0.0722],
62
- [0.01932141, 0.11916382, 0.95034478]
63
- ], Qe = [
64
- [
65
- 3.2413774792388685,
66
- -1.5376652402851851,
67
- -0.49885366846268053
68
- ],
69
- [
70
- -0.9691452513005321,
71
- 1.8758853451067872,
72
- 0.04156585616912061
73
- ],
74
- [
75
- 0.05562093689691305,
76
- -0.20395524564742123,
77
- 1.0571799111220335
78
- ]
79
- ], er = [95.047, 100, 108.883];
80
- function Te(t, e, r) {
81
- return (255 << 24 | (t & 255) << 16 | (e & 255) << 8 | r & 255) >>> 0;
82
- }
83
- function Be(t) {
84
- const e = ne(t[0]), r = ne(t[1]), n = ne(t[2]);
85
- return Te(e, r, n);
86
- }
87
- function Ie(t) {
88
- return t >> 16 & 255;
89
- }
90
- function Ee(t) {
91
- return t >> 8 & 255;
92
- }
93
- function Le(t) {
94
- return t & 255;
95
- }
96
- function rr(t, e, r) {
97
- const n = Qe, a = n[0][0] * t + n[0][1] * e + n[0][2] * r, s = n[1][0] * t + n[1][1] * e + n[1][2] * r, i = n[2][0] * t + n[2][1] * e + n[2][2] * r, u = ne(a), l = ne(s), f = ne(i);
98
- return Te(u, l, f);
99
- }
100
- function tr(t) {
101
- const e = ie(Ie(t)), r = ie(Ee(t)), n = ie(Le(t));
102
- return Se([e, r, n], Ze);
103
- }
104
- function nr(t) {
105
- const e = te(t), r = ne(e);
106
- return Te(r, r, r);
107
- }
108
- function Ce(t) {
109
- const e = tr(t)[1];
110
- return 116 * Oe(e / 100) - 16;
111
- }
112
- function te(t) {
113
- return 100 * or((t + 16) / 116);
114
- }
115
- function be(t) {
116
- return Oe(t / 100) * 116 - 16;
117
- }
118
- function ie(t) {
119
- const e = t / 255;
120
- return e <= 0.040449936 ? e / 12.92 * 100 : Math.pow((e + 0.055) / 1.055, 2.4) * 100;
121
- }
122
- function ne(t) {
123
- const e = t / 100;
124
- let r = 0;
125
- return e <= 31308e-7 ? r = e * 12.92 : r = 1.055 * Math.pow(e, 1 / 2.4) - 0.055, $e(0, 255, Math.round(r * 255));
126
- }
127
- function ar() {
128
- return er;
129
- }
130
- function Oe(t) {
131
- const e = 0.008856451679035631, r = 24389 / 27;
132
- return t > e ? Math.pow(t, 1 / 3) : (r * t + 16) / 116;
133
- }
134
- function or(t) {
135
- const e = 0.008856451679035631, r = 24389 / 27, n = t * t * t;
136
- return n > e ? n : (116 * t - 16) / r;
137
- }
138
- /**
139
- * @license
140
- * Copyright 2021 Google LLC
141
- *
142
- * Licensed under the Apache License, Version 2.0 (the "License");
143
- * you may not use this file except in compliance with the License.
144
- * You may obtain a copy of the License at
145
- *
146
- * http://www.apache.org/licenses/LICENSE-2.0
147
- *
148
- * Unless required by applicable law or agreed to in writing, software
149
- * distributed under the License is distributed on an "AS IS" BASIS,
150
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
- * See the License for the specific language governing permissions and
152
- * limitations under the License.
153
- */
154
- class q {
155
- /**
156
- * Create ViewingConditions from a simple, physically relevant, set of
157
- * parameters.
158
- *
159
- * @param whitePoint White point, measured in the XYZ color space.
160
- * default = D65, or sunny day afternoon
161
- * @param adaptingLuminance The luminance of the adapting field. Informally,
162
- * how bright it is in the room where the color is viewed. Can be
163
- * calculated from lux by multiplying lux by 0.0586. default = 11.72,
164
- * or 200 lux.
165
- * @param backgroundLstar The lightness of the area surrounding the color.
166
- * measured by L* in L*a*b*. default = 50.0
167
- * @param surround A general description of the lighting surrounding the
168
- * color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a
169
- * dimly light room, like watching TV at home at night. 2.0 means there
170
- * is no difference between the lighting on the color and around it.
171
- * default = 2.0
172
- * @param discountingIlluminant Whether the eye accounts for the tint of the
173
- * ambient lighting, such as knowing an apple is still red in green light.
174
- * default = false, the eye does not perform this process on
175
- * self-luminous objects like displays.
176
- */
177
- static make(e = ar(), r = 200 / Math.PI * te(50) / 100, n = 50, a = 2, s = !1) {
178
- const i = e, u = i[0] * 0.401288 + i[1] * 0.650173 + i[2] * -0.051461, l = i[0] * -0.250268 + i[1] * 1.204414 + i[2] * 0.045854, f = i[0] * -2079e-6 + i[1] * 0.048952 + i[2] * 0.953127, d = 0.8 + a / 10, S = d >= 0.9 ? se(0.59, 0.69, (d - 0.9) * 10) : se(0.525, 0.59, (d - 0.8) * 10);
179
- let p = s ? 1 : d * (1 - 1 / 3.6 * Math.exp((-r - 42) / 92));
180
- p = p > 1 ? 1 : p < 0 ? 0 : p;
181
- const D = d, m = [
182
- p * (100 / u) + 1 - p,
183
- p * (100 / l) + 1 - p,
184
- p * (100 / f) + 1 - p
185
- ], g = 1 / (5 * r + 1), P = g * g * g * g, M = 1 - P, B = P * r + 0.1 * M * M * Math.cbrt(5 * r), R = te(n) / e[1], V = 1.48 + Math.sqrt(R), N = 0.725 / Math.pow(R, 0.2), E = N, v = [
186
- Math.pow(B * m[0] * u / 100, 0.42),
187
- Math.pow(B * m[1] * l / 100, 0.42),
188
- Math.pow(B * m[2] * f / 100, 0.42)
189
- ], O = [
190
- 400 * v[0] / (v[0] + 27.13),
191
- 400 * v[1] / (v[1] + 27.13),
192
- 400 * v[2] / (v[2] + 27.13)
193
- ], U = (2 * O[0] + O[1] + 0.05 * O[2]) * N;
194
- return new q(R, U, N, E, S, D, m, B, Math.pow(B, 0.25), V);
195
- }
196
- /**
197
- * Parameters are intermediate values of the CAM16 conversion process. Their
198
- * names are shorthand for technical color science terminology, this class
199
- * would not benefit from documenting them individually. A brief overview
200
- * is available in the CAM16 specification, and a complete overview requires
201
- * a color science textbook, such as Fairchild's Color Appearance Models.
202
- */
203
- constructor(e, r, n, a, s, i, u, l, f, d) {
204
- this.n = e, this.aw = r, this.nbb = n, this.ncb = a, this.c = s, this.nc = i, this.rgbD = u, this.fl = l, this.fLRoot = f, this.z = d;
205
- }
206
- }
207
- q.DEFAULT = q.make();
208
- /**
209
- * @license
210
- * Copyright 2021 Google LLC
211
- *
212
- * Licensed under the Apache License, Version 2.0 (the "License");
213
- * you may not use this file except in compliance with the License.
214
- * You may obtain a copy of the License at
215
- *
216
- * http://www.apache.org/licenses/LICENSE-2.0
217
- *
218
- * Unless required by applicable law or agreed to in writing, software
219
- * distributed under the License is distributed on an "AS IS" BASIS,
220
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
221
- * See the License for the specific language governing permissions and
222
- * limitations under the License.
223
- */
224
- class _ {
225
- /**
226
- * All of the CAM16 dimensions can be calculated from 3 of the dimensions, in
227
- * the following combinations:
228
- * - {j or q} and {c, m, or s} and hue
229
- * - jstar, astar, bstar
230
- * Prefer using a static method that constructs from 3 of those dimensions.
231
- * This constructor is intended for those methods to use to return all
232
- * possible dimensions.
233
- *
234
- * @param hue
235
- * @param chroma informally, colorfulness / color intensity. like saturation
236
- * in HSL, except perceptually accurate.
237
- * @param j lightness
238
- * @param q brightness; ratio of lightness to white point's lightness
239
- * @param m colorfulness
240
- * @param s saturation; ratio of chroma to white point's chroma
241
- * @param jstar CAM16-UCS J coordinate
242
- * @param astar CAM16-UCS a coordinate
243
- * @param bstar CAM16-UCS b coordinate
244
- */
245
- constructor(e, r, n, a, s, i, u, l, f) {
246
- this.hue = e, this.chroma = r, this.j = n, this.q = a, this.m = s, this.s = i, this.jstar = u, this.astar = l, this.bstar = f;
247
- }
248
- /**
249
- * CAM16 instances also have coordinates in the CAM16-UCS space, called J*,
250
- * a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16
251
- * specification, and is used to measure distances between colors.
252
- */
253
- distance(e) {
254
- const r = this.jstar - e.jstar, n = this.astar - e.astar, a = this.bstar - e.bstar, s = Math.sqrt(r * r + n * n + a * a);
255
- return 1.41 * Math.pow(s, 0.63);
256
- }
257
- /**
258
- * @param argb ARGB representation of a color.
259
- * @return CAM16 color, assuming the color was viewed in default viewing
260
- * conditions.
261
- */
262
- static fromInt(e) {
263
- return _.fromIntInViewingConditions(e, q.DEFAULT);
264
- }
265
- /**
266
- * @param argb ARGB representation of a color.
267
- * @param viewingConditions Information about the environment where the color
268
- * was observed.
269
- * @return CAM16 color.
270
- */
271
- static fromIntInViewingConditions(e, r) {
272
- const n = (e & 16711680) >> 16, a = (e & 65280) >> 8, s = e & 255, i = ie(n), u = ie(a), l = ie(s), f = 0.41233895 * i + 0.35762064 * u + 0.18051042 * l, d = 0.2126 * i + 0.7152 * u + 0.0722 * l, S = 0.01932141 * i + 0.11916382 * u + 0.95034478 * l, p = 0.401288 * f + 0.650173 * d - 0.051461 * S, D = -0.250268 * f + 1.204414 * d + 0.045854 * S, m = -2079e-6 * f + 0.048952 * d + 0.953127 * S, g = r.rgbD[0] * p, P = r.rgbD[1] * D, M = r.rgbD[2] * m, B = Math.pow(r.fl * Math.abs(g) / 100, 0.42), R = Math.pow(r.fl * Math.abs(P) / 100, 0.42), V = Math.pow(r.fl * Math.abs(M) / 100, 0.42), N = K(g) * 400 * B / (B + 27.13), E = K(P) * 400 * R / (R + 27.13), v = K(M) * 400 * V / (V + 27.13), O = (11 * N + -12 * E + v) / 11, U = (N + E - 2 * v) / 9, L = (20 * N + 20 * E + 21 * v) / 20, X = (40 * N + 20 * E + v) / 20, ae = Math.atan2(U, O) * 180 / Math.PI, j = de(ae), ce = j * Math.PI / 180, ue = X * r.nbb, Q = 100 * Math.pow(ue / r.aw, r.c * r.z), le = 4 / r.c * Math.sqrt(Q / 100) * (r.aw + 4) * r.fLRoot, ye = j < 20.14 ? j + 360 : j, ge = 0.25 * (Math.cos(ye * Math.PI / 180 + 2) + 3.8), ke = 5e4 / 13 * ge * r.nc * r.ncb * Math.sqrt(O * O + U * U) / (L + 0.305), he = Math.pow(ke, 0.9) * Math.pow(1.64 - Math.pow(0.29, r.n), 0.73), Fe = he * Math.sqrt(Q / 100), xe = Fe * r.fLRoot, He = 50 * Math.sqrt(he * r.c / (r.aw + 4)), Ye = (1 + 100 * 7e-3) * Q / (1 + 7e-3 * Q), ve = 1 / 0.0228 * Math.log(1 + 0.0228 * xe), ze = ve * Math.cos(ce), Ge = ve * Math.sin(ce);
273
- return new _(j, Fe, Q, le, xe, He, Ye, ze, Ge);
274
- }
275
- /**
276
- * @param j CAM16 lightness
277
- * @param c CAM16 chroma
278
- * @param h CAM16 hue
279
- */
280
- static fromJch(e, r, n) {
281
- return _.fromJchInViewingConditions(e, r, n, q.DEFAULT);
282
- }
283
- /**
284
- * @param j CAM16 lightness
285
- * @param c CAM16 chroma
286
- * @param h CAM16 hue
287
- * @param viewingConditions Information about the environment where the color
288
- * was observed.
289
- */
290
- static fromJchInViewingConditions(e, r, n, a) {
291
- const s = 4 / a.c * Math.sqrt(e / 100) * (a.aw + 4) * a.fLRoot, i = r * a.fLRoot, u = r / Math.sqrt(e / 100), l = 50 * Math.sqrt(u * a.c / (a.aw + 4)), f = n * Math.PI / 180, d = (1 + 100 * 7e-3) * e / (1 + 7e-3 * e), S = 1 / 0.0228 * Math.log(1 + 0.0228 * i), p = S * Math.cos(f), D = S * Math.sin(f);
292
- return new _(n, r, e, s, i, l, d, p, D);
293
- }
294
- /**
295
- * @param jstar CAM16-UCS lightness.
296
- * @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
297
- * coordinate on the Y axis.
298
- * @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
299
- * coordinate on the X axis.
300
- */
301
- static fromUcs(e, r, n) {
302
- return _.fromUcsInViewingConditions(e, r, n, q.DEFAULT);
303
- }
304
- /**
305
- * @param jstar CAM16-UCS lightness.
306
- * @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
307
- * coordinate on the Y axis.
308
- * @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
309
- * coordinate on the X axis.
310
- * @param viewingConditions Information about the environment where the color
311
- * was observed.
312
- */
313
- static fromUcsInViewingConditions(e, r, n, a) {
314
- const s = r, i = n, u = Math.sqrt(s * s + i * i), f = (Math.exp(u * 0.0228) - 1) / 0.0228 / a.fLRoot;
315
- let d = Math.atan2(i, s) * (180 / Math.PI);
316
- d < 0 && (d += 360);
317
- const S = e / (1 - (e - 100) * 7e-3);
318
- return _.fromJchInViewingConditions(S, f, d, a);
319
- }
320
- /**
321
- * @return ARGB representation of color, assuming the color was viewed in
322
- * default viewing conditions, which are near-identical to the default
323
- * viewing conditions for sRGB.
324
- */
325
- toInt() {
326
- return this.viewed(q.DEFAULT);
327
- }
328
- /**
329
- * @param viewingConditions Information about the environment where the color
330
- * will be viewed.
331
- * @return ARGB representation of color
332
- */
333
- viewed(e) {
334
- const r = this.chroma === 0 || this.j === 0 ? 0 : this.chroma / Math.sqrt(this.j / 100), n = Math.pow(r / Math.pow(1.64 - Math.pow(0.29, e.n), 0.73), 1 / 0.9), a = this.hue * Math.PI / 180, s = 0.25 * (Math.cos(a + 2) + 3.8), i = e.aw * Math.pow(this.j / 100, 1 / e.c / e.z), u = s * (5e4 / 13) * e.nc * e.ncb, l = i / e.nbb, f = Math.sin(a), d = Math.cos(a), S = 23 * (l + 0.305) * n / (23 * u + 11 * n * d + 108 * n * f), p = S * d, D = S * f, m = (460 * l + 451 * p + 288 * D) / 1403, g = (460 * l - 891 * p - 261 * D) / 1403, P = (460 * l - 220 * p - 6300 * D) / 1403, M = Math.max(0, 27.13 * Math.abs(m) / (400 - Math.abs(m))), B = K(m) * (100 / e.fl) * Math.pow(M, 1 / 0.42), R = Math.max(0, 27.13 * Math.abs(g) / (400 - Math.abs(g))), V = K(g) * (100 / e.fl) * Math.pow(R, 1 / 0.42), N = Math.max(0, 27.13 * Math.abs(P) / (400 - Math.abs(P))), E = K(P) * (100 / e.fl) * Math.pow(N, 1 / 0.42), v = B / e.rgbD[0], O = V / e.rgbD[1], U = E / e.rgbD[2], L = 1.86206786 * v - 1.01125463 * O + 0.14918677 * U, X = 0.38752654 * v + 0.62144744 * O - 897398e-8 * U, Z = -0.0158415 * v - 0.03412294 * O + 1.04996444 * U;
335
- return rr(L, X, Z);
336
- }
337
- /// Given color expressed in XYZ and viewed in [viewingConditions], convert to
338
- /// CAM16.
339
- static fromXyzInViewingConditions(e, r, n, a) {
340
- const s = 0.401288 * e + 0.650173 * r - 0.051461 * n, i = -0.250268 * e + 1.204414 * r + 0.045854 * n, u = -2079e-6 * e + 0.048952 * r + 0.953127 * n, l = a.rgbD[0] * s, f = a.rgbD[1] * i, d = a.rgbD[2] * u, S = Math.pow(a.fl * Math.abs(l) / 100, 0.42), p = Math.pow(a.fl * Math.abs(f) / 100, 0.42), D = Math.pow(a.fl * Math.abs(d) / 100, 0.42), m = K(l) * 400 * S / (S + 27.13), g = K(f) * 400 * p / (p + 27.13), P = K(d) * 400 * D / (D + 27.13), M = (11 * m + -12 * g + P) / 11, B = (m + g - 2 * P) / 9, R = (20 * m + 20 * g + 21 * P) / 20, V = (40 * m + 20 * g + P) / 20, E = Math.atan2(B, M) * 180 / Math.PI, v = E < 0 ? E + 360 : E >= 360 ? E - 360 : E, O = v * Math.PI / 180, U = V * a.nbb, L = 100 * Math.pow(U / a.aw, a.c * a.z), X = 4 / a.c * Math.sqrt(L / 100) * (a.aw + 4) * a.fLRoot, Z = v < 20.14 ? v + 360 : v, ae = 1 / 4 * (Math.cos(Z * Math.PI / 180 + 2) + 3.8), ce = 5e4 / 13 * ae * a.nc * a.ncb * Math.sqrt(M * M + B * B) / (R + 0.305), ue = Math.pow(ce, 0.9) * Math.pow(1.64 - Math.pow(0.29, a.n), 0.73), Q = ue * Math.sqrt(L / 100), le = Q * a.fLRoot, ye = 50 * Math.sqrt(ue * a.c / (a.aw + 4)), ge = (1 + 100 * 7e-3) * L / (1 + 7e-3 * L), Pe = Math.log(1 + 0.0228 * le) / 0.0228, ke = Pe * Math.cos(O), he = Pe * Math.sin(O);
341
- return new _(v, Q, L, X, le, ye, ge, ke, he);
342
- }
343
- /// XYZ representation of CAM16 seen in [viewingConditions].
344
- xyzInViewingConditions(e) {
345
- const r = this.chroma === 0 || this.j === 0 ? 0 : this.chroma / Math.sqrt(this.j / 100), n = Math.pow(r / Math.pow(1.64 - Math.pow(0.29, e.n), 0.73), 1 / 0.9), a = this.hue * Math.PI / 180, s = 0.25 * (Math.cos(a + 2) + 3.8), i = e.aw * Math.pow(this.j / 100, 1 / e.c / e.z), u = s * (5e4 / 13) * e.nc * e.ncb, l = i / e.nbb, f = Math.sin(a), d = Math.cos(a), S = 23 * (l + 0.305) * n / (23 * u + 11 * n * d + 108 * n * f), p = S * d, D = S * f, m = (460 * l + 451 * p + 288 * D) / 1403, g = (460 * l - 891 * p - 261 * D) / 1403, P = (460 * l - 220 * p - 6300 * D) / 1403, M = Math.max(0, 27.13 * Math.abs(m) / (400 - Math.abs(m))), B = K(m) * (100 / e.fl) * Math.pow(M, 1 / 0.42), R = Math.max(0, 27.13 * Math.abs(g) / (400 - Math.abs(g))), V = K(g) * (100 / e.fl) * Math.pow(R, 1 / 0.42), N = Math.max(0, 27.13 * Math.abs(P) / (400 - Math.abs(P))), E = K(P) * (100 / e.fl) * Math.pow(N, 1 / 0.42), v = B / e.rgbD[0], O = V / e.rgbD[1], U = E / e.rgbD[2], L = 1.86206786 * v - 1.01125463 * O + 0.14918677 * U, X = 0.38752654 * v + 0.62144744 * O - 897398e-8 * U, Z = -0.0158415 * v - 0.03412294 * O + 1.04996444 * U;
346
- return [L, X, Z];
347
- }
348
- }
349
- /**
350
- * @license
351
- * Copyright 2021 Google LLC
352
- *
353
- * Licensed under the Apache License, Version 2.0 (the "License");
354
- * you may not use this file except in compliance with the License.
355
- * You may obtain a copy of the License at
356
- *
357
- * http://www.apache.org/licenses/LICENSE-2.0
358
- *
359
- * Unless required by applicable law or agreed to in writing, software
360
- * distributed under the License is distributed on an "AS IS" BASIS,
361
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362
- * See the License for the specific language governing permissions and
363
- * limitations under the License.
364
- */
365
- class C {
366
- /**
367
- * Sanitizes a small enough angle in radians.
368
- *
369
- * @param angle An angle in radians; must not deviate too much
370
- * from 0.
371
- * @return A coterminal angle between 0 and 2pi.
372
- */
373
- static sanitizeRadians(e) {
374
- return (e + Math.PI * 8) % (Math.PI * 2);
375
- }
376
- /**
377
- * Delinearizes an RGB component, returning a floating-point
378
- * number.
379
- *
380
- * @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
381
- * linear R/G/B channel
382
- * @return 0.0 <= output <= 255.0, color channel converted to
383
- * regular RGB space
384
- */
385
- static trueDelinearized(e) {
386
- const r = e / 100;
387
- let n = 0;
388
- return r <= 31308e-7 ? n = r * 12.92 : n = 1.055 * Math.pow(r, 1 / 2.4) - 0.055, n * 255;
389
- }
390
- static chromaticAdaptation(e) {
391
- const r = Math.pow(Math.abs(e), 0.42);
392
- return K(e) * 400 * r / (r + 27.13);
393
- }
394
- /**
395
- * Returns the hue of a linear RGB color in CAM16.
396
- *
397
- * @param linrgb The linear RGB coordinates of a color.
398
- * @return The hue of the color in CAM16, in radians.
399
- */
400
- static hueOf(e) {
401
- const r = Se(e, C.SCALED_DISCOUNT_FROM_LINRGB), n = C.chromaticAdaptation(r[0]), a = C.chromaticAdaptation(r[1]), s = C.chromaticAdaptation(r[2]), i = (11 * n + -12 * a + s) / 11, u = (n + a - 2 * s) / 9;
402
- return Math.atan2(u, i);
403
- }
404
- static areInCyclicOrder(e, r, n) {
405
- const a = C.sanitizeRadians(r - e), s = C.sanitizeRadians(n - e);
406
- return a < s;
407
- }
408
- /**
409
- * Solves the lerp equation.
410
- *
411
- * @param source The starting number.
412
- * @param mid The number in the middle.
413
- * @param target The ending number.
414
- * @return A number t such that lerp(source, target, t) = mid.
415
- */
416
- static intercept(e, r, n) {
417
- return (r - e) / (n - e);
418
- }
419
- static lerpPoint(e, r, n) {
420
- return [
421
- e[0] + (n[0] - e[0]) * r,
422
- e[1] + (n[1] - e[1]) * r,
423
- e[2] + (n[2] - e[2]) * r
424
- ];
425
- }
426
- /**
427
- * Intersects a segment with a plane.
428
- *
429
- * @param source The coordinates of point A.
430
- * @param coordinate The R-, G-, or B-coordinate of the plane.
431
- * @param target The coordinates of point B.
432
- * @param axis The axis the plane is perpendicular with. (0: R, 1:
433
- * G, 2: B)
434
- * @return The intersection point of the segment AB with the plane
435
- * R=coordinate, G=coordinate, or B=coordinate
436
- */
437
- static setCoordinate(e, r, n, a) {
438
- const s = C.intercept(e[a], r, n[a]);
439
- return C.lerpPoint(e, s, n);
440
- }
441
- static isBounded(e) {
442
- return 0 <= e && e <= 100;
443
- }
444
- /**
445
- * Returns the nth possible vertex of the polygonal intersection.
446
- *
447
- * @param y The Y value of the plane.
448
- * @param n The zero-based index of the point. 0 <= n <= 11.
449
- * @return The nth possible vertex of the polygonal intersection
450
- * of the y plane and the RGB cube, in linear RGB coordinates, if
451
- * it exists. If this possible vertex lies outside of the cube,
452
- * [-1.0, -1.0, -1.0] is returned.
453
- */
454
- static nthVertex(e, r) {
455
- const n = C.Y_FROM_LINRGB[0], a = C.Y_FROM_LINRGB[1], s = C.Y_FROM_LINRGB[2], i = r % 4 <= 1 ? 0 : 100, u = r % 2 === 0 ? 0 : 100;
456
- if (r < 4) {
457
- const l = i, f = u, d = (e - l * a - f * s) / n;
458
- return C.isBounded(d) ? [d, l, f] : [-1, -1, -1];
459
- } else if (r < 8) {
460
- const l = i, f = u, d = (e - f * n - l * s) / a;
461
- return C.isBounded(d) ? [f, d, l] : [-1, -1, -1];
462
- } else {
463
- const l = i, f = u, d = (e - l * n - f * a) / s;
464
- return C.isBounded(d) ? [l, f, d] : [-1, -1, -1];
465
- }
466
- }
467
- /**
468
- * Finds the segment containing the desired color.
469
- *
470
- * @param y The Y value of the color.
471
- * @param targetHue The hue of the color.
472
- * @return A list of two sets of linear RGB coordinates, each
473
- * corresponding to an endpoint of the segment containing the
474
- * desired color.
475
- */
476
- static bisectToSegment(e, r) {
477
- let n = [-1, -1, -1], a = n, s = 0, i = 0, u = !1, l = !0;
478
- for (let f = 0; f < 12; f++) {
479
- const d = C.nthVertex(e, f);
480
- if (d[0] < 0)
481
- continue;
482
- const S = C.hueOf(d);
483
- if (!u) {
484
- n = d, a = d, s = S, i = S, u = !0;
485
- continue;
486
- }
487
- (l || C.areInCyclicOrder(s, S, i)) && (l = !1, C.areInCyclicOrder(s, r, S) ? (a = d, i = S) : (n = d, s = S));
488
- }
489
- return [n, a];
490
- }
491
- static midpoint(e, r) {
492
- return [
493
- (e[0] + r[0]) / 2,
494
- (e[1] + r[1]) / 2,
495
- (e[2] + r[2]) / 2
496
- ];
497
- }
498
- static criticalPlaneBelow(e) {
499
- return Math.floor(e - 0.5);
500
- }
501
- static criticalPlaneAbove(e) {
502
- return Math.ceil(e - 0.5);
503
- }
504
- /**
505
- * Finds a color with the given Y and hue on the boundary of the
506
- * cube.
507
- *
508
- * @param y The Y value of the color.
509
- * @param targetHue The hue of the color.
510
- * @return The desired color, in linear RGB coordinates.
511
- */
512
- static bisectToLimit(e, r) {
513
- const n = C.bisectToSegment(e, r);
514
- let a = n[0], s = C.hueOf(a), i = n[1];
515
- for (let u = 0; u < 3; u++)
516
- if (a[u] !== i[u]) {
517
- let l = -1, f = 255;
518
- a[u] < i[u] ? (l = C.criticalPlaneBelow(C.trueDelinearized(a[u])), f = C.criticalPlaneAbove(C.trueDelinearized(i[u]))) : (l = C.criticalPlaneAbove(C.trueDelinearized(a[u])), f = C.criticalPlaneBelow(C.trueDelinearized(i[u])));
519
- for (let d = 0; d < 8 && !(Math.abs(f - l) <= 1); d++) {
520
- const S = Math.floor((l + f) / 2), p = C.CRITICAL_PLANES[S], D = C.setCoordinate(a, p, i, u), m = C.hueOf(D);
521
- C.areInCyclicOrder(s, r, m) ? (i = D, f = S) : (a = D, s = m, l = S);
522
- }
523
- }
524
- return C.midpoint(a, i);
525
- }
526
- static inverseChromaticAdaptation(e) {
527
- const r = Math.abs(e), n = Math.max(0, 27.13 * r / (400 - r));
528
- return K(e) * Math.pow(n, 1 / 0.42);
529
- }
530
- /**
531
- * Finds a color with the given hue, chroma, and Y.
532
- *
533
- * @param hueRadians The desired hue in radians.
534
- * @param chroma The desired chroma.
535
- * @param y The desired Y.
536
- * @return The desired color as a hexadecimal integer, if found; 0
537
- * otherwise.
538
- */
539
- static findResultByJ(e, r, n) {
540
- let a = Math.sqrt(n) * 11;
541
- const s = q.DEFAULT, i = 1 / Math.pow(1.64 - Math.pow(0.29, s.n), 0.73), l = 0.25 * (Math.cos(e + 2) + 3.8) * (5e4 / 13) * s.nc * s.ncb, f = Math.sin(e), d = Math.cos(e);
542
- for (let S = 0; S < 5; S++) {
543
- const p = a / 100, D = r === 0 || a === 0 ? 0 : r / Math.sqrt(p), m = Math.pow(D * i, 1 / 0.9), P = s.aw * Math.pow(p, 1 / s.c / s.z) / s.nbb, M = 23 * (P + 0.305) * m / (23 * l + 11 * m * d + 108 * m * f), B = M * d, R = M * f, V = (460 * P + 451 * B + 288 * R) / 1403, N = (460 * P - 891 * B - 261 * R) / 1403, E = (460 * P - 220 * B - 6300 * R) / 1403, v = C.inverseChromaticAdaptation(V), O = C.inverseChromaticAdaptation(N), U = C.inverseChromaticAdaptation(E), L = Se([v, O, U], C.LINRGB_FROM_SCALED_DISCOUNT);
544
- if (L[0] < 0 || L[1] < 0 || L[2] < 0)
545
- return 0;
546
- const X = C.Y_FROM_LINRGB[0], Z = C.Y_FROM_LINRGB[1], ae = C.Y_FROM_LINRGB[2], j = X * L[0] + Z * L[1] + ae * L[2];
547
- if (j <= 0)
548
- return 0;
549
- if (S === 4 || Math.abs(j - n) < 2e-3)
550
- return L[0] > 100.01 || L[1] > 100.01 || L[2] > 100.01 ? 0 : Be(L);
551
- a = a - (j - n) * a / (2 * j);
552
- }
553
- return 0;
554
- }
555
- /**
556
- * Finds an sRGB color with the given hue, chroma, and L*, if
557
- * possible.
558
- *
559
- * @param hueDegrees The desired hue, in degrees.
560
- * @param chroma The desired chroma.
561
- * @param lstar The desired L*.
562
- * @return A hexadecimal representing the sRGB color. The color
563
- * has sufficiently close hue, chroma, and L* to the desired
564
- * values, if possible; otherwise, the hue and L* will be
565
- * sufficiently close, and chroma will be maximized.
566
- */
567
- static solveToInt(e, r, n) {
568
- if (r < 1e-4 || n < 1e-4 || n > 99.9999)
569
- return nr(n);
570
- e = de(e);
571
- const a = e / 180 * Math.PI, s = te(n), i = C.findResultByJ(a, r, s);
572
- if (i !== 0)
573
- return i;
574
- const u = C.bisectToLimit(s, a);
575
- return Be(u);
576
- }
577
- /**
578
- * Finds an sRGB color with the given hue, chroma, and L*, if
579
- * possible.
580
- *
581
- * @param hueDegrees The desired hue, in degrees.
582
- * @param chroma The desired chroma.
583
- * @param lstar The desired L*.
584
- * @return An CAM16 object representing the sRGB color. The color
585
- * has sufficiently close hue, chroma, and L* to the desired
586
- * values, if possible; otherwise, the hue and L* will be
587
- * sufficiently close, and chroma will be maximized.
588
- */
589
- static solveToCam(e, r, n) {
590
- return _.fromInt(C.solveToInt(e, r, n));
591
- }
592
- }
593
- C.SCALED_DISCOUNT_FROM_LINRGB = [
594
- [
595
- 0.001200833568784504,
596
- 0.002389694492170889,
597
- 2795742885861124e-19
598
- ],
599
- [
600
- 5891086651375999e-19,
601
- 0.0029785502573438758,
602
- 3270666104008398e-19
603
- ],
604
- [
605
- 10146692491640572e-20,
606
- 5364214359186694e-19,
607
- 0.0032979401770712076
608
- ]
609
- ];
610
- C.LINRGB_FROM_SCALED_DISCOUNT = [
611
- [
612
- 1373.2198709594231,
613
- -1100.4251190754821,
614
- -7.278681089101213
615
- ],
616
- [
617
- -271.815969077903,
618
- 559.6580465940733,
619
- -32.46047482791194
620
- ],
621
- [
622
- 1.9622899599665666,
623
- -57.173814538844006,
624
- 308.7233197812385
625
- ]
626
- ];
627
- C.Y_FROM_LINRGB = [0.2126, 0.7152, 0.0722];
628
- C.CRITICAL_PLANES = [
629
- 0.015176349177441876,
630
- 0.045529047532325624,
631
- 0.07588174588720938,
632
- 0.10623444424209313,
633
- 0.13658714259697685,
634
- 0.16693984095186062,
635
- 0.19729253930674434,
636
- 0.2276452376616281,
637
- 0.2579979360165119,
638
- 0.28835063437139563,
639
- 0.3188300904430532,
640
- 0.350925934958123,
641
- 0.3848314933096426,
642
- 0.42057480301049466,
643
- 0.458183274052838,
644
- 0.4976837250274023,
645
- 0.5391024159806381,
646
- 0.5824650784040898,
647
- 0.6277969426914107,
648
- 0.6751227633498623,
649
- 0.7244668422128921,
650
- 0.775853049866786,
651
- 0.829304845476233,
652
- 0.8848452951698498,
653
- 0.942497089126609,
654
- 1.0022825574869039,
655
- 1.0642236851973577,
656
- 1.1283421258858297,
657
- 1.1946592148522128,
658
- 1.2631959812511864,
659
- 1.3339731595349034,
660
- 1.407011200216447,
661
- 1.4823302800086415,
662
- 1.5599503113873272,
663
- 1.6398909516233677,
664
- 1.7221716113234105,
665
- 1.8068114625156377,
666
- 1.8938294463134073,
667
- 1.9832442801866852,
668
- 2.075074464868551,
669
- 2.1693382909216234,
670
- 2.2660538449872063,
671
- 2.36523901573795,
672
- 2.4669114995532007,
673
- 2.5710888059345764,
674
- 2.6777882626779785,
675
- 2.7870270208169257,
676
- 2.898822059350997,
677
- 3.0131901897720907,
678
- 3.1301480604002863,
679
- 3.2497121605402226,
680
- 3.3718988244681087,
681
- 3.4967242352587946,
682
- 3.624204428461639,
683
- 3.754355295633311,
684
- 3.887192587735158,
685
- 4.022731918402185,
686
- 4.160988767090289,
687
- 4.301978482107941,
688
- 4.445716283538092,
689
- 4.592217266055746,
690
- 4.741496401646282,
691
- 4.893568542229298,
692
- 5.048448422192488,
693
- 5.20615066083972,
694
- 5.3666897647573375,
695
- 5.5300801301023865,
696
- 5.696336044816294,
697
- 5.865471690767354,
698
- 6.037501145825082,
699
- 6.212438385869475,
700
- 6.390297286737924,
701
- 6.571091626112461,
702
- 6.7548350853498045,
703
- 6.941541251256611,
704
- 7.131223617812143,
705
- 7.323895587840543,
706
- 7.5195704746346665,
707
- 7.7182615035334345,
708
- 7.919981813454504,
709
- 8.124744458384042,
710
- 8.332562408825165,
711
- 8.543448553206703,
712
- 8.757415699253682,
713
- 8.974476575321063,
714
- 9.194643831691977,
715
- 9.417930041841839,
716
- 9.644347703669503,
717
- 9.873909240696694,
718
- 10.106627003236781,
719
- 10.342513269534024,
720
- 10.58158024687427,
721
- 10.8238400726681,
722
- 11.069304815507364,
723
- 11.317986476196008,
724
- 11.569896988756009,
725
- 11.825048221409341,
726
- 12.083451977536606,
727
- 12.345119996613247,
728
- 12.610063955123938,
729
- 12.878295467455942,
730
- 13.149826086772048,
731
- 13.42466730586372,
732
- 13.702830557985108,
733
- 13.984327217668513,
734
- 14.269168601521828,
735
- 14.55736596900856,
736
- 14.848930523210871,
737
- 15.143873411576273,
738
- 15.44220572664832,
739
- 15.743938506781891,
740
- 16.04908273684337,
741
- 16.35764934889634,
742
- 16.66964922287304,
743
- 16.985093187232053,
744
- 17.30399201960269,
745
- 17.62635644741625,
746
- 17.95219714852476,
747
- 18.281524751807332,
748
- 18.614349837764564,
749
- 18.95068293910138,
750
- 19.290534541298456,
751
- 19.633915083172692,
752
- 19.98083495742689,
753
- 20.331304511189067,
754
- 20.685334046541502,
755
- 21.042933821039977,
756
- 21.404114048223256,
757
- 21.76888489811322,
758
- 22.137256497705877,
759
- 22.50923893145328,
760
- 22.884842241736916,
761
- 23.264076429332462,
762
- 23.6469514538663,
763
- 24.033477234264016,
764
- 24.42366364919083,
765
- 24.817520537484558,
766
- 25.21505769858089,
767
- 25.61628489293138,
768
- 26.021211842414342,
769
- 26.429848230738664,
770
- 26.842203703840827,
771
- 27.258287870275353,
772
- 27.678110301598522,
773
- 28.10168053274597,
774
- 28.529008062403893,
775
- 28.96010235337422,
776
- 29.39497283293396,
777
- 29.83362889318845,
778
- 30.276079891419332,
779
- 30.722335150426627,
780
- 31.172403958865512,
781
- 31.62629557157785,
782
- 32.08401920991837,
783
- 32.54558406207592,
784
- 33.010999283389665,
785
- 33.4802739966603,
786
- 33.953417292456834,
787
- 34.430438229418264,
788
- 34.911345834551085,
789
- 35.39614910352207,
790
- 35.88485700094671,
791
- 36.37747846067349,
792
- 36.87402238606382,
793
- 37.37449765026789,
794
- 37.87891309649659,
795
- 38.38727753828926,
796
- 38.89959975977785,
797
- 39.41588851594697,
798
- 39.93615253289054,
799
- 40.460400508064545,
800
- 40.98864111053629,
801
- 41.520882981230194,
802
- 42.05713473317016,
803
- 42.597404951718396,
804
- 43.141702194811224,
805
- 43.6900349931913,
806
- 44.24241185063697,
807
- 44.798841244188324,
808
- 45.35933162437017,
809
- 45.92389141541209,
810
- 46.49252901546552,
811
- 47.065252796817916,
812
- 47.64207110610409,
813
- 48.22299226451468,
814
- 48.808024568002054,
815
- 49.3971762874833,
816
- 49.9904556690408,
817
- 50.587870934119984,
818
- 51.189430279724725,
819
- 51.79514187861014,
820
- 52.40501387947288,
821
- 53.0190544071392,
822
- 53.637271562750364,
823
- 54.259673423945976,
824
- 54.88626804504493,
825
- 55.517063457223934,
826
- 56.15206766869424,
827
- 56.79128866487574,
828
- 57.43473440856916,
829
- 58.08241284012621,
830
- 58.734331877617365,
831
- 59.39049941699807,
832
- 60.05092333227251,
833
- 60.715611475655585,
834
- 61.38457167773311,
835
- 62.057811747619894,
836
- 62.7353394731159,
837
- 63.417162620860914,
838
- 64.10328893648692,
839
- 64.79372614476921,
840
- 65.48848194977529,
841
- 66.18756403501224,
842
- 66.89098006357258,
843
- 67.59873767827808,
844
- 68.31084450182222,
845
- 69.02730813691093,
846
- 69.74813616640164,
847
- 70.47333615344107,
848
- 71.20291564160104,
849
- 71.93688215501312,
850
- 72.67524319850172,
851
- 73.41800625771542,
852
- 74.16517879925733,
853
- 74.9167682708136,
854
- 75.67278210128072,
855
- 76.43322770089146,
856
- 77.1981124613393,
857
- 77.96744375590167,
858
- 78.74122893956174,
859
- 79.51947534912904,
860
- 80.30219030335869,
861
- 81.08938110306934,
862
- 81.88105503125999,
863
- 82.67721935322541,
864
- 83.4778813166706,
865
- 84.28304815182372,
866
- 85.09272707154808,
867
- 85.90692527145302,
868
- 86.72564993000343,
869
- 87.54890820862819,
870
- 88.3767072518277,
871
- 89.2090541872801,
872
- 90.04595612594655,
873
- 90.88742016217518,
874
- 91.73345337380438,
875
- 92.58406282226491,
876
- 93.43925555268066,
877
- 94.29903859396902,
878
- 95.16341895893969,
879
- 96.03240364439274,
880
- 96.9059996312159,
881
- 97.78421388448044,
882
- 98.6670533535366,
883
- 99.55452497210776
884
- ];
885
- /**
886
- * @license
887
- * Copyright 2021 Google LLC
888
- *
889
- * Licensed under the Apache License, Version 2.0 (the "License");
890
- * you may not use this file except in compliance with the License.
891
- * You may obtain a copy of the License at
892
- *
893
- * http://www.apache.org/licenses/LICENSE-2.0
894
- *
895
- * Unless required by applicable law or agreed to in writing, software
896
- * distributed under the License is distributed on an "AS IS" BASIS,
897
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
898
- * See the License for the specific language governing permissions and
899
- * limitations under the License.
900
- */
901
- class b {
902
- static from(e, r, n) {
903
- return new b(C.solveToInt(e, r, n));
904
- }
905
- /**
906
- * @param argb ARGB representation of a color.
907
- * @return HCT representation of a color in default viewing conditions
908
- */
909
- static fromInt(e) {
910
- return new b(e);
911
- }
912
- toInt() {
913
- return this.argb;
914
- }
915
- /**
916
- * A number, in degrees, representing ex. red, orange, yellow, etc.
917
- * Ranges from 0 <= hue < 360.
918
- */
919
- get hue() {
920
- return this.internalHue;
921
- }
922
- /**
923
- * @param newHue 0 <= newHue < 360; invalid values are corrected.
924
- * Chroma may decrease because chroma has a different maximum for any given
925
- * hue and tone.
926
- */
927
- set hue(e) {
928
- this.setInternalState(C.solveToInt(e, this.internalChroma, this.internalTone));
929
- }
930
- get chroma() {
931
- return this.internalChroma;
932
- }
933
- /**
934
- * @param newChroma 0 <= newChroma < ?
935
- * Chroma may decrease because chroma has a different maximum for any given
936
- * hue and tone.
937
- */
938
- set chroma(e) {
939
- this.setInternalState(C.solveToInt(this.internalHue, e, this.internalTone));
940
- }
941
- /** Lightness. Ranges from 0 to 100. */
942
- get tone() {
943
- return this.internalTone;
944
- }
945
- /**
946
- * @param newTone 0 <= newTone <= 100; invalid valids are corrected.
947
- * Chroma may decrease because chroma has a different maximum for any given
948
- * hue and tone.
949
- */
950
- set tone(e) {
951
- this.setInternalState(C.solveToInt(this.internalHue, this.internalChroma, e));
952
- }
953
- /** Sets a property of the Hct object. */
954
- setValue(e, r) {
955
- this[e] = r;
956
- }
957
- toString() {
958
- return `HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`;
959
- }
960
- static isBlue(e) {
961
- return e >= 250 && e < 270;
962
- }
963
- static isYellow(e) {
964
- return e >= 105 && e < 125;
965
- }
966
- static isCyan(e) {
967
- return e >= 170 && e < 207;
968
- }
969
- constructor(e) {
970
- this.argb = e;
971
- const r = _.fromInt(e);
972
- this.internalHue = r.hue, this.internalChroma = r.chroma, this.internalTone = Ce(e), this.argb = e;
973
- }
974
- setInternalState(e) {
975
- const r = _.fromInt(e);
976
- this.internalHue = r.hue, this.internalChroma = r.chroma, this.internalTone = Ce(e), this.argb = e;
977
- }
978
- /**
979
- * Translates a color into different [ViewingConditions].
980
- *
981
- * Colors change appearance. They look different with lights on versus off,
982
- * the same color, as in hex code, on white looks different when on black.
983
- * This is called color relativity, most famously explicated by Josef Albers
984
- * in Interaction of Color.
985
- *
986
- * In color science, color appearance models can account for this and
987
- * calculate the appearance of a color in different settings. HCT is based on
988
- * CAM16, a color appearance model, and uses it to make these calculations.
989
- *
990
- * See [ViewingConditions.make] for parameters affecting color appearance.
991
- */
992
- inViewingConditions(e) {
993
- const n = _.fromInt(this.toInt()).xyzInViewingConditions(e), a = _.fromXyzInViewingConditions(n[0], n[1], n[2], q.make());
994
- return b.from(a.hue, a.chroma, be(n[1]));
995
- }
996
- }
997
- /**
998
- * @license
999
- * Copyright 2021 Google LLC
1000
- *
1001
- * Licensed under the Apache License, Version 2.0 (the "License");
1002
- * you may not use this file except in compliance with the License.
1003
- * You may obtain a copy of the License at
1004
- *
1005
- * http://www.apache.org/licenses/LICENSE-2.0
1006
- *
1007
- * Unless required by applicable law or agreed to in writing, software
1008
- * distributed under the License is distributed on an "AS IS" BASIS,
1009
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
- * See the License for the specific language governing permissions and
1011
- * limitations under the License.
1012
- */
1013
- class De {
1014
- /**
1015
- * Blend the design color's HCT hue towards the key color's HCT
1016
- * hue, in a way that leaves the original color recognizable and
1017
- * recognizably shifted towards the key color.
1018
- *
1019
- * @param designColor ARGB representation of an arbitrary color.
1020
- * @param sourceColor ARGB representation of the main theme color.
1021
- * @return The design color with a hue shifted towards the
1022
- * system's color, a slightly warmer/cooler variant of the design
1023
- * color's hue.
1024
- */
1025
- static harmonize(e, r) {
1026
- const n = b.fromInt(e), a = b.fromInt(r), s = We(n.hue, a.hue), i = Math.min(s * 0.5, 15), u = de(n.hue + i * Je(n.hue, a.hue));
1027
- return b.from(u, n.chroma, n.tone).toInt();
1028
- }
1029
- /**
1030
- * Blends hue from one color into another. The chroma and tone of
1031
- * the original color are maintained.
1032
- *
1033
- * @param from ARGB representation of color
1034
- * @param to ARGB representation of color
1035
- * @param amount how much blending to perform; 0.0 >= and <= 1.0
1036
- * @return from, with a hue blended towards to. Chroma and tone
1037
- * are constant.
1038
- */
1039
- static hctHue(e, r, n) {
1040
- const a = De.cam16Ucs(e, r, n), s = _.fromInt(a), i = _.fromInt(e);
1041
- return b.from(s.hue, i.chroma, Ce(e)).toInt();
1042
- }
1043
- /**
1044
- * Blend in CAM16-UCS space.
1045
- *
1046
- * @param from ARGB representation of color
1047
- * @param to ARGB representation of color
1048
- * @param amount how much blending to perform; 0.0 >= and <= 1.0
1049
- * @return from, blended towards to. Hue, chroma, and tone will
1050
- * change.
1051
- */
1052
- static cam16Ucs(e, r, n) {
1053
- const a = _.fromInt(e), s = _.fromInt(r), i = a.jstar, u = a.astar, l = a.bstar, f = s.jstar, d = s.astar, S = s.bstar, p = i + (f - i) * n, D = u + (d - u) * n, m = l + (S - l) * n;
1054
- return _.fromUcs(p, D, m).toInt();
1055
- }
1056
- }
1057
- /**
1058
- * @license
1059
- * Copyright 2022 Google LLC
1060
- *
1061
- * Licensed under the Apache License, Version 2.0 (the "License");
1062
- * you may not use this file except in compliance with the License.
1063
- * You may obtain a copy of the License at
1064
- *
1065
- * http://www.apache.org/licenses/LICENSE-2.0
1066
- *
1067
- * Unless required by applicable law or agreed to in writing, software
1068
- * distributed under the License is distributed on an "AS IS" BASIS,
1069
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070
- * See the License for the specific language governing permissions and
1071
- * limitations under the License.
1072
- */
1073
- class A {
1074
- /**
1075
- * Returns a contrast ratio, which ranges from 1 to 21.
1076
- *
1077
- * @param toneA Tone between 0 and 100. Values outside will be clamped.
1078
- * @param toneB Tone between 0 and 100. Values outside will be clamped.
1079
- */
1080
- static ratioOfTones(e, r) {
1081
- return e = H(0, 100, e), r = H(0, 100, r), A.ratioOfYs(te(e), te(r));
1082
- }
1083
- static ratioOfYs(e, r) {
1084
- const n = e > r ? e : r, a = n === r ? e : r;
1085
- return (n + 5) / (a + 5);
1086
- }
1087
- /**
1088
- * Returns a tone >= tone parameter that ensures ratio parameter.
1089
- * Return value is between 0 and 100.
1090
- * Returns -1 if ratio cannot be achieved with tone parameter.
1091
- *
1092
- * @param tone Tone return value must contrast with.
1093
- * Range is 0 to 100. Invalid values will result in -1 being returned.
1094
- * @param ratio Contrast ratio of return value and tone.
1095
- * Range is 1 to 21, invalid values have undefined behavior.
1096
- */
1097
- static lighter(e, r) {
1098
- if (e < 0 || e > 100)
1099
- return -1;
1100
- const n = te(e), a = r * (n + 5) - 5, s = A.ratioOfYs(a, n), i = Math.abs(s - r);
1101
- if (s < r && i > 0.04)
1102
- return -1;
1103
- const u = be(a) + 0.4;
1104
- return u < 0 || u > 100 ? -1 : u;
1105
- }
1106
- /**
1107
- * Returns a tone <= tone parameter that ensures ratio parameter.
1108
- * Return value is between 0 and 100.
1109
- * Returns -1 if ratio cannot be achieved with tone parameter.
1110
- *
1111
- * @param tone Tone return value must contrast with.
1112
- * Range is 0 to 100. Invalid values will result in -1 being returned.
1113
- * @param ratio Contrast ratio of return value and tone.
1114
- * Range is 1 to 21, invalid values have undefined behavior.
1115
- */
1116
- static darker(e, r) {
1117
- if (e < 0 || e > 100)
1118
- return -1;
1119
- const n = te(e), a = (n + 5) / r - 5, s = A.ratioOfYs(n, a), i = Math.abs(s - r);
1120
- if (s < r && i > 0.04)
1121
- return -1;
1122
- const u = be(a) - 0.4;
1123
- return u < 0 || u > 100 ? -1 : u;
1124
- }
1125
- /**
1126
- * Returns a tone >= tone parameter that ensures ratio parameter.
1127
- * Return value is between 0 and 100.
1128
- * Returns 100 if ratio cannot be achieved with tone parameter.
1129
- *
1130
- * This method is unsafe because the returned value is guaranteed to be in
1131
- * bounds for tone, i.e. between 0 and 100. However, that value may not reach
1132
- * the ratio with tone. For example, there is no color lighter than T100.
1133
- *
1134
- * @param tone Tone return value must contrast with.
1135
- * Range is 0 to 100. Invalid values will result in 100 being returned.
1136
- * @param ratio Desired contrast ratio of return value and tone parameter.
1137
- * Range is 1 to 21, invalid values have undefined behavior.
1138
- */
1139
- static lighterUnsafe(e, r) {
1140
- const n = A.lighter(e, r);
1141
- return n < 0 ? 100 : n;
1142
- }
1143
- /**
1144
- * Returns a tone >= tone parameter that ensures ratio parameter.
1145
- * Return value is between 0 and 100.
1146
- * Returns 100 if ratio cannot be achieved with tone parameter.
1147
- *
1148
- * This method is unsafe because the returned value is guaranteed to be in
1149
- * bounds for tone, i.e. between 0 and 100. However, that value may not reach
1150
- * the [ratio with [tone]. For example, there is no color darker than T0.
1151
- *
1152
- * @param tone Tone return value must contrast with.
1153
- * Range is 0 to 100. Invalid values will result in 0 being returned.
1154
- * @param ratio Desired contrast ratio of return value and tone parameter.
1155
- * Range is 1 to 21, invalid values have undefined behavior.
1156
- */
1157
- static darkerUnsafe(e, r) {
1158
- const n = A.darker(e, r);
1159
- return n < 0 ? 0 : n;
1160
- }
1161
- }
1162
- /**
1163
- * @license
1164
- * Copyright 2023 Google LLC
1165
- *
1166
- * Licensed under the Apache License, Version 2.0 (the "License");
1167
- * you may not use this file except in compliance with the License.
1168
- * You may obtain a copy of the License at
1169
- *
1170
- * http://www.apache.org/licenses/LICENSE-2.0
1171
- *
1172
- * Unless required by applicable law or agreed to in writing, software
1173
- * distributed under the License is distributed on an "AS IS" BASIS,
1174
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1175
- * See the License for the specific language governing permissions and
1176
- * limitations under the License.
1177
- */
1178
- class we {
1179
- /**
1180
- * Returns true if a color is disliked.
1181
- *
1182
- * @param hct A color to be judged.
1183
- * @return Whether the color is disliked.
1184
- *
1185
- * Disliked is defined as a dark yellow-green that is not neutral.
1186
- */
1187
- static isDisliked(e) {
1188
- const r = Math.round(e.hue) >= 90 && Math.round(e.hue) <= 111, n = Math.round(e.chroma) > 16, a = Math.round(e.tone) < 65;
1189
- return r && n && a;
1190
- }
1191
- /**
1192
- * If a color is disliked, lighten it to make it likable.
1193
- *
1194
- * @param hct A color to be judged.
1195
- * @return A new color if the original color is disliked, or the original
1196
- * color if it is acceptable.
1197
- */
1198
- static fixIfDisliked(e) {
1199
- return we.isDisliked(e) ? b.from(e.hue, e.chroma, 70) : e;
1200
- }
1201
- }
1202
- /**
1203
- * @license
1204
- * Copyright 2022 Google LLC
1205
- *
1206
- * Licensed under the Apache License, Version 2.0 (the "License");
1207
- * you may not use this file except in compliance with the License.
1208
- * You may obtain a copy of the License at
1209
- *
1210
- * http://www.apache.org/licenses/LICENSE-2.0
1211
- *
1212
- * Unless required by applicable law or agreed to in writing, software
1213
- * distributed under the License is distributed on an "AS IS" BASIS,
1214
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1215
- * See the License for the specific language governing permissions and
1216
- * limitations under the License.
1217
- */
1218
- function ir(t, e, r) {
1219
- if (t.name !== r.name)
1220
- throw new Error(`Attempting to extend color ${t.name} with color ${r.name} of different name for spec version ${e}.`);
1221
- if (t.isBackground !== r.isBackground)
1222
- throw new Error(`Attempting to extend color ${t.name} as a ${t.isBackground ? "background" : "foreground"} with color ${r.name} as a ${r.isBackground ? "background" : "foreground"} for spec version ${e}.`);
1223
- }
1224
- function T(t, e, r) {
1225
- return ir(t, e, r), c.fromPalette({
1226
- name: t.name,
1227
- palette: (n) => n.specVersion === e ? r.palette(n) : t.palette(n),
1228
- tone: (n) => n.specVersion === e ? r.tone(n) : t.tone(n),
1229
- isBackground: t.isBackground,
1230
- chromaMultiplier: (n) => {
1231
- const a = n.specVersion === e ? r.chromaMultiplier : t.chromaMultiplier;
1232
- return a !== void 0 ? a(n) : 1;
1233
- },
1234
- background: (n) => {
1235
- const a = n.specVersion === e ? r.background : t.background;
1236
- return a !== void 0 ? a(n) : void 0;
1237
- },
1238
- secondBackground: (n) => {
1239
- const a = n.specVersion === e ? r.secondBackground : t.secondBackground;
1240
- return a !== void 0 ? a(n) : void 0;
1241
- },
1242
- contrastCurve: (n) => {
1243
- const a = n.specVersion === e ? r.contrastCurve : t.contrastCurve;
1244
- return a !== void 0 ? a(n) : void 0;
1245
- },
1246
- toneDeltaPair: (n) => {
1247
- const a = n.specVersion === e ? r.toneDeltaPair : t.toneDeltaPair;
1248
- return a !== void 0 ? a(n) : void 0;
1249
- }
1250
- });
1251
- }
1252
- class c {
1253
- /**
1254
- * Create a DynamicColor defined by a TonalPalette and HCT tone.
1255
- *
1256
- * @param args Functions with DynamicScheme as input. Must provide a palette
1257
- * and tone. May provide a background DynamicColor and ToneDeltaPair.
1258
- */
1259
- static fromPalette(e) {
1260
- return new c(e.name ?? "", e.palette, e.tone ?? c.getInitialToneFromBackground(e.background), e.isBackground ?? !1, e.chromaMultiplier, e.background, e.secondBackground, e.contrastCurve, e.toneDeltaPair);
1261
- }
1262
- static getInitialToneFromBackground(e) {
1263
- return e === void 0 ? (r) => 50 : (r) => e(r) ? e(r).getTone(r) : 50;
1264
- }
1265
- /**
1266
- * The base constructor for DynamicColor.
1267
- *
1268
- * _Strongly_ prefer using one of the convenience constructors. This class is
1269
- * arguably too flexible to ensure it can support any scenario. Functional
1270
- * arguments allow overriding without risks that come with subclasses.
1271
- *
1272
- * For example, the default behavior of adjust tone at max contrast
1273
- * to be at a 7.0 ratio with its background is principled and
1274
- * matches accessibility guidance. That does not mean it's the desired
1275
- * approach for _every_ design system, and every color pairing,
1276
- * always, in every case.
1277
- *
1278
- * @param name The name of the dynamic color. Defaults to empty.
1279
- * @param palette Function that provides a TonalPalette given DynamicScheme. A
1280
- * TonalPalette is defined by a hue and chroma, so this replaces the need
1281
- * to specify hue/chroma. By providing a tonal palette, when contrast
1282
- * adjustments are made, intended chroma can be preserved.
1283
- * @param tone Function that provides a tone, given a DynamicScheme.
1284
- * @param isBackground Whether this dynamic color is a background, with some
1285
- * other color as the foreground. Defaults to false.
1286
- * @param chromaMultiplier A factor that multiplies the chroma for this color.
1287
- * @param background The background of the dynamic color (as a function of a
1288
- * `DynamicScheme`), if it exists.
1289
- * @param secondBackground A second background of the dynamic color (as a
1290
- * function of a `DynamicScheme`), if it exists.
1291
- * @param contrastCurve A `ContrastCurve` object specifying how its contrast
1292
- * against its background should behave in various contrast levels
1293
- * options.
1294
- * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta
1295
- * constraint between two colors. One of them must be the color being
1296
- * constructed.
1297
- */
1298
- constructor(e, r, n, a, s, i, u, l, f) {
1299
- if (this.name = e, this.palette = r, this.tone = n, this.isBackground = a, this.chromaMultiplier = s, this.background = i, this.secondBackground = u, this.contrastCurve = l, this.toneDeltaPair = f, this.hctCache = /* @__PURE__ */ new Map(), !i && u)
1300
- throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);
1301
- if (!i && l)
1302
- throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);
1303
- if (i && !l)
1304
- throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`);
1305
- }
1306
- /**
1307
- * Returns a deep copy of this DynamicColor.
1308
- */
1309
- clone() {
1310
- return c.fromPalette({
1311
- name: this.name,
1312
- palette: this.palette,
1313
- tone: this.tone,
1314
- isBackground: this.isBackground,
1315
- chromaMultiplier: this.chromaMultiplier,
1316
- background: this.background,
1317
- secondBackground: this.secondBackground,
1318
- contrastCurve: this.contrastCurve,
1319
- toneDeltaPair: this.toneDeltaPair
1320
- });
1321
- }
1322
- /**
1323
- * Clears the cache of HCT values for this color. For testing or debugging
1324
- * purposes.
1325
- */
1326
- clearCache() {
1327
- this.hctCache.clear();
1328
- }
1329
- /**
1330
- * Returns a ARGB integer (i.e. a hex code).
1331
- *
1332
- * @param scheme Defines the conditions of the user interface, for example,
1333
- * whether or not it is dark mode or light mode, and what the desired
1334
- * contrast level is.
1335
- */
1336
- getArgb(e) {
1337
- return this.getHct(e).toInt();
1338
- }
1339
- /**
1340
- * Returns a color, expressed in the HCT color space, that this
1341
- * DynamicColor is under the conditions in scheme.
1342
- *
1343
- * @param scheme Defines the conditions of the user interface, for example,
1344
- * whether or not it is dark mode or light mode, and what the desired
1345
- * contrast level is.
1346
- */
1347
- getHct(e) {
1348
- const r = this.hctCache.get(e);
1349
- if (r != null)
1350
- return r;
1351
- const n = Ae(e.specVersion).getHct(e, this);
1352
- return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(e, n), n;
1353
- }
1354
- /**
1355
- * Returns a tone, T in the HCT color space, that this DynamicColor is under
1356
- * the conditions in scheme.
1357
- *
1358
- * @param scheme Defines the conditions of the user interface, for example,
1359
- * whether or not it is dark mode or light mode, and what the desired
1360
- * contrast level is.
1361
- */
1362
- getTone(e) {
1363
- return Ae(e.specVersion).getTone(e, this);
1364
- }
1365
- /**
1366
- * Given a background tone, finds a foreground tone, while ensuring they reach
1367
- * a contrast ratio that is as close to [ratio] as possible.
1368
- *
1369
- * @param bgTone Tone in HCT. Range is 0 to 100, undefined behavior when it
1370
- * falls outside that range.
1371
- * @param ratio The contrast ratio desired between bgTone and the return
1372
- * value.
1373
- */
1374
- static foregroundTone(e, r) {
1375
- const n = A.lighterUnsafe(e, r), a = A.darkerUnsafe(e, r), s = A.ratioOfTones(n, e), i = A.ratioOfTones(a, e);
1376
- if (c.tonePrefersLightForeground(e)) {
1377
- const l = Math.abs(s - i) < 0.1 && s < r && i < r;
1378
- return s >= r || s >= i || l ? n : a;
1379
- } else
1380
- return i >= r || i >= s ? a : n;
1381
- }
1382
- /**
1383
- * Returns whether [tone] prefers a light foreground.
1384
- *
1385
- * People prefer white foregrounds on ~T60-70. Observed over time, and also
1386
- * by Andrew Somers during research for APCA.
1387
- *
1388
- * T60 used as to create the smallest discontinuity possible when skipping
1389
- * down to T49 in order to ensure light foregrounds.
1390
- * Since `tertiaryContainer` in dark monochrome scheme requires a tone of
1391
- * 60, it should not be adjusted. Therefore, 60 is excluded here.
1392
- */
1393
- static tonePrefersLightForeground(e) {
1394
- return Math.round(e) < 60;
1395
- }
1396
- /**
1397
- * Returns whether [tone] can reach a contrast ratio of 4.5 with a lighter
1398
- * color.
1399
- */
1400
- static toneAllowsLightForeground(e) {
1401
- return Math.round(e) <= 49;
1402
- }
1403
- /**
1404
- * Adjusts a tone such that white has 4.5 contrast, if the tone is
1405
- * reasonably close to supporting it.
1406
- */
1407
- static enableLightForeground(e) {
1408
- return c.tonePrefersLightForeground(e) && !c.toneAllowsLightForeground(e) ? 49 : e;
1409
- }
1410
- }
1411
- class sr {
1412
- getHct(e, r) {
1413
- const n = r.getTone(e);
1414
- return r.palette(e).getHct(n);
1415
- }
1416
- getTone(e, r) {
1417
- const n = e.contrastLevel < 0, a = r.toneDeltaPair ? r.toneDeltaPair(e) : void 0;
1418
- if (a) {
1419
- const s = a.roleA, i = a.roleB, u = a.delta, l = a.polarity, f = a.stayTogether, d = l === "nearer" || l === "lighter" && !e.isDark || l === "darker" && e.isDark, S = d ? s : i, p = d ? i : s, D = r.name === S.name, m = e.isDark ? 1 : -1;
1420
- let g = S.tone(e), P = p.tone(e);
1421
- if (r.background && S.contrastCurve && p.contrastCurve) {
1422
- const M = r.background(e), B = S.contrastCurve(e), R = p.contrastCurve(e);
1423
- if (M && B && R) {
1424
- const V = M.getTone(e), N = B.get(e.contrastLevel), E = R.get(e.contrastLevel);
1425
- A.ratioOfTones(V, g) < N && (g = c.foregroundTone(V, N)), A.ratioOfTones(V, P) < E && (P = c.foregroundTone(V, E)), n && (g = c.foregroundTone(V, N), P = c.foregroundTone(V, E));
1426
- }
1427
- }
1428
- return (P - g) * m < u && (P = H(0, 100, g + u * m), (P - g) * m >= u || (g = H(0, 100, P - u * m))), 50 <= g && g < 60 ? m > 0 ? (g = 60, P = Math.max(P, g + u * m)) : (g = 49, P = Math.min(P, g + u * m)) : 50 <= P && P < 60 && (f ? m > 0 ? (g = 60, P = Math.max(P, g + u * m)) : (g = 49, P = Math.min(P, g + u * m)) : m > 0 ? P = 60 : P = 49), D ? g : P;
1429
- } else {
1430
- let s = r.tone(e);
1431
- if (r.background == null || r.background(e) === void 0 || r.contrastCurve == null || r.contrastCurve(e) === void 0)
1432
- return s;
1433
- const i = r.background(e).getTone(e), u = r.contrastCurve(e).get(e.contrastLevel);
1434
- if (A.ratioOfTones(i, s) >= u || (s = c.foregroundTone(i, u)), n && (s = c.foregroundTone(i, u)), r.isBackground && 50 <= s && s < 60 && (A.ratioOfTones(49, i) >= u ? s = 49 : s = 60), r.secondBackground == null || r.secondBackground(e) === void 0)
1435
- return s;
1436
- const [l, f] = [r.background, r.secondBackground], [d, S] = [l(e).getTone(e), f(e).getTone(e)], [p, D] = [Math.max(d, S), Math.min(d, S)];
1437
- if (A.ratioOfTones(p, s) >= u && A.ratioOfTones(D, s) >= u)
1438
- return s;
1439
- const m = A.lighter(p, u), g = A.darker(D, u), P = [];
1440
- return m !== -1 && P.push(m), g !== -1 && P.push(g), c.tonePrefersLightForeground(d) || c.tonePrefersLightForeground(S) ? m < 0 ? 100 : m : P.length === 1 ? P[0] : g < 0 ? 0 : g;
1441
- }
1442
- }
1443
- }
1444
- class cr {
1445
- getHct(e, r) {
1446
- const n = r.palette(e), a = r.getTone(e), s = n.hue, i = n.chroma * (r.chromaMultiplier ? r.chromaMultiplier(e) : 1);
1447
- return b.from(s, i, a);
1448
- }
1449
- getTone(e, r) {
1450
- const n = r.toneDeltaPair ? r.toneDeltaPair(e) : void 0;
1451
- if (n) {
1452
- const a = n.roleA, s = n.roleB, i = n.polarity, u = n.constraint, l = i === "darker" || i === "relative_lighter" && e.isDark || i === "relative_darker" && !e.isDark ? -n.delta : n.delta, f = r.name === a.name, d = f ? a : s, S = f ? s : a;
1453
- let p = d.tone(e), D = S.getTone(e);
1454
- const m = l * (f ? 1 : -1);
1455
- if (u === "exact" ? p = H(0, 100, D + m) : u === "nearer" ? m > 0 ? p = H(0, 100, H(D, D + m, p)) : p = H(0, 100, H(D + m, D, p)) : u === "farther" && (m > 0 ? p = H(D + m, 100, p) : p = H(0, D + m, p)), r.background && r.contrastCurve) {
1456
- const g = r.background(e), P = r.contrastCurve(e);
1457
- if (g && P) {
1458
- const M = g.getTone(e), B = P.get(e.contrastLevel);
1459
- p = A.ratioOfTones(M, p) >= B && e.contrastLevel >= 0 ? p : c.foregroundTone(M, B);
1460
- }
1461
- }
1462
- return r.isBackground && !r.name.endsWith("_fixed_dim") && (p >= 57 ? p = H(65, 100, p) : p = H(0, 49, p)), p;
1463
- } else {
1464
- let a = r.tone(e);
1465
- if (r.background == null || r.background(e) === void 0 || r.contrastCurve == null || r.contrastCurve(e) === void 0)
1466
- return a;
1467
- const s = r.background(e).getTone(e), i = r.contrastCurve(e).get(e.contrastLevel);
1468
- if (a = A.ratioOfTones(s, a) >= i && e.contrastLevel >= 0 ? a : c.foregroundTone(s, i), r.isBackground && !r.name.endsWith("_fixed_dim") && (a >= 57 ? a = H(65, 100, a) : a = H(0, 49, a)), r.secondBackground == null || r.secondBackground(e) === void 0)
1469
- return a;
1470
- const [u, l] = [r.background, r.secondBackground], [f, d] = [u(e).getTone(e), l(e).getTone(e)], [S, p] = [Math.max(f, d), Math.min(f, d)];
1471
- if (A.ratioOfTones(S, a) >= i && A.ratioOfTones(p, a) >= i)
1472
- return a;
1473
- const D = A.lighter(S, i), m = A.darker(p, i), g = [];
1474
- return D !== -1 && g.push(D), m !== -1 && g.push(m), c.tonePrefersLightForeground(f) || c.tonePrefersLightForeground(d) ? D < 0 ? 100 : D : g.length === 1 ? g[0] : m < 0 ? 0 : m;
1475
- }
1476
- }
1477
- }
1478
- const ur = new sr(), lr = new cr();
1479
- function Ae(t) {
1480
- return t === "2025" ? lr : ur;
1481
- }
1482
- /**
1483
- * @license
1484
- * Copyright 2021 Google LLC
1485
- *
1486
- * Licensed under the Apache License, Version 2.0 (the "License");
1487
- * you may not use this file except in compliance with the License.
1488
- * You may obtain a copy of the License at
1489
- *
1490
- * http://www.apache.org/licenses/LICENSE-2.0
1491
- *
1492
- * Unless required by applicable law or agreed to in writing, software
1493
- * distributed under the License is distributed on an "AS IS" BASIS,
1494
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1495
- * See the License for the specific language governing permissions and
1496
- * limitations under the License.
1497
- */
1498
- class G {
1499
- /**
1500
- * @param argb ARGB representation of a color
1501
- * @return Tones matching that color's hue and chroma.
1502
- */
1503
- static fromInt(e) {
1504
- const r = b.fromInt(e);
1505
- return G.fromHct(r);
1506
- }
1507
- /**
1508
- * @param hct Hct
1509
- * @return Tones matching that color's hue and chroma.
1510
- */
1511
- static fromHct(e) {
1512
- return new G(e.hue, e.chroma, e);
1513
- }
1514
- /**
1515
- * @param hue HCT hue
1516
- * @param chroma HCT chroma
1517
- * @return Tones matching hue and chroma.
1518
- */
1519
- static fromHueAndChroma(e, r) {
1520
- const n = new hr(e, r).create();
1521
- return new G(e, r, n);
1522
- }
1523
- constructor(e, r, n) {
1524
- this.hue = e, this.chroma = r, this.keyColor = n, this.cache = /* @__PURE__ */ new Map();
1525
- }
1526
- /**
1527
- * @param tone HCT tone, measured from 0 to 100.
1528
- * @return ARGB representation of a color with that tone.
1529
- */
1530
- tone(e) {
1531
- let r = this.cache.get(e);
1532
- return r === void 0 && (e == 99 && b.isYellow(this.hue) ? r = this.averageArgb(this.tone(98), this.tone(100)) : r = b.from(this.hue, this.chroma, e).toInt(), this.cache.set(e, r)), r;
1533
- }
1534
- /**
1535
- * @param tone HCT tone.
1536
- * @return HCT representation of a color with that tone.
1537
- */
1538
- getHct(e) {
1539
- return b.fromInt(this.tone(e));
1540
- }
1541
- averageArgb(e, r) {
1542
- const n = e >>> 16 & 255, a = e >>> 8 & 255, s = e & 255, i = r >>> 16 & 255, u = r >>> 8 & 255, l = r & 255, f = Math.round((n + i) / 2), d = Math.round((a + u) / 2), S = Math.round((s + l) / 2);
1543
- return (255 << 24 | (f & 255) << 16 | (d & 255) << 8 | S & 255) >>> 0;
1544
- }
1545
- }
1546
- class hr {
1547
- constructor(e, r) {
1548
- this.hue = e, this.requestedChroma = r, this.chromaCache = /* @__PURE__ */ new Map(), this.maxChromaValue = 200;
1549
- }
1550
- /**
1551
- * Creates a key color from a [hue] and a [chroma].
1552
- * The key color is the first tone, starting from T50, matching the given hue
1553
- * and chroma.
1554
- *
1555
- * @return Key color [Hct]
1556
- */
1557
- create() {
1558
- let a = 0, s = 100;
1559
- for (; a < s; ) {
1560
- const i = Math.floor((a + s) / 2), u = this.maxChroma(i) < this.maxChroma(i + 1);
1561
- if (this.maxChroma(i) >= this.requestedChroma - 0.01)
1562
- if (Math.abs(a - 50) < Math.abs(s - 50))
1563
- s = i;
1564
- else {
1565
- if (a === i)
1566
- return b.from(this.hue, this.requestedChroma, a);
1567
- a = i;
1568
- }
1569
- else
1570
- u ? a = i + 1 : s = i;
1571
- }
1572
- return b.from(this.hue, this.requestedChroma, a);
1573
- }
1574
- // Find the maximum chroma for a given tone
1575
- maxChroma(e) {
1576
- if (this.chromaCache.has(e))
1577
- return this.chromaCache.get(e);
1578
- const r = b.from(this.hue, this.maxChromaValue, e).chroma;
1579
- return this.chromaCache.set(e, r), r;
1580
- }
1581
- }
1582
- /**
1583
- * @license
1584
- * Copyright 2023 Google LLC
1585
- *
1586
- * Licensed under the Apache License, Version 2.0 (the "License");
1587
- * you may not use this file except in compliance with the License.
1588
- * You may obtain a copy of the License at
1589
- *
1590
- * http://www.apache.org/licenses/LICENSE-2.0
1591
- *
1592
- * Unless required by applicable law or agreed to in writing, software
1593
- * distributed under the License is distributed on an "AS IS" BASIS,
1594
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1595
- * See the License for the specific language governing permissions and
1596
- * limitations under the License.
1597
- */
1598
- class y {
1599
- /**
1600
- * Creates a `ContrastCurve` object.
1601
- *
1602
- * @param low Value for contrast level -1.0
1603
- * @param normal Value for contrast level 0.0
1604
- * @param medium Value for contrast level 0.5
1605
- * @param high Value for contrast level 1.0
1606
- */
1607
- constructor(e, r, n, a) {
1608
- this.low = e, this.normal = r, this.medium = n, this.high = a;
1609
- }
1610
- /**
1611
- * Returns the value at a given contrast level.
1612
- *
1613
- * @param contrastLevel The contrast level. 0.0 is the default (normal); -1.0
1614
- * is the lowest; 1.0 is the highest.
1615
- * @return The value. For contrast ratios, a number between 1.0 and 21.0.
1616
- */
1617
- get(e) {
1618
- return e <= -1 ? this.low : e < 0 ? se(this.low, this.normal, (e - -1) / 1) : e < 0.5 ? se(this.normal, this.medium, (e - 0) / 0.5) : e < 1 ? se(this.medium, this.high, (e - 0.5) / 0.5) : this.high;
1619
- }
1620
- }
1621
- /**
1622
- * @license
1623
- * Copyright 2023 Google LLC
1624
- *
1625
- * Licensed under the Apache License, Version 2.0 (the "License");
1626
- * you may not use this file except in compliance with the License.
1627
- * You may obtain a copy of the License at
1628
- *
1629
- * http://www.apache.org/licenses/LICENSE-2.0
1630
- *
1631
- * Unless required by applicable law or agreed to in writing, software
1632
- * distributed under the License is distributed on an "AS IS" BASIS,
1633
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1634
- * See the License for the specific language governing permissions and
1635
- * limitations under the License.
1636
- */
1637
- class x {
1638
- /**
1639
- * Documents a constraint in tone distance between two DynamicColors.
1640
- *
1641
- * The polarity is an adjective that describes "A", compared to "B".
1642
- *
1643
- * For instance, ToneDeltaPair(A, B, 15, 'darker', 'exact') states that
1644
- * A's tone should be exactly 15 darker than B's.
1645
- *
1646
- * 'relative_darker' and 'relative_lighter' describes the tone adjustment
1647
- * relative to the surface color trend (white in light mode; black in dark
1648
- * mode). For instance, ToneDeltaPair(A, B, 10, 'relative_lighter',
1649
- * 'farther') states that A should be at least 10 lighter than B in light
1650
- * mode, and at least 10 darker than B in dark mode.
1651
- *
1652
- * @param roleA The first role in a pair.
1653
- * @param roleB The second role in a pair.
1654
- * @param delta Required difference between tones. Absolute value, negative
1655
- * values have undefined behavior.
1656
- * @param polarity The relative relation between tones of roleA and roleB,
1657
- * as described above.
1658
- * @param constraint How to fulfill the tone delta pair constraint.
1659
- * @param stayTogether Whether these two roles should stay on the same side
1660
- * of the "awkward zone" (T50-59). This is necessary for certain cases where
1661
- * one role has two backgrounds.
1662
- */
1663
- constructor(e, r, n, a, s, i) {
1664
- this.roleA = e, this.roleB = r, this.delta = n, this.polarity = a, this.stayTogether = s, this.constraint = i, this.constraint = i ?? "exact";
1665
- }
1666
- }
1667
- /**
1668
- * @license
1669
- * Copyright 2022 Google LLC
1670
- *
1671
- * Licensed under the Apache License, Version 2.0 (the "License");
1672
- * you may not use this file except in compliance with the License.
1673
- * You may obtain a copy of the License at
1674
- *
1675
- * http://www.apache.org/licenses/LICENSE-2.0
1676
- *
1677
- * Unless required by applicable law or agreed to in writing, software
1678
- * distributed under the License is distributed on an "AS IS" BASIS,
1679
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1680
- * See the License for the specific language governing permissions and
1681
- * limitations under the License.
1682
- */
1683
- var h;
1684
- (function(t) {
1685
- t[t.MONOCHROME = 0] = "MONOCHROME", t[t.NEUTRAL = 1] = "NEUTRAL", t[t.TONAL_SPOT = 2] = "TONAL_SPOT", t[t.VIBRANT = 3] = "VIBRANT", t[t.EXPRESSIVE = 4] = "EXPRESSIVE", t[t.FIDELITY = 5] = "FIDELITY", t[t.CONTENT = 6] = "CONTENT", t[t.RAINBOW = 7] = "RAINBOW", t[t.FRUIT_SALAD = 8] = "FRUIT_SALAD";
1686
- })(h || (h = {}));
1687
- /**
1688
- * @license
1689
- * Copyright 2025 Google LLC
1690
- *
1691
- * Licensed under the Apache License, Version 2.0 (the "License");
1692
- * you may not use this file except in compliance with the License.
1693
- * You may obtain a copy of the License at
1694
- *
1695
- * http://www.apache.org/licenses/LICENSE-2.0
1696
- *
1697
- * Unless required by applicable law or agreed to in writing, software
1698
- * distributed under the License is distributed on an "AS IS" BASIS,
1699
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1700
- * See the License for the specific language governing permissions and
1701
- * limitations under the License.
1702
- */
1703
- function oe(t) {
1704
- return t.variant === h.FIDELITY || t.variant === h.CONTENT;
1705
- }
1706
- function I(t) {
1707
- return t.variant === h.MONOCHROME;
1708
- }
1709
- function fr(t, e, r, n) {
1710
- let a = r, s = b.from(t, e, r);
1711
- if (s.chroma < e) {
1712
- let i = s.chroma;
1713
- for (; s.chroma < e; ) {
1714
- a += n ? -1 : 1;
1715
- const u = b.from(t, e, a);
1716
- if (i > u.chroma || Math.abs(u.chroma - e) < 0.4)
1717
- break;
1718
- const l = Math.abs(u.chroma - e), f = Math.abs(s.chroma - e);
1719
- l < f && (s = u), i = Math.max(i, u.chroma);
1720
- }
1721
- }
1722
- return a;
1723
- }
1724
- class dr {
1725
- ////////////////////////////////////////////////////////////////
1726
- // Main Palettes //
1727
- ////////////////////////////////////////////////////////////////
1728
- primaryPaletteKeyColor() {
1729
- return c.fromPalette({
1730
- name: "primary_palette_key_color",
1731
- palette: (e) => e.primaryPalette,
1732
- tone: (e) => e.primaryPalette.keyColor.tone
1733
- });
1734
- }
1735
- secondaryPaletteKeyColor() {
1736
- return c.fromPalette({
1737
- name: "secondary_palette_key_color",
1738
- palette: (e) => e.secondaryPalette,
1739
- tone: (e) => e.secondaryPalette.keyColor.tone
1740
- });
1741
- }
1742
- tertiaryPaletteKeyColor() {
1743
- return c.fromPalette({
1744
- name: "tertiary_palette_key_color",
1745
- palette: (e) => e.tertiaryPalette,
1746
- tone: (e) => e.tertiaryPalette.keyColor.tone
1747
- });
1748
- }
1749
- neutralPaletteKeyColor() {
1750
- return c.fromPalette({
1751
- name: "neutral_palette_key_color",
1752
- palette: (e) => e.neutralPalette,
1753
- tone: (e) => e.neutralPalette.keyColor.tone
1754
- });
1755
- }
1756
- neutralVariantPaletteKeyColor() {
1757
- return c.fromPalette({
1758
- name: "neutral_variant_palette_key_color",
1759
- palette: (e) => e.neutralVariantPalette,
1760
- tone: (e) => e.neutralVariantPalette.keyColor.tone
1761
- });
1762
- }
1763
- errorPaletteKeyColor() {
1764
- return c.fromPalette({
1765
- name: "error_palette_key_color",
1766
- palette: (e) => e.errorPalette,
1767
- tone: (e) => e.errorPalette.keyColor.tone
1768
- });
1769
- }
1770
- ////////////////////////////////////////////////////////////////
1771
- // Surfaces [S] //
1772
- ////////////////////////////////////////////////////////////////
1773
- background() {
1774
- return c.fromPalette({
1775
- name: "background",
1776
- palette: (e) => e.neutralPalette,
1777
- tone: (e) => e.isDark ? 6 : 98,
1778
- isBackground: !0
1779
- });
1780
- }
1781
- onBackground() {
1782
- return c.fromPalette({
1783
- name: "on_background",
1784
- palette: (e) => e.neutralPalette,
1785
- tone: (e) => e.isDark ? 90 : 10,
1786
- background: (e) => this.background(),
1787
- contrastCurve: (e) => new y(3, 3, 4.5, 7)
1788
- });
1789
- }
1790
- surface() {
1791
- return c.fromPalette({
1792
- name: "surface",
1793
- palette: (e) => e.neutralPalette,
1794
- tone: (e) => e.isDark ? 6 : 98,
1795
- isBackground: !0
1796
- });
1797
- }
1798
- surfaceDim() {
1799
- return c.fromPalette({
1800
- name: "surface_dim",
1801
- palette: (e) => e.neutralPalette,
1802
- tone: (e) => e.isDark ? 6 : new y(87, 87, 80, 75).get(e.contrastLevel),
1803
- isBackground: !0
1804
- });
1805
- }
1806
- surfaceBright() {
1807
- return c.fromPalette({
1808
- name: "surface_bright",
1809
- palette: (e) => e.neutralPalette,
1810
- tone: (e) => e.isDark ? new y(24, 24, 29, 34).get(e.contrastLevel) : 98,
1811
- isBackground: !0
1812
- });
1813
- }
1814
- surfaceContainerLowest() {
1815
- return c.fromPalette({
1816
- name: "surface_container_lowest",
1817
- palette: (e) => e.neutralPalette,
1818
- tone: (e) => e.isDark ? new y(4, 4, 2, 0).get(e.contrastLevel) : 100,
1819
- isBackground: !0
1820
- });
1821
- }
1822
- surfaceContainerLow() {
1823
- return c.fromPalette({
1824
- name: "surface_container_low",
1825
- palette: (e) => e.neutralPalette,
1826
- tone: (e) => e.isDark ? new y(10, 10, 11, 12).get(e.contrastLevel) : new y(96, 96, 96, 95).get(e.contrastLevel),
1827
- isBackground: !0
1828
- });
1829
- }
1830
- surfaceContainer() {
1831
- return c.fromPalette({
1832
- name: "surface_container",
1833
- palette: (e) => e.neutralPalette,
1834
- tone: (e) => e.isDark ? new y(12, 12, 16, 20).get(e.contrastLevel) : new y(94, 94, 92, 90).get(e.contrastLevel),
1835
- isBackground: !0
1836
- });
1837
- }
1838
- surfaceContainerHigh() {
1839
- return c.fromPalette({
1840
- name: "surface_container_high",
1841
- palette: (e) => e.neutralPalette,
1842
- tone: (e) => e.isDark ? new y(17, 17, 21, 25).get(e.contrastLevel) : new y(92, 92, 88, 85).get(e.contrastLevel),
1843
- isBackground: !0
1844
- });
1845
- }
1846
- surfaceContainerHighest() {
1847
- return c.fromPalette({
1848
- name: "surface_container_highest",
1849
- palette: (e) => e.neutralPalette,
1850
- tone: (e) => e.isDark ? new y(22, 22, 26, 30).get(e.contrastLevel) : new y(90, 90, 84, 80).get(e.contrastLevel),
1851
- isBackground: !0
1852
- });
1853
- }
1854
- onSurface() {
1855
- return c.fromPalette({
1856
- name: "on_surface",
1857
- palette: (e) => e.neutralPalette,
1858
- tone: (e) => e.isDark ? 90 : 10,
1859
- background: (e) => this.highestSurface(e),
1860
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
1861
- });
1862
- }
1863
- surfaceVariant() {
1864
- return c.fromPalette({
1865
- name: "surface_variant",
1866
- palette: (e) => e.neutralVariantPalette,
1867
- tone: (e) => e.isDark ? 30 : 90,
1868
- isBackground: !0
1869
- });
1870
- }
1871
- onSurfaceVariant() {
1872
- return c.fromPalette({
1873
- name: "on_surface_variant",
1874
- palette: (e) => e.neutralVariantPalette,
1875
- tone: (e) => e.isDark ? 80 : 30,
1876
- background: (e) => this.highestSurface(e),
1877
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
1878
- });
1879
- }
1880
- inverseSurface() {
1881
- return c.fromPalette({
1882
- name: "inverse_surface",
1883
- palette: (e) => e.neutralPalette,
1884
- tone: (e) => e.isDark ? 90 : 20,
1885
- isBackground: !0
1886
- });
1887
- }
1888
- inverseOnSurface() {
1889
- return c.fromPalette({
1890
- name: "inverse_on_surface",
1891
- palette: (e) => e.neutralPalette,
1892
- tone: (e) => e.isDark ? 20 : 95,
1893
- background: (e) => this.inverseSurface(),
1894
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
1895
- });
1896
- }
1897
- outline() {
1898
- return c.fromPalette({
1899
- name: "outline",
1900
- palette: (e) => e.neutralVariantPalette,
1901
- tone: (e) => e.isDark ? 60 : 50,
1902
- background: (e) => this.highestSurface(e),
1903
- contrastCurve: (e) => new y(1.5, 3, 4.5, 7)
1904
- });
1905
- }
1906
- outlineVariant() {
1907
- return c.fromPalette({
1908
- name: "outline_variant",
1909
- palette: (e) => e.neutralVariantPalette,
1910
- tone: (e) => e.isDark ? 30 : 80,
1911
- background: (e) => this.highestSurface(e),
1912
- contrastCurve: (e) => new y(1, 1, 3, 4.5)
1913
- });
1914
- }
1915
- shadow() {
1916
- return c.fromPalette({
1917
- name: "shadow",
1918
- palette: (e) => e.neutralPalette,
1919
- tone: (e) => 0
1920
- });
1921
- }
1922
- scrim() {
1923
- return c.fromPalette({
1924
- name: "scrim",
1925
- palette: (e) => e.neutralPalette,
1926
- tone: (e) => 0
1927
- });
1928
- }
1929
- surfaceTint() {
1930
- return c.fromPalette({
1931
- name: "surface_tint",
1932
- palette: (e) => e.primaryPalette,
1933
- tone: (e) => e.isDark ? 80 : 40,
1934
- isBackground: !0
1935
- });
1936
- }
1937
- ////////////////////////////////////////////////////////////////
1938
- // Primary [P]. //
1939
- ////////////////////////////////////////////////////////////////
1940
- primary() {
1941
- return c.fromPalette({
1942
- name: "primary",
1943
- palette: (e) => e.primaryPalette,
1944
- tone: (e) => I(e) ? e.isDark ? 100 : 0 : e.isDark ? 80 : 40,
1945
- isBackground: !0,
1946
- background: (e) => this.highestSurface(e),
1947
- contrastCurve: (e) => new y(3, 4.5, 7, 7),
1948
- toneDeltaPair: (e) => new x(this.primaryContainer(), this.primary(), 10, "nearer", !1)
1949
- });
1950
- }
1951
- primaryDim() {
1952
- }
1953
- onPrimary() {
1954
- return c.fromPalette({
1955
- name: "on_primary",
1956
- palette: (e) => e.primaryPalette,
1957
- tone: (e) => I(e) ? e.isDark ? 10 : 90 : e.isDark ? 20 : 100,
1958
- background: (e) => this.primary(),
1959
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
1960
- });
1961
- }
1962
- primaryContainer() {
1963
- return c.fromPalette({
1964
- name: "primary_container",
1965
- palette: (e) => e.primaryPalette,
1966
- tone: (e) => oe(e) ? e.sourceColorHct.tone : I(e) ? e.isDark ? 85 : 25 : e.isDark ? 30 : 90,
1967
- isBackground: !0,
1968
- background: (e) => this.highestSurface(e),
1969
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
1970
- toneDeltaPair: (e) => new x(this.primaryContainer(), this.primary(), 10, "nearer", !1)
1971
- });
1972
- }
1973
- onPrimaryContainer() {
1974
- return c.fromPalette({
1975
- name: "on_primary_container",
1976
- palette: (e) => e.primaryPalette,
1977
- tone: (e) => oe(e) ? c.foregroundTone(this.primaryContainer().tone(e), 4.5) : I(e) ? e.isDark ? 0 : 100 : e.isDark ? 90 : 30,
1978
- background: (e) => this.primaryContainer(),
1979
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
1980
- });
1981
- }
1982
- inversePrimary() {
1983
- return c.fromPalette({
1984
- name: "inverse_primary",
1985
- palette: (e) => e.primaryPalette,
1986
- tone: (e) => e.isDark ? 40 : 80,
1987
- background: (e) => this.inverseSurface(),
1988
- contrastCurve: (e) => new y(3, 4.5, 7, 7)
1989
- });
1990
- }
1991
- /////////////////////////////////////////////////////////////////
1992
- // Secondary [Q]. //
1993
- /////////////////////////////////////////////////////////////////
1994
- secondary() {
1995
- return c.fromPalette({
1996
- name: "secondary",
1997
- palette: (e) => e.secondaryPalette,
1998
- tone: (e) => e.isDark ? 80 : 40,
1999
- isBackground: !0,
2000
- background: (e) => this.highestSurface(e),
2001
- contrastCurve: (e) => new y(3, 4.5, 7, 7),
2002
- toneDeltaPair: (e) => new x(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
2003
- });
2004
- }
2005
- secondaryDim() {
2006
- }
2007
- onSecondary() {
2008
- return c.fromPalette({
2009
- name: "on_secondary",
2010
- palette: (e) => e.secondaryPalette,
2011
- tone: (e) => I(e) ? e.isDark ? 10 : 100 : e.isDark ? 20 : 100,
2012
- background: (e) => this.secondary(),
2013
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2014
- });
2015
- }
2016
- secondaryContainer() {
2017
- return c.fromPalette({
2018
- name: "secondary_container",
2019
- palette: (e) => e.secondaryPalette,
2020
- tone: (e) => {
2021
- const r = e.isDark ? 30 : 90;
2022
- return I(e) ? e.isDark ? 30 : 85 : oe(e) ? fr(e.secondaryPalette.hue, e.secondaryPalette.chroma, r, !e.isDark) : r;
2023
- },
2024
- isBackground: !0,
2025
- background: (e) => this.highestSurface(e),
2026
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2027
- toneDeltaPair: (e) => new x(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
2028
- });
2029
- }
2030
- onSecondaryContainer() {
2031
- return c.fromPalette({
2032
- name: "on_secondary_container",
2033
- palette: (e) => e.secondaryPalette,
2034
- tone: (e) => I(e) ? e.isDark ? 90 : 10 : oe(e) ? c.foregroundTone(this.secondaryContainer().tone(e), 4.5) : e.isDark ? 90 : 30,
2035
- background: (e) => this.secondaryContainer(),
2036
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2037
- });
2038
- }
2039
- /////////////////////////////////////////////////////////////////
2040
- // Tertiary [T]. //
2041
- /////////////////////////////////////////////////////////////////
2042
- tertiary() {
2043
- return c.fromPalette({
2044
- name: "tertiary",
2045
- palette: (e) => e.tertiaryPalette,
2046
- tone: (e) => I(e) ? e.isDark ? 90 : 25 : e.isDark ? 80 : 40,
2047
- isBackground: !0,
2048
- background: (e) => this.highestSurface(e),
2049
- contrastCurve: (e) => new y(3, 4.5, 7, 7),
2050
- toneDeltaPair: (e) => new x(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
2051
- });
2052
- }
2053
- tertiaryDim() {
2054
- }
2055
- onTertiary() {
2056
- return c.fromPalette({
2057
- name: "on_tertiary",
2058
- palette: (e) => e.tertiaryPalette,
2059
- tone: (e) => I(e) ? e.isDark ? 10 : 90 : e.isDark ? 20 : 100,
2060
- background: (e) => this.tertiary(),
2061
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2062
- });
2063
- }
2064
- tertiaryContainer() {
2065
- return c.fromPalette({
2066
- name: "tertiary_container",
2067
- palette: (e) => e.tertiaryPalette,
2068
- tone: (e) => {
2069
- if (I(e))
2070
- return e.isDark ? 60 : 49;
2071
- if (!oe(e))
2072
- return e.isDark ? 30 : 90;
2073
- const r = e.tertiaryPalette.getHct(e.sourceColorHct.tone);
2074
- return we.fixIfDisliked(r).tone;
2075
- },
2076
- isBackground: !0,
2077
- background: (e) => this.highestSurface(e),
2078
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2079
- toneDeltaPair: (e) => new x(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
2080
- });
2081
- }
2082
- onTertiaryContainer() {
2083
- return c.fromPalette({
2084
- name: "on_tertiary_container",
2085
- palette: (e) => e.tertiaryPalette,
2086
- tone: (e) => I(e) ? e.isDark ? 0 : 100 : oe(e) ? c.foregroundTone(this.tertiaryContainer().tone(e), 4.5) : e.isDark ? 90 : 30,
2087
- background: (e) => this.tertiaryContainer(),
2088
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2089
- });
2090
- }
2091
- //////////////////////////////////////////////////////////////////
2092
- // Error [E]. //
2093
- //////////////////////////////////////////////////////////////////
2094
- error() {
2095
- return c.fromPalette({
2096
- name: "error",
2097
- palette: (e) => e.errorPalette,
2098
- tone: (e) => e.isDark ? 80 : 40,
2099
- isBackground: !0,
2100
- background: (e) => this.highestSurface(e),
2101
- contrastCurve: (e) => new y(3, 4.5, 7, 7),
2102
- toneDeltaPair: (e) => new x(this.errorContainer(), this.error(), 10, "nearer", !1)
2103
- });
2104
- }
2105
- errorDim() {
2106
- }
2107
- onError() {
2108
- return c.fromPalette({
2109
- name: "on_error",
2110
- palette: (e) => e.errorPalette,
2111
- tone: (e) => e.isDark ? 20 : 100,
2112
- background: (e) => this.error(),
2113
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2114
- });
2115
- }
2116
- errorContainer() {
2117
- return c.fromPalette({
2118
- name: "error_container",
2119
- palette: (e) => e.errorPalette,
2120
- tone: (e) => e.isDark ? 30 : 90,
2121
- isBackground: !0,
2122
- background: (e) => this.highestSurface(e),
2123
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2124
- toneDeltaPair: (e) => new x(this.errorContainer(), this.error(), 10, "nearer", !1)
2125
- });
2126
- }
2127
- onErrorContainer() {
2128
- return c.fromPalette({
2129
- name: "on_error_container",
2130
- palette: (e) => e.errorPalette,
2131
- tone: (e) => I(e) ? e.isDark ? 90 : 10 : e.isDark ? 90 : 30,
2132
- background: (e) => this.errorContainer(),
2133
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2134
- });
2135
- }
2136
- //////////////////////////////////////////////////////////////////
2137
- // Primary Fixed [PF] //
2138
- //////////////////////////////////////////////////////////////////
2139
- primaryFixed() {
2140
- return c.fromPalette({
2141
- name: "primary_fixed",
2142
- palette: (e) => e.primaryPalette,
2143
- tone: (e) => I(e) ? 40 : 90,
2144
- isBackground: !0,
2145
- background: (e) => this.highestSurface(e),
2146
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2147
- toneDeltaPair: (e) => new x(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
2148
- });
2149
- }
2150
- primaryFixedDim() {
2151
- return c.fromPalette({
2152
- name: "primary_fixed_dim",
2153
- palette: (e) => e.primaryPalette,
2154
- tone: (e) => I(e) ? 30 : 80,
2155
- isBackground: !0,
2156
- background: (e) => this.highestSurface(e),
2157
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2158
- toneDeltaPair: (e) => new x(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
2159
- });
2160
- }
2161
- onPrimaryFixed() {
2162
- return c.fromPalette({
2163
- name: "on_primary_fixed",
2164
- palette: (e) => e.primaryPalette,
2165
- tone: (e) => I(e) ? 100 : 10,
2166
- background: (e) => this.primaryFixedDim(),
2167
- secondBackground: (e) => this.primaryFixed(),
2168
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2169
- });
2170
- }
2171
- onPrimaryFixedVariant() {
2172
- return c.fromPalette({
2173
- name: "on_primary_fixed_variant",
2174
- palette: (e) => e.primaryPalette,
2175
- tone: (e) => I(e) ? 90 : 30,
2176
- background: (e) => this.primaryFixedDim(),
2177
- secondBackground: (e) => this.primaryFixed(),
2178
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2179
- });
2180
- }
2181
- ///////////////////////////////////////////////////////////////////
2182
- // Secondary Fixed [QF] //
2183
- ///////////////////////////////////////////////////////////////////
2184
- secondaryFixed() {
2185
- return c.fromPalette({
2186
- name: "secondary_fixed",
2187
- palette: (e) => e.secondaryPalette,
2188
- tone: (e) => I(e) ? 80 : 90,
2189
- isBackground: !0,
2190
- background: (e) => this.highestSurface(e),
2191
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2192
- toneDeltaPair: (e) => new x(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
2193
- });
2194
- }
2195
- secondaryFixedDim() {
2196
- return c.fromPalette({
2197
- name: "secondary_fixed_dim",
2198
- palette: (e) => e.secondaryPalette,
2199
- tone: (e) => I(e) ? 70 : 80,
2200
- isBackground: !0,
2201
- background: (e) => this.highestSurface(e),
2202
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2203
- toneDeltaPair: (e) => new x(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
2204
- });
2205
- }
2206
- onSecondaryFixed() {
2207
- return c.fromPalette({
2208
- name: "on_secondary_fixed",
2209
- palette: (e) => e.secondaryPalette,
2210
- tone: (e) => 10,
2211
- background: (e) => this.secondaryFixedDim(),
2212
- secondBackground: (e) => this.secondaryFixed(),
2213
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2214
- });
2215
- }
2216
- onSecondaryFixedVariant() {
2217
- return c.fromPalette({
2218
- name: "on_secondary_fixed_variant",
2219
- palette: (e) => e.secondaryPalette,
2220
- tone: (e) => I(e) ? 25 : 30,
2221
- background: (e) => this.secondaryFixedDim(),
2222
- secondBackground: (e) => this.secondaryFixed(),
2223
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2224
- });
2225
- }
2226
- /////////////////////////////////////////////////////////////////
2227
- // Tertiary Fixed [TF] //
2228
- /////////////////////////////////////////////////////////////////
2229
- tertiaryFixed() {
2230
- return c.fromPalette({
2231
- name: "tertiary_fixed",
2232
- palette: (e) => e.tertiaryPalette,
2233
- tone: (e) => I(e) ? 40 : 90,
2234
- isBackground: !0,
2235
- background: (e) => this.highestSurface(e),
2236
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2237
- toneDeltaPair: (e) => new x(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
2238
- });
2239
- }
2240
- tertiaryFixedDim() {
2241
- return c.fromPalette({
2242
- name: "tertiary_fixed_dim",
2243
- palette: (e) => e.tertiaryPalette,
2244
- tone: (e) => I(e) ? 30 : 80,
2245
- isBackground: !0,
2246
- background: (e) => this.highestSurface(e),
2247
- contrastCurve: (e) => new y(1, 1, 3, 4.5),
2248
- toneDeltaPair: (e) => new x(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
2249
- });
2250
- }
2251
- onTertiaryFixed() {
2252
- return c.fromPalette({
2253
- name: "on_tertiary_fixed",
2254
- palette: (e) => e.tertiaryPalette,
2255
- tone: (e) => I(e) ? 100 : 10,
2256
- background: (e) => this.tertiaryFixedDim(),
2257
- secondBackground: (e) => this.tertiaryFixed(),
2258
- contrastCurve: (e) => new y(4.5, 7, 11, 21)
2259
- });
2260
- }
2261
- onTertiaryFixedVariant() {
2262
- return c.fromPalette({
2263
- name: "on_tertiary_fixed_variant",
2264
- palette: (e) => e.tertiaryPalette,
2265
- tone: (e) => I(e) ? 90 : 30,
2266
- background: (e) => this.tertiaryFixedDim(),
2267
- secondBackground: (e) => this.tertiaryFixed(),
2268
- contrastCurve: (e) => new y(3, 4.5, 7, 11)
2269
- });
2270
- }
2271
- ////////////////////////////////////////////////////////////////
2272
- // Other //
2273
- ////////////////////////////////////////////////////////////////
2274
- highestSurface(e) {
2275
- return e.isDark ? this.surfaceBright() : this.surfaceDim();
2276
- }
2277
- }
2278
- /**
2279
- * @license
2280
- * Copyright 2025 Google LLC
2281
- *
2282
- * Licensed under the Apache License, Version 2.0 (the "License");
2283
- * you may not use this file except in compliance with the License.
2284
- * You may obtain a copy of the License at
2285
- *
2286
- * http://www.apache.org/licenses/LICENSE-2.0
2287
- *
2288
- * Unless required by applicable law or agreed to in writing, software
2289
- * distributed under the License is distributed on an "AS IS" BASIS,
2290
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2291
- * See the License for the specific language governing permissions and
2292
- * limitations under the License.
2293
- */
2294
- function w(t, e = 0, r = 100, n = 1) {
2295
- let a = Re(t.hue, t.chroma * n, 100, !0);
2296
- return H(e, r, a);
2297
- }
2298
- function ee(t, e = 0, r = 100) {
2299
- let n = Re(t.hue, t.chroma, 0, !1);
2300
- return H(e, r, n);
2301
- }
2302
- function Re(t, e, r, n) {
2303
- let a = r, s = b.from(t, e, a);
2304
- for (; s.chroma < e && !(r < 0 || r > 100); ) {
2305
- r += n ? -1 : 1;
2306
- const i = b.from(t, e, r);
2307
- s.chroma < i.chroma && (s = i, a = r);
2308
- }
2309
- return a;
2310
- }
2311
- function k(t) {
2312
- return t === 1.5 ? new y(1.5, 1.5, 3, 5.5) : t === 3 ? new y(3, 3, 4.5, 7) : t === 4.5 ? new y(4.5, 4.5, 7, 11) : t === 6 ? new y(6, 6, 7, 11) : t === 7 ? new y(7, 7, 11, 21) : t === 9 ? new y(9, 9, 11, 21) : t === 11 ? new y(11, 11, 21, 21) : t === 21 ? new y(21, 21, 21, 21) : new y(t, t, 7, 21);
2313
- }
2314
- class pr extends dr {
2315
- ////////////////////////////////////////////////////////////////
2316
- // Surfaces [S] //
2317
- ////////////////////////////////////////////////////////////////
2318
- surface() {
2319
- const e = c.fromPalette({
2320
- name: "surface",
2321
- palette: (r) => r.neutralPalette,
2322
- tone: (r) => (super.surface().tone(r), r.platform === "phone" ? r.isDark ? 4 : b.isYellow(r.neutralPalette.hue) ? 99 : r.variant === h.VIBRANT ? 97 : 98 : 0),
2323
- isBackground: !0
2324
- });
2325
- return T(super.surface(), "2025", e);
2326
- }
2327
- surfaceDim() {
2328
- const e = c.fromPalette({
2329
- name: "surface_dim",
2330
- palette: (r) => r.neutralPalette,
2331
- tone: (r) => r.isDark ? 4 : b.isYellow(r.neutralPalette.hue) ? 90 : r.variant === h.VIBRANT ? 85 : 87,
2332
- isBackground: !0,
2333
- chromaMultiplier: (r) => {
2334
- if (!r.isDark) {
2335
- if (r.variant === h.NEUTRAL)
2336
- return 2.5;
2337
- if (r.variant === h.TONAL_SPOT)
2338
- return 1.7;
2339
- if (r.variant === h.EXPRESSIVE)
2340
- return b.isYellow(r.neutralPalette.hue) ? 2.7 : 1.75;
2341
- if (r.variant === h.VIBRANT)
2342
- return 1.36;
2343
- }
2344
- return 1;
2345
- }
2346
- });
2347
- return T(super.surfaceDim(), "2025", e);
2348
- }
2349
- surfaceBright() {
2350
- const e = c.fromPalette({
2351
- name: "surface_bright",
2352
- palette: (r) => r.neutralPalette,
2353
- tone: (r) => r.isDark ? 18 : b.isYellow(r.neutralPalette.hue) ? 99 : r.variant === h.VIBRANT ? 97 : 98,
2354
- isBackground: !0,
2355
- chromaMultiplier: (r) => {
2356
- if (r.isDark) {
2357
- if (r.variant === h.NEUTRAL)
2358
- return 2.5;
2359
- if (r.variant === h.TONAL_SPOT)
2360
- return 1.7;
2361
- if (r.variant === h.EXPRESSIVE)
2362
- return b.isYellow(r.neutralPalette.hue) ? 2.7 : 1.75;
2363
- if (r.variant === h.VIBRANT)
2364
- return 1.36;
2365
- }
2366
- return 1;
2367
- }
2368
- });
2369
- return T(super.surfaceBright(), "2025", e);
2370
- }
2371
- surfaceContainerLowest() {
2372
- const e = c.fromPalette({
2373
- name: "surface_container_lowest",
2374
- palette: (r) => r.neutralPalette,
2375
- tone: (r) => r.isDark ? 0 : 100,
2376
- isBackground: !0
2377
- });
2378
- return T(super.surfaceContainerLowest(), "2025", e);
2379
- }
2380
- surfaceContainerLow() {
2381
- const e = c.fromPalette({
2382
- name: "surface_container_low",
2383
- palette: (r) => r.neutralPalette,
2384
- tone: (r) => r.platform === "phone" ? r.isDark ? 6 : b.isYellow(r.neutralPalette.hue) ? 98 : r.variant === h.VIBRANT ? 95 : 96 : 15,
2385
- isBackground: !0,
2386
- chromaMultiplier: (r) => {
2387
- if (r.platform === "phone") {
2388
- if (r.variant === h.NEUTRAL)
2389
- return 1.3;
2390
- if (r.variant === h.TONAL_SPOT)
2391
- return 1.25;
2392
- if (r.variant === h.EXPRESSIVE)
2393
- return b.isYellow(r.neutralPalette.hue) ? 1.3 : 1.15;
2394
- if (r.variant === h.VIBRANT)
2395
- return 1.08;
2396
- }
2397
- return 1;
2398
- }
2399
- });
2400
- return T(super.surfaceContainerLow(), "2025", e);
2401
- }
2402
- surfaceContainer() {
2403
- const e = c.fromPalette({
2404
- name: "surface_container",
2405
- palette: (r) => r.neutralPalette,
2406
- tone: (r) => r.platform === "phone" ? r.isDark ? 9 : b.isYellow(r.neutralPalette.hue) ? 96 : r.variant === h.VIBRANT ? 92 : 94 : 20,
2407
- isBackground: !0,
2408
- chromaMultiplier: (r) => {
2409
- if (r.platform === "phone") {
2410
- if (r.variant === h.NEUTRAL)
2411
- return 1.6;
2412
- if (r.variant === h.TONAL_SPOT)
2413
- return 1.4;
2414
- if (r.variant === h.EXPRESSIVE)
2415
- return b.isYellow(r.neutralPalette.hue) ? 1.6 : 1.3;
2416
- if (r.variant === h.VIBRANT)
2417
- return 1.15;
2418
- }
2419
- return 1;
2420
- }
2421
- });
2422
- return T(super.surfaceContainer(), "2025", e);
2423
- }
2424
- surfaceContainerHigh() {
2425
- const e = c.fromPalette({
2426
- name: "surface_container_high",
2427
- palette: (r) => r.neutralPalette,
2428
- tone: (r) => r.platform === "phone" ? r.isDark ? 12 : b.isYellow(r.neutralPalette.hue) ? 94 : r.variant === h.VIBRANT ? 90 : 92 : 25,
2429
- isBackground: !0,
2430
- chromaMultiplier: (r) => {
2431
- if (r.platform === "phone") {
2432
- if (r.variant === h.NEUTRAL)
2433
- return 1.9;
2434
- if (r.variant === h.TONAL_SPOT)
2435
- return 1.5;
2436
- if (r.variant === h.EXPRESSIVE)
2437
- return b.isYellow(r.neutralPalette.hue) ? 1.95 : 1.45;
2438
- if (r.variant === h.VIBRANT)
2439
- return 1.22;
2440
- }
2441
- return 1;
2442
- }
2443
- });
2444
- return T(super.surfaceContainerHigh(), "2025", e);
2445
- }
2446
- surfaceContainerHighest() {
2447
- const e = c.fromPalette({
2448
- name: "surface_container_highest",
2449
- palette: (r) => r.neutralPalette,
2450
- tone: (r) => r.isDark ? 15 : b.isYellow(r.neutralPalette.hue) ? 92 : r.variant === h.VIBRANT ? 88 : 90,
2451
- isBackground: !0,
2452
- chromaMultiplier: (r) => r.variant === h.NEUTRAL ? 2.2 : r.variant === h.TONAL_SPOT ? 1.7 : r.variant === h.EXPRESSIVE ? b.isYellow(r.neutralPalette.hue) ? 2.3 : 1.6 : r.variant === h.VIBRANT ? 1.29 : 1
2453
- });
2454
- return T(super.surfaceContainerHighest(), "2025", e);
2455
- }
2456
- onSurface() {
2457
- const e = c.fromPalette({
2458
- name: "on_surface",
2459
- palette: (r) => r.neutralPalette,
2460
- tone: (r) => r.variant === h.VIBRANT ? w(r.neutralPalette, 0, 100, 1.1) : c.getInitialToneFromBackground((n) => n.platform === "phone" ? this.highestSurface(n) : this.surfaceContainerHigh())(r),
2461
- chromaMultiplier: (r) => {
2462
- if (r.platform === "phone") {
2463
- if (r.variant === h.NEUTRAL)
2464
- return 2.2;
2465
- if (r.variant === h.TONAL_SPOT)
2466
- return 1.7;
2467
- if (r.variant === h.EXPRESSIVE)
2468
- return b.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
2469
- }
2470
- return 1;
2471
- },
2472
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2473
- contrastCurve: (r) => r.isDark && r.platform === "phone" ? k(11) : k(9)
2474
- });
2475
- return T(super.onSurface(), "2025", e);
2476
- }
2477
- onSurfaceVariant() {
2478
- const e = c.fromPalette({
2479
- name: "on_surface_variant",
2480
- palette: (r) => r.neutralPalette,
2481
- chromaMultiplier: (r) => {
2482
- if (r.platform === "phone") {
2483
- if (r.variant === h.NEUTRAL)
2484
- return 2.2;
2485
- if (r.variant === h.TONAL_SPOT)
2486
- return 1.7;
2487
- if (r.variant === h.EXPRESSIVE)
2488
- return b.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
2489
- }
2490
- return 1;
2491
- },
2492
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2493
- contrastCurve: (r) => r.platform === "phone" ? r.isDark ? k(6) : k(4.5) : k(7)
2494
- });
2495
- return T(super.onSurfaceVariant(), "2025", e);
2496
- }
2497
- outline() {
2498
- const e = c.fromPalette({
2499
- name: "outline",
2500
- palette: (r) => r.neutralPalette,
2501
- chromaMultiplier: (r) => {
2502
- if (r.platform === "phone") {
2503
- if (r.variant === h.NEUTRAL)
2504
- return 2.2;
2505
- if (r.variant === h.TONAL_SPOT)
2506
- return 1.7;
2507
- if (r.variant === h.EXPRESSIVE)
2508
- return b.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
2509
- }
2510
- return 1;
2511
- },
2512
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2513
- contrastCurve: (r) => r.platform === "phone" ? k(3) : k(4.5)
2514
- });
2515
- return T(super.outline(), "2025", e);
2516
- }
2517
- outlineVariant() {
2518
- const e = c.fromPalette({
2519
- name: "outline_variant",
2520
- palette: (r) => r.neutralPalette,
2521
- chromaMultiplier: (r) => {
2522
- if (r.platform === "phone") {
2523
- if (r.variant === h.NEUTRAL)
2524
- return 2.2;
2525
- if (r.variant === h.TONAL_SPOT)
2526
- return 1.7;
2527
- if (r.variant === h.EXPRESSIVE)
2528
- return b.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
2529
- }
2530
- return 1;
2531
- },
2532
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2533
- contrastCurve: (r) => r.platform === "phone" ? k(1.5) : k(3)
2534
- });
2535
- return T(super.outlineVariant(), "2025", e);
2536
- }
2537
- inverseSurface() {
2538
- const e = c.fromPalette({
2539
- name: "inverse_surface",
2540
- palette: (r) => r.neutralPalette,
2541
- tone: (r) => r.isDark ? 98 : 4,
2542
- isBackground: !0
2543
- });
2544
- return T(super.inverseSurface(), "2025", e);
2545
- }
2546
- inverseOnSurface() {
2547
- const e = c.fromPalette({
2548
- name: "inverse_on_surface",
2549
- palette: (r) => r.neutralPalette,
2550
- background: (r) => this.inverseSurface(),
2551
- contrastCurve: (r) => k(7)
2552
- });
2553
- return T(super.inverseOnSurface(), "2025", e);
2554
- }
2555
- ////////////////////////////////////////////////////////////////
2556
- // Primaries [P] //
2557
- ////////////////////////////////////////////////////////////////
2558
- primary() {
2559
- const e = c.fromPalette({
2560
- name: "primary",
2561
- palette: (r) => r.primaryPalette,
2562
- tone: (r) => r.variant === h.NEUTRAL ? r.platform === "phone" ? r.isDark ? 80 : 40 : 90 : r.variant === h.TONAL_SPOT ? r.platform === "phone" ? r.isDark ? 80 : w(r.primaryPalette) : w(r.primaryPalette, 0, 90) : r.variant === h.EXPRESSIVE ? r.platform === "phone" ? w(r.primaryPalette, 0, b.isYellow(r.primaryPalette.hue) ? 25 : b.isCyan(r.primaryPalette.hue) ? 88 : 98) : w(r.primaryPalette) : r.platform === "phone" ? w(r.primaryPalette, 0, b.isCyan(r.primaryPalette.hue) ? 88 : 98) : w(r.primaryPalette),
2563
- isBackground: !0,
2564
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2565
- contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
2566
- toneDeltaPair: (r) => r.platform === "phone" ? new x(this.primaryContainer(), this.primary(), 5, "relative_lighter", !0, "farther") : void 0
2567
- });
2568
- return T(super.primary(), "2025", e);
2569
- }
2570
- primaryDim() {
2571
- return c.fromPalette({
2572
- name: "primary_dim",
2573
- palette: (e) => e.primaryPalette,
2574
- tone: (e) => e.variant === h.NEUTRAL ? 85 : e.variant === h.TONAL_SPOT ? w(e.primaryPalette, 0, 90) : w(e.primaryPalette),
2575
- isBackground: !0,
2576
- background: (e) => this.surfaceContainerHigh(),
2577
- contrastCurve: (e) => k(4.5),
2578
- toneDeltaPair: (e) => new x(this.primaryDim(), this.primary(), 5, "darker", !0, "farther")
2579
- });
2580
- }
2581
- onPrimary() {
2582
- const e = c.fromPalette({
2583
- name: "on_primary",
2584
- palette: (r) => r.primaryPalette,
2585
- background: (r) => r.platform === "phone" ? this.primary() : this.primaryDim(),
2586
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2587
- });
2588
- return T(super.onPrimary(), "2025", e);
2589
- }
2590
- primaryContainer() {
2591
- const e = c.fromPalette({
2592
- name: "primary_container",
2593
- palette: (r) => r.primaryPalette,
2594
- tone: (r) => r.platform === "watch" ? 30 : r.variant === h.NEUTRAL ? r.isDark ? 30 : 90 : r.variant === h.TONAL_SPOT ? r.isDark ? ee(r.primaryPalette, 35, 93) : w(r.primaryPalette, 0, 90) : r.variant === h.EXPRESSIVE ? r.isDark ? w(r.primaryPalette, 30, 93) : w(r.primaryPalette, 78, b.isCyan(r.primaryPalette.hue) ? 88 : 90) : r.isDark ? ee(r.primaryPalette, 66, 93) : w(r.primaryPalette, 66, b.isCyan(r.primaryPalette.hue) ? 88 : 93),
2595
- isBackground: !0,
2596
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2597
- toneDeltaPair: (r) => r.platform === "phone" ? void 0 : new x(this.primaryContainer(), this.primaryDim(), 10, "darker", !0, "farther"),
2598
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2599
- });
2600
- return T(super.primaryContainer(), "2025", e);
2601
- }
2602
- onPrimaryContainer() {
2603
- const e = c.fromPalette({
2604
- name: "on_primary_container",
2605
- palette: (r) => r.primaryPalette,
2606
- background: (r) => this.primaryContainer(),
2607
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2608
- });
2609
- return T(super.onPrimaryContainer(), "2025", e);
2610
- }
2611
- primaryFixed() {
2612
- const e = c.fromPalette({
2613
- name: "primary_fixed",
2614
- palette: (r) => r.primaryPalette,
2615
- tone: (r) => {
2616
- let n = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
2617
- return this.primaryContainer().getTone(n);
2618
- },
2619
- isBackground: !0,
2620
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2621
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2622
- });
2623
- return T(super.primaryFixed(), "2025", e);
2624
- }
2625
- primaryFixedDim() {
2626
- const e = c.fromPalette({
2627
- name: "primary_fixed_dim",
2628
- palette: (r) => r.primaryPalette,
2629
- tone: (r) => this.primaryFixed().getTone(r),
2630
- isBackground: !0,
2631
- toneDeltaPair: (r) => new x(this.primaryFixedDim(), this.primaryFixed(), 5, "darker", !0, "exact")
2632
- });
2633
- return T(super.primaryFixedDim(), "2025", e);
2634
- }
2635
- onPrimaryFixed() {
2636
- const e = c.fromPalette({
2637
- name: "on_primary_fixed",
2638
- palette: (r) => r.primaryPalette,
2639
- background: (r) => this.primaryFixedDim(),
2640
- contrastCurve: (r) => k(7)
2641
- });
2642
- return T(super.onPrimaryFixed(), "2025", e);
2643
- }
2644
- onPrimaryFixedVariant() {
2645
- const e = c.fromPalette({
2646
- name: "on_primary_fixed_variant",
2647
- palette: (r) => r.primaryPalette,
2648
- background: (r) => this.primaryFixedDim(),
2649
- contrastCurve: (r) => k(4.5)
2650
- });
2651
- return T(super.onPrimaryFixedVariant(), "2025", e);
2652
- }
2653
- inversePrimary() {
2654
- const e = c.fromPalette({
2655
- name: "inverse_primary",
2656
- palette: (r) => r.primaryPalette,
2657
- tone: (r) => w(r.primaryPalette),
2658
- background: (r) => this.inverseSurface(),
2659
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2660
- });
2661
- return T(super.inversePrimary(), "2025", e);
2662
- }
2663
- ////////////////////////////////////////////////////////////////
2664
- // Secondaries [Q] //
2665
- ////////////////////////////////////////////////////////////////
2666
- secondary() {
2667
- const e = c.fromPalette({
2668
- name: "secondary",
2669
- palette: (r) => r.secondaryPalette,
2670
- tone: (r) => r.platform === "watch" ? r.variant === h.NEUTRAL ? 90 : w(r.secondaryPalette, 0, 90) : r.variant === h.NEUTRAL ? r.isDark ? ee(r.secondaryPalette, 0, 98) : w(r.secondaryPalette) : r.variant === h.VIBRANT ? w(r.secondaryPalette, 0, r.isDark ? 90 : 98) : r.isDark ? 80 : w(r.secondaryPalette),
2671
- isBackground: !0,
2672
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2673
- contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
2674
- toneDeltaPair: (r) => r.platform === "phone" ? new x(this.secondaryContainer(), this.secondary(), 5, "relative_lighter", !0, "farther") : void 0
2675
- });
2676
- return T(super.secondary(), "2025", e);
2677
- }
2678
- secondaryDim() {
2679
- return c.fromPalette({
2680
- name: "secondary_dim",
2681
- palette: (e) => e.secondaryPalette,
2682
- tone: (e) => e.variant === h.NEUTRAL ? 85 : w(e.secondaryPalette, 0, 90),
2683
- isBackground: !0,
2684
- background: (e) => this.surfaceContainerHigh(),
2685
- contrastCurve: (e) => k(4.5),
2686
- toneDeltaPair: (e) => new x(this.secondaryDim(), this.secondary(), 5, "darker", !0, "farther")
2687
- });
2688
- }
2689
- onSecondary() {
2690
- const e = c.fromPalette({
2691
- name: "on_secondary",
2692
- palette: (r) => r.secondaryPalette,
2693
- background: (r) => r.platform === "phone" ? this.secondary() : this.secondaryDim(),
2694
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2695
- });
2696
- return T(super.onSecondary(), "2025", e);
2697
- }
2698
- secondaryContainer() {
2699
- const e = c.fromPalette({
2700
- name: "secondary_container",
2701
- palette: (r) => r.secondaryPalette,
2702
- tone: (r) => r.platform === "watch" ? 30 : r.variant === h.VIBRANT ? r.isDark ? ee(r.secondaryPalette, 30, 40) : w(r.secondaryPalette, 84, 90) : r.variant === h.EXPRESSIVE ? r.isDark ? 15 : w(r.secondaryPalette, 90, 95) : r.isDark ? 25 : 90,
2703
- isBackground: !0,
2704
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2705
- toneDeltaPair: (r) => r.platform === "watch" ? new x(this.secondaryContainer(), this.secondaryDim(), 10, "darker", !0, "farther") : void 0,
2706
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2707
- });
2708
- return T(super.secondaryContainer(), "2025", e);
2709
- }
2710
- onSecondaryContainer() {
2711
- const e = c.fromPalette({
2712
- name: "on_secondary_container",
2713
- palette: (r) => r.secondaryPalette,
2714
- background: (r) => this.secondaryContainer(),
2715
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2716
- });
2717
- return T(super.onSecondaryContainer(), "2025", e);
2718
- }
2719
- secondaryFixed() {
2720
- const e = c.fromPalette({
2721
- name: "secondary_fixed",
2722
- palette: (r) => r.secondaryPalette,
2723
- tone: (r) => {
2724
- let n = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
2725
- return this.secondaryContainer().getTone(n);
2726
- },
2727
- isBackground: !0,
2728
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2729
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2730
- });
2731
- return T(super.secondaryFixed(), "2025", e);
2732
- }
2733
- secondaryFixedDim() {
2734
- const e = c.fromPalette({
2735
- name: "secondary_fixed_dim",
2736
- palette: (r) => r.secondaryPalette,
2737
- tone: (r) => this.secondaryFixed().getTone(r),
2738
- isBackground: !0,
2739
- toneDeltaPair: (r) => new x(this.secondaryFixedDim(), this.secondaryFixed(), 5, "darker", !0, "exact")
2740
- });
2741
- return T(super.secondaryFixedDim(), "2025", e);
2742
- }
2743
- onSecondaryFixed() {
2744
- const e = c.fromPalette({
2745
- name: "on_secondary_fixed",
2746
- palette: (r) => r.secondaryPalette,
2747
- background: (r) => this.secondaryFixedDim(),
2748
- contrastCurve: (r) => k(7)
2749
- });
2750
- return T(super.onSecondaryFixed(), "2025", e);
2751
- }
2752
- onSecondaryFixedVariant() {
2753
- const e = c.fromPalette({
2754
- name: "on_secondary_fixed_variant",
2755
- palette: (r) => r.secondaryPalette,
2756
- background: (r) => this.secondaryFixedDim(),
2757
- contrastCurve: (r) => k(4.5)
2758
- });
2759
- return T(super.onSecondaryFixedVariant(), "2025", e);
2760
- }
2761
- ////////////////////////////////////////////////////////////////
2762
- // Tertiaries [T] //
2763
- ////////////////////////////////////////////////////////////////
2764
- tertiary() {
2765
- const e = c.fromPalette({
2766
- name: "tertiary",
2767
- palette: (r) => r.tertiaryPalette,
2768
- tone: (r) => r.platform === "watch" ? r.variant === h.TONAL_SPOT ? w(r.tertiaryPalette, 0, 90) : w(r.tertiaryPalette) : r.variant === h.EXPRESSIVE || r.variant === h.VIBRANT ? w(r.tertiaryPalette, 0, b.isCyan(r.tertiaryPalette.hue) ? 88 : r.isDark ? 98 : 100) : r.isDark ? w(r.tertiaryPalette, 0, 98) : w(r.tertiaryPalette),
2769
- isBackground: !0,
2770
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2771
- contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
2772
- toneDeltaPair: (r) => r.platform === "phone" ? new x(this.tertiaryContainer(), this.tertiary(), 5, "relative_lighter", !0, "farther") : void 0
2773
- });
2774
- return T(super.tertiary(), "2025", e);
2775
- }
2776
- tertiaryDim() {
2777
- return c.fromPalette({
2778
- name: "tertiary_dim",
2779
- palette: (e) => e.tertiaryPalette,
2780
- tone: (e) => e.variant === h.TONAL_SPOT ? w(e.tertiaryPalette, 0, 90) : w(e.tertiaryPalette),
2781
- isBackground: !0,
2782
- background: (e) => this.surfaceContainerHigh(),
2783
- contrastCurve: (e) => k(4.5),
2784
- toneDeltaPair: (e) => new x(this.tertiaryDim(), this.tertiary(), 5, "darker", !0, "farther")
2785
- });
2786
- }
2787
- onTertiary() {
2788
- const e = c.fromPalette({
2789
- name: "on_tertiary",
2790
- palette: (r) => r.tertiaryPalette,
2791
- background: (r) => r.platform === "phone" ? this.tertiary() : this.tertiaryDim(),
2792
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2793
- });
2794
- return T(super.onTertiary(), "2025", e);
2795
- }
2796
- tertiaryContainer() {
2797
- const e = c.fromPalette({
2798
- name: "tertiary_container",
2799
- palette: (r) => r.tertiaryPalette,
2800
- tone: (r) => r.platform === "watch" ? r.variant === h.TONAL_SPOT ? w(r.tertiaryPalette, 0, 90) : w(r.tertiaryPalette) : r.variant === h.NEUTRAL ? r.isDark ? w(r.tertiaryPalette, 0, 93) : w(r.tertiaryPalette, 0, 96) : r.variant === h.TONAL_SPOT ? w(r.tertiaryPalette, 0, r.isDark ? 93 : 100) : r.variant === h.EXPRESSIVE ? w(r.tertiaryPalette, 75, b.isCyan(r.tertiaryPalette.hue) ? 88 : r.isDark ? 93 : 100) : r.isDark ? w(r.tertiaryPalette, 0, 93) : w(r.tertiaryPalette, 72, 100),
2801
- isBackground: !0,
2802
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2803
- toneDeltaPair: (r) => r.platform === "watch" ? new x(this.tertiaryContainer(), this.tertiaryDim(), 10, "darker", !0, "farther") : void 0,
2804
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2805
- });
2806
- return T(super.tertiaryContainer(), "2025", e);
2807
- }
2808
- onTertiaryContainer() {
2809
- const e = c.fromPalette({
2810
- name: "on_tertiary_container",
2811
- palette: (r) => r.tertiaryPalette,
2812
- background: (r) => this.tertiaryContainer(),
2813
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2814
- });
2815
- return T(super.onTertiaryContainer(), "2025", e);
2816
- }
2817
- tertiaryFixed() {
2818
- const e = c.fromPalette({
2819
- name: "tertiary_fixed",
2820
- palette: (r) => r.tertiaryPalette,
2821
- tone: (r) => {
2822
- let n = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
2823
- return this.tertiaryContainer().getTone(n);
2824
- },
2825
- isBackground: !0,
2826
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2827
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2828
- });
2829
- return T(super.tertiaryFixed(), "2025", e);
2830
- }
2831
- tertiaryFixedDim() {
2832
- const e = c.fromPalette({
2833
- name: "tertiary_fixed_dim",
2834
- palette: (r) => r.tertiaryPalette,
2835
- tone: (r) => this.tertiaryFixed().getTone(r),
2836
- isBackground: !0,
2837
- toneDeltaPair: (r) => new x(this.tertiaryFixedDim(), this.tertiaryFixed(), 5, "darker", !0, "exact")
2838
- });
2839
- return T(super.tertiaryFixedDim(), "2025", e);
2840
- }
2841
- onTertiaryFixed() {
2842
- const e = c.fromPalette({
2843
- name: "on_tertiary_fixed",
2844
- palette: (r) => r.tertiaryPalette,
2845
- background: (r) => this.tertiaryFixedDim(),
2846
- contrastCurve: (r) => k(7)
2847
- });
2848
- return T(super.onTertiaryFixed(), "2025", e);
2849
- }
2850
- onTertiaryFixedVariant() {
2851
- const e = c.fromPalette({
2852
- name: "on_tertiary_fixed_variant",
2853
- palette: (r) => r.tertiaryPalette,
2854
- background: (r) => this.tertiaryFixedDim(),
2855
- contrastCurve: (r) => k(4.5)
2856
- });
2857
- return T(super.onTertiaryFixedVariant(), "2025", e);
2858
- }
2859
- ////////////////////////////////////////////////////////////////
2860
- // Errors [E] //
2861
- ////////////////////////////////////////////////////////////////
2862
- error() {
2863
- const e = c.fromPalette({
2864
- name: "error",
2865
- palette: (r) => r.errorPalette,
2866
- tone: (r) => r.platform === "phone" ? r.isDark ? ee(r.errorPalette, 0, 98) : w(r.errorPalette) : ee(r.errorPalette),
2867
- isBackground: !0,
2868
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
2869
- contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
2870
- toneDeltaPair: (r) => r.platform === "phone" ? new x(this.errorContainer(), this.error(), 5, "relative_lighter", !0, "farther") : void 0
2871
- });
2872
- return T(super.error(), "2025", e);
2873
- }
2874
- errorDim() {
2875
- return c.fromPalette({
2876
- name: "error_dim",
2877
- palette: (e) => e.errorPalette,
2878
- tone: (e) => ee(e.errorPalette),
2879
- isBackground: !0,
2880
- background: (e) => this.surfaceContainerHigh(),
2881
- contrastCurve: (e) => k(4.5),
2882
- toneDeltaPair: (e) => new x(this.errorDim(), this.error(), 5, "darker", !0, "farther")
2883
- });
2884
- }
2885
- onError() {
2886
- const e = c.fromPalette({
2887
- name: "on_error",
2888
- palette: (r) => r.errorPalette,
2889
- background: (r) => r.platform === "phone" ? this.error() : this.errorDim(),
2890
- contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
2891
- });
2892
- return T(super.onError(), "2025", e);
2893
- }
2894
- errorContainer() {
2895
- const e = c.fromPalette({
2896
- name: "error_container",
2897
- palette: (r) => r.errorPalette,
2898
- tone: (r) => r.platform === "watch" ? 30 : r.isDark ? ee(r.errorPalette, 30, 93) : w(r.errorPalette, 0, 90),
2899
- isBackground: !0,
2900
- background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
2901
- toneDeltaPair: (r) => r.platform === "watch" ? new x(this.errorContainer(), this.errorDim(), 10, "darker", !0, "farther") : void 0,
2902
- contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
2903
- });
2904
- return T(super.errorContainer(), "2025", e);
2905
- }
2906
- onErrorContainer() {
2907
- const e = c.fromPalette({
2908
- name: "on_error_container",
2909
- palette: (r) => r.errorPalette,
2910
- background: (r) => this.errorContainer(),
2911
- contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7)
2912
- });
2913
- return T(super.onErrorContainer(), "2025", e);
2914
- }
2915
- /////////////////////////////////////////////////////////////////
2916
- // Remapped Colors //
2917
- /////////////////////////////////////////////////////////////////
2918
- surfaceVariant() {
2919
- const e = Object.assign(this.surfaceContainerHighest().clone(), { name: "surface_variant" });
2920
- return T(super.surfaceVariant(), "2025", e);
2921
- }
2922
- surfaceTint() {
2923
- const e = Object.assign(this.primary().clone(), { name: "surface_tint" });
2924
- return T(super.surfaceTint(), "2025", e);
2925
- }
2926
- background() {
2927
- const e = Object.assign(this.surface().clone(), { name: "background" });
2928
- return T(super.background(), "2025", e);
2929
- }
2930
- onBackground() {
2931
- const e = Object.assign(this.onSurface().clone(), {
2932
- name: "on_background",
2933
- tone: (r) => r.platform === "watch" ? 100 : this.onSurface().getTone(r)
2934
- });
2935
- return T(super.onBackground(), "2025", e);
2936
- }
2937
- }
2938
- /**
2939
- * @license
2940
- * Copyright 2022 Google LLC
2941
- *
2942
- * Licensed under the Apache License, Version 2.0 (the "License");
2943
- * you may not use this file except in compliance with the License.
2944
- * You may obtain a copy of the License at
2945
- *
2946
- * http://www.apache.org/licenses/LICENSE-2.0
2947
- *
2948
- * Unless required by applicable law or agreed to in writing, software
2949
- * distributed under the License is distributed on an "AS IS" BASIS,
2950
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2951
- * See the License for the specific language governing permissions and
2952
- * limitations under the License.
2953
- */
2954
- class o {
2955
- constructor() {
2956
- this.allColors = [
2957
- this.background(),
2958
- this.onBackground(),
2959
- this.surface(),
2960
- this.surfaceDim(),
2961
- this.surfaceBright(),
2962
- this.surfaceContainerLowest(),
2963
- this.surfaceContainerLow(),
2964
- this.surfaceContainer(),
2965
- this.surfaceContainerHigh(),
2966
- this.surfaceContainerHighest(),
2967
- this.onSurface(),
2968
- this.onSurfaceVariant(),
2969
- this.outline(),
2970
- this.outlineVariant(),
2971
- this.inverseSurface(),
2972
- this.inverseOnSurface(),
2973
- this.primary(),
2974
- this.primaryDim(),
2975
- this.onPrimary(),
2976
- this.primaryContainer(),
2977
- this.onPrimaryContainer(),
2978
- this.primaryFixed(),
2979
- this.primaryFixedDim(),
2980
- this.onPrimaryFixed(),
2981
- this.onPrimaryFixedVariant(),
2982
- this.inversePrimary(),
2983
- this.secondary(),
2984
- this.secondaryDim(),
2985
- this.onSecondary(),
2986
- this.secondaryContainer(),
2987
- this.onSecondaryContainer(),
2988
- this.secondaryFixed(),
2989
- this.secondaryFixedDim(),
2990
- this.onSecondaryFixed(),
2991
- this.onSecondaryFixedVariant(),
2992
- this.tertiary(),
2993
- this.tertiaryDim(),
2994
- this.onTertiary(),
2995
- this.tertiaryContainer(),
2996
- this.onTertiaryContainer(),
2997
- this.tertiaryFixed(),
2998
- this.tertiaryFixedDim(),
2999
- this.onTertiaryFixed(),
3000
- this.onTertiaryFixedVariant(),
3001
- this.error(),
3002
- this.errorDim(),
3003
- this.onError(),
3004
- this.errorContainer(),
3005
- this.onErrorContainer()
3006
- ].filter((e) => e !== void 0);
3007
- }
3008
- highestSurface(e) {
3009
- return o.colorSpec.highestSurface(e);
3010
- }
3011
- ////////////////////////////////////////////////////////////////
3012
- // Main Palettes //
3013
- ////////////////////////////////////////////////////////////////
3014
- primaryPaletteKeyColor() {
3015
- return o.colorSpec.primaryPaletteKeyColor();
3016
- }
3017
- secondaryPaletteKeyColor() {
3018
- return o.colorSpec.secondaryPaletteKeyColor();
3019
- }
3020
- tertiaryPaletteKeyColor() {
3021
- return o.colorSpec.tertiaryPaletteKeyColor();
3022
- }
3023
- neutralPaletteKeyColor() {
3024
- return o.colorSpec.neutralPaletteKeyColor();
3025
- }
3026
- neutralVariantPaletteKeyColor() {
3027
- return o.colorSpec.neutralVariantPaletteKeyColor();
3028
- }
3029
- errorPaletteKeyColor() {
3030
- return o.colorSpec.errorPaletteKeyColor();
3031
- }
3032
- ////////////////////////////////////////////////////////////////
3033
- // Surfaces [S] //
3034
- ////////////////////////////////////////////////////////////////
3035
- background() {
3036
- return o.colorSpec.background();
3037
- }
3038
- onBackground() {
3039
- return o.colorSpec.onBackground();
3040
- }
3041
- surface() {
3042
- return o.colorSpec.surface();
3043
- }
3044
- surfaceDim() {
3045
- return o.colorSpec.surfaceDim();
3046
- }
3047
- surfaceBright() {
3048
- return o.colorSpec.surfaceBright();
3049
- }
3050
- surfaceContainerLowest() {
3051
- return o.colorSpec.surfaceContainerLowest();
3052
- }
3053
- surfaceContainerLow() {
3054
- return o.colorSpec.surfaceContainerLow();
3055
- }
3056
- surfaceContainer() {
3057
- return o.colorSpec.surfaceContainer();
3058
- }
3059
- surfaceContainerHigh() {
3060
- return o.colorSpec.surfaceContainerHigh();
3061
- }
3062
- surfaceContainerHighest() {
3063
- return o.colorSpec.surfaceContainerHighest();
3064
- }
3065
- onSurface() {
3066
- return o.colorSpec.onSurface();
3067
- }
3068
- surfaceVariant() {
3069
- return o.colorSpec.surfaceVariant();
3070
- }
3071
- onSurfaceVariant() {
3072
- return o.colorSpec.onSurfaceVariant();
3073
- }
3074
- outline() {
3075
- return o.colorSpec.outline();
3076
- }
3077
- outlineVariant() {
3078
- return o.colorSpec.outlineVariant();
3079
- }
3080
- inverseSurface() {
3081
- return o.colorSpec.inverseSurface();
3082
- }
3083
- inverseOnSurface() {
3084
- return o.colorSpec.inverseOnSurface();
3085
- }
3086
- shadow() {
3087
- return o.colorSpec.shadow();
3088
- }
3089
- scrim() {
3090
- return o.colorSpec.scrim();
3091
- }
3092
- surfaceTint() {
3093
- return o.colorSpec.surfaceTint();
3094
- }
3095
- ////////////////////////////////////////////////////////////////
3096
- // Primaries [P] //
3097
- ////////////////////////////////////////////////////////////////
3098
- primary() {
3099
- return o.colorSpec.primary();
3100
- }
3101
- primaryDim() {
3102
- return o.colorSpec.primaryDim();
3103
- }
3104
- onPrimary() {
3105
- return o.colorSpec.onPrimary();
3106
- }
3107
- primaryContainer() {
3108
- return o.colorSpec.primaryContainer();
3109
- }
3110
- onPrimaryContainer() {
3111
- return o.colorSpec.onPrimaryContainer();
3112
- }
3113
- inversePrimary() {
3114
- return o.colorSpec.inversePrimary();
3115
- }
3116
- /////////////////////////////////////////////////////////////////
3117
- // Primary Fixed [PF] //
3118
- /////////////////////////////////////////////////////////////////
3119
- primaryFixed() {
3120
- return o.colorSpec.primaryFixed();
3121
- }
3122
- primaryFixedDim() {
3123
- return o.colorSpec.primaryFixedDim();
3124
- }
3125
- onPrimaryFixed() {
3126
- return o.colorSpec.onPrimaryFixed();
3127
- }
3128
- onPrimaryFixedVariant() {
3129
- return o.colorSpec.onPrimaryFixedVariant();
3130
- }
3131
- ////////////////////////////////////////////////////////////////
3132
- // Secondaries [Q] //
3133
- ////////////////////////////////////////////////////////////////
3134
- secondary() {
3135
- return o.colorSpec.secondary();
3136
- }
3137
- secondaryDim() {
3138
- return o.colorSpec.secondaryDim();
3139
- }
3140
- onSecondary() {
3141
- return o.colorSpec.onSecondary();
3142
- }
3143
- secondaryContainer() {
3144
- return o.colorSpec.secondaryContainer();
3145
- }
3146
- onSecondaryContainer() {
3147
- return o.colorSpec.onSecondaryContainer();
3148
- }
3149
- /////////////////////////////////////////////////////////////////
3150
- // Secondary Fixed [QF] //
3151
- /////////////////////////////////////////////////////////////////
3152
- secondaryFixed() {
3153
- return o.colorSpec.secondaryFixed();
3154
- }
3155
- secondaryFixedDim() {
3156
- return o.colorSpec.secondaryFixedDim();
3157
- }
3158
- onSecondaryFixed() {
3159
- return o.colorSpec.onSecondaryFixed();
3160
- }
3161
- onSecondaryFixedVariant() {
3162
- return o.colorSpec.onSecondaryFixedVariant();
3163
- }
3164
- ////////////////////////////////////////////////////////////////
3165
- // Tertiaries [T] //
3166
- ////////////////////////////////////////////////////////////////
3167
- tertiary() {
3168
- return o.colorSpec.tertiary();
3169
- }
3170
- tertiaryDim() {
3171
- return o.colorSpec.tertiaryDim();
3172
- }
3173
- onTertiary() {
3174
- return o.colorSpec.onTertiary();
3175
- }
3176
- tertiaryContainer() {
3177
- return o.colorSpec.tertiaryContainer();
3178
- }
3179
- onTertiaryContainer() {
3180
- return o.colorSpec.onTertiaryContainer();
3181
- }
3182
- /////////////////////////////////////////////////////////////////
3183
- // Tertiary Fixed [TF] //
3184
- /////////////////////////////////////////////////////////////////
3185
- tertiaryFixed() {
3186
- return o.colorSpec.tertiaryFixed();
3187
- }
3188
- tertiaryFixedDim() {
3189
- return o.colorSpec.tertiaryFixedDim();
3190
- }
3191
- onTertiaryFixed() {
3192
- return o.colorSpec.onTertiaryFixed();
3193
- }
3194
- onTertiaryFixedVariant() {
3195
- return o.colorSpec.onTertiaryFixedVariant();
3196
- }
3197
- ////////////////////////////////////////////////////////////////
3198
- // Errors [E] //
3199
- ////////////////////////////////////////////////////////////////
3200
- error() {
3201
- return o.colorSpec.error();
3202
- }
3203
- errorDim() {
3204
- return o.colorSpec.errorDim();
3205
- }
3206
- onError() {
3207
- return o.colorSpec.onError();
3208
- }
3209
- errorContainer() {
3210
- return o.colorSpec.errorContainer();
3211
- }
3212
- onErrorContainer() {
3213
- return o.colorSpec.onErrorContainer();
3214
- }
3215
- // Static variables are deprecated. Use the instance methods to get correct
3216
- // specs based on request.
3217
- /** @deprecated Use highestSurface() instead. */
3218
- static highestSurface(e) {
3219
- return o.colorSpec.highestSurface(e);
3220
- }
3221
- }
3222
- o.contentAccentToneDelta = 15;
3223
- o.colorSpec = new pr();
3224
- o.primaryPaletteKeyColor = o.colorSpec.primaryPaletteKeyColor();
3225
- o.secondaryPaletteKeyColor = o.colorSpec.secondaryPaletteKeyColor();
3226
- o.tertiaryPaletteKeyColor = o.colorSpec.tertiaryPaletteKeyColor();
3227
- o.neutralPaletteKeyColor = o.colorSpec.neutralPaletteKeyColor();
3228
- o.neutralVariantPaletteKeyColor = o.colorSpec.neutralVariantPaletteKeyColor();
3229
- o.background = o.colorSpec.background();
3230
- o.onBackground = o.colorSpec.onBackground();
3231
- o.surface = o.colorSpec.surface();
3232
- o.surfaceDim = o.colorSpec.surfaceDim();
3233
- o.surfaceBright = o.colorSpec.surfaceBright();
3234
- o.surfaceContainerLowest = o.colorSpec.surfaceContainerLowest();
3235
- o.surfaceContainerLow = o.colorSpec.surfaceContainerLow();
3236
- o.surfaceContainer = o.colorSpec.surfaceContainer();
3237
- o.surfaceContainerHigh = o.colorSpec.surfaceContainerHigh();
3238
- o.surfaceContainerHighest = o.colorSpec.surfaceContainerHighest();
3239
- o.onSurface = o.colorSpec.onSurface();
3240
- o.surfaceVariant = o.colorSpec.surfaceVariant();
3241
- o.onSurfaceVariant = o.colorSpec.onSurfaceVariant();
3242
- o.inverseSurface = o.colorSpec.inverseSurface();
3243
- o.inverseOnSurface = o.colorSpec.inverseOnSurface();
3244
- o.outline = o.colorSpec.outline();
3245
- o.outlineVariant = o.colorSpec.outlineVariant();
3246
- o.shadow = o.colorSpec.shadow();
3247
- o.scrim = o.colorSpec.scrim();
3248
- o.surfaceTint = o.colorSpec.surfaceTint();
3249
- o.primary = o.colorSpec.primary();
3250
- o.onPrimary = o.colorSpec.onPrimary();
3251
- o.primaryContainer = o.colorSpec.primaryContainer();
3252
- o.onPrimaryContainer = o.colorSpec.onPrimaryContainer();
3253
- o.inversePrimary = o.colorSpec.inversePrimary();
3254
- o.secondary = o.colorSpec.secondary();
3255
- o.onSecondary = o.colorSpec.onSecondary();
3256
- o.secondaryContainer = o.colorSpec.secondaryContainer();
3257
- o.onSecondaryContainer = o.colorSpec.onSecondaryContainer();
3258
- o.tertiary = o.colorSpec.tertiary();
3259
- o.onTertiary = o.colorSpec.onTertiary();
3260
- o.tertiaryContainer = o.colorSpec.tertiaryContainer();
3261
- o.onTertiaryContainer = o.colorSpec.onTertiaryContainer();
3262
- o.error = o.colorSpec.error();
3263
- o.onError = o.colorSpec.onError();
3264
- o.errorContainer = o.colorSpec.errorContainer();
3265
- o.onErrorContainer = o.colorSpec.onErrorContainer();
3266
- o.primaryFixed = o.colorSpec.primaryFixed();
3267
- o.primaryFixedDim = o.colorSpec.primaryFixedDim();
3268
- o.onPrimaryFixed = o.colorSpec.onPrimaryFixed();
3269
- o.onPrimaryFixedVariant = o.colorSpec.onPrimaryFixedVariant();
3270
- o.secondaryFixed = o.colorSpec.secondaryFixed();
3271
- o.secondaryFixedDim = o.colorSpec.secondaryFixedDim();
3272
- o.onSecondaryFixed = o.colorSpec.onSecondaryFixed();
3273
- o.onSecondaryFixedVariant = o.colorSpec.onSecondaryFixedVariant();
3274
- o.tertiaryFixed = o.colorSpec.tertiaryFixed();
3275
- o.tertiaryFixedDim = o.colorSpec.tertiaryFixedDim();
3276
- o.onTertiaryFixed = o.colorSpec.onTertiaryFixed();
3277
- o.onTertiaryFixedVariant = o.colorSpec.onTertiaryFixedVariant();
3278
- /**
3279
- * @license
3280
- * Copyright 2021 Google LLC
3281
- *
3282
- * Licensed under the Apache License, Version 2.0 (the "License");
3283
- * you may not use this file except in compliance with the License.
3284
- * You may obtain a copy of the License at
3285
- *
3286
- * http://www.apache.org/licenses/LICENSE-2.0
3287
- *
3288
- * Unless required by applicable law or agreed to in writing, software
3289
- * distributed under the License is distributed on an "AS IS" BASIS,
3290
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3291
- * See the License for the specific language governing permissions and
3292
- * limitations under the License.
3293
- */
3294
- class Y {
3295
- /**
3296
- * @param argb ARGB representation of a color
3297
- *
3298
- * @deprecated Use {@link DynamicScheme} for color scheme generation.
3299
- * Use {@link CorePalettes} for core palettes container class.
3300
- */
3301
- static of(e) {
3302
- return new Y(e, !1);
3303
- }
3304
- /**
3305
- * @param argb ARGB representation of a color
3306
- *
3307
- * @deprecated Use {@link DynamicScheme} for color scheme generation.
3308
- * Use {@link CorePalettes} for core palettes container class.
3309
- */
3310
- static contentOf(e) {
3311
- return new Y(e, !0);
3312
- }
3313
- /**
3314
- * Create a [CorePalette] from a set of colors
3315
- *
3316
- * @deprecated Use {@link DynamicScheme} for color scheme generation.
3317
- * Use {@link CorePalettes} for core palettes container class.
3318
- */
3319
- static fromColors(e) {
3320
- return Y.createPaletteFromColors(!1, e);
3321
- }
3322
- /**
3323
- * Create a content [CorePalette] from a set of colors
3324
- *
3325
- * @deprecated Use {@link DynamicScheme} for color scheme generation.
3326
- * Use {@link CorePalettes} for core palettes container class.
3327
- */
3328
- static contentFromColors(e) {
3329
- return Y.createPaletteFromColors(!0, e);
3330
- }
3331
- static createPaletteFromColors(e, r) {
3332
- const n = new Y(r.primary, e);
3333
- if (r.secondary) {
3334
- const a = new Y(r.secondary, e);
3335
- n.a2 = a.a1;
3336
- }
3337
- if (r.tertiary) {
3338
- const a = new Y(r.tertiary, e);
3339
- n.a3 = a.a1;
3340
- }
3341
- if (r.error) {
3342
- const a = new Y(r.error, e);
3343
- n.error = a.a1;
3344
- }
3345
- if (r.neutral) {
3346
- const a = new Y(r.neutral, e);
3347
- n.n1 = a.n1;
3348
- }
3349
- if (r.neutralVariant) {
3350
- const a = new Y(r.neutralVariant, e);
3351
- n.n2 = a.n2;
3352
- }
3353
- return n;
3354
- }
3355
- constructor(e, r) {
3356
- const n = b.fromInt(e), a = n.hue, s = n.chroma;
3357
- r ? (this.a1 = G.fromHueAndChroma(a, s), this.a2 = G.fromHueAndChroma(a, s / 3), this.a3 = G.fromHueAndChroma(a + 60, s / 2), this.n1 = G.fromHueAndChroma(a, Math.min(s / 12, 4)), this.n2 = G.fromHueAndChroma(a, Math.min(s / 6, 8))) : (this.a1 = G.fromHueAndChroma(a, Math.max(48, s)), this.a2 = G.fromHueAndChroma(a, 16), this.a3 = G.fromHueAndChroma(a + 60, 24), this.n1 = G.fromHueAndChroma(a, 4), this.n2 = G.fromHueAndChroma(a, 8)), this.error = G.fromHueAndChroma(25, 84);
3358
- }
3359
- }
3360
- /**
3361
- * @license
3362
- * Copyright 2021 Google LLC
3363
- *
3364
- * Licensed under the Apache License, Version 2.0 (the "License");
3365
- * you may not use this file except in compliance with the License.
3366
- * You may obtain a copy of the License at
3367
- *
3368
- * http://www.apache.org/licenses/LICENSE-2.0
3369
- *
3370
- * Unless required by applicable law or agreed to in writing, software
3371
- * distributed under the License is distributed on an "AS IS" BASIS,
3372
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3373
- * See the License for the specific language governing permissions and
3374
- * limitations under the License.
3375
- */
3376
- class J {
3377
- get primary() {
3378
- return this.props.primary;
3379
- }
3380
- get onPrimary() {
3381
- return this.props.onPrimary;
3382
- }
3383
- get primaryContainer() {
3384
- return this.props.primaryContainer;
3385
- }
3386
- get onPrimaryContainer() {
3387
- return this.props.onPrimaryContainer;
3388
- }
3389
- get secondary() {
3390
- return this.props.secondary;
3391
- }
3392
- get onSecondary() {
3393
- return this.props.onSecondary;
3394
- }
3395
- get secondaryContainer() {
3396
- return this.props.secondaryContainer;
3397
- }
3398
- get onSecondaryContainer() {
3399
- return this.props.onSecondaryContainer;
3400
- }
3401
- get tertiary() {
3402
- return this.props.tertiary;
3403
- }
3404
- get onTertiary() {
3405
- return this.props.onTertiary;
3406
- }
3407
- get tertiaryContainer() {
3408
- return this.props.tertiaryContainer;
3409
- }
3410
- get onTertiaryContainer() {
3411
- return this.props.onTertiaryContainer;
3412
- }
3413
- get error() {
3414
- return this.props.error;
3415
- }
3416
- get onError() {
3417
- return this.props.onError;
3418
- }
3419
- get errorContainer() {
3420
- return this.props.errorContainer;
3421
- }
3422
- get onErrorContainer() {
3423
- return this.props.onErrorContainer;
3424
- }
3425
- get background() {
3426
- return this.props.background;
3427
- }
3428
- get onBackground() {
3429
- return this.props.onBackground;
3430
- }
3431
- get surface() {
3432
- return this.props.surface;
3433
- }
3434
- get onSurface() {
3435
- return this.props.onSurface;
3436
- }
3437
- get surfaceVariant() {
3438
- return this.props.surfaceVariant;
3439
- }
3440
- get onSurfaceVariant() {
3441
- return this.props.onSurfaceVariant;
3442
- }
3443
- get outline() {
3444
- return this.props.outline;
3445
- }
3446
- get outlineVariant() {
3447
- return this.props.outlineVariant;
3448
- }
3449
- get shadow() {
3450
- return this.props.shadow;
3451
- }
3452
- get scrim() {
3453
- return this.props.scrim;
3454
- }
3455
- get inverseSurface() {
3456
- return this.props.inverseSurface;
3457
- }
3458
- get inverseOnSurface() {
3459
- return this.props.inverseOnSurface;
3460
- }
3461
- get inversePrimary() {
3462
- return this.props.inversePrimary;
3463
- }
3464
- /**
3465
- * @param argb ARGB representation of a color.
3466
- * @return Light Material color scheme, based on the color's hue.
3467
- */
3468
- static light(e) {
3469
- return J.lightFromCorePalette(Y.of(e));
3470
- }
3471
- /**
3472
- * @param argb ARGB representation of a color.
3473
- * @return Dark Material color scheme, based on the color's hue.
3474
- */
3475
- static dark(e) {
3476
- return J.darkFromCorePalette(Y.of(e));
3477
- }
3478
- /**
3479
- * @param argb ARGB representation of a color.
3480
- * @return Light Material content color scheme, based on the color's hue.
3481
- */
3482
- static lightContent(e) {
3483
- return J.lightFromCorePalette(Y.contentOf(e));
3484
- }
3485
- /**
3486
- * @param argb ARGB representation of a color.
3487
- * @return Dark Material content color scheme, based on the color's hue.
3488
- */
3489
- static darkContent(e) {
3490
- return J.darkFromCorePalette(Y.contentOf(e));
3491
- }
3492
- /**
3493
- * Light scheme from core palette
3494
- */
3495
- static lightFromCorePalette(e) {
3496
- return new J({
3497
- primary: e.a1.tone(40),
3498
- onPrimary: e.a1.tone(100),
3499
- primaryContainer: e.a1.tone(90),
3500
- onPrimaryContainer: e.a1.tone(10),
3501
- secondary: e.a2.tone(40),
3502
- onSecondary: e.a2.tone(100),
3503
- secondaryContainer: e.a2.tone(90),
3504
- onSecondaryContainer: e.a2.tone(10),
3505
- tertiary: e.a3.tone(40),
3506
- onTertiary: e.a3.tone(100),
3507
- tertiaryContainer: e.a3.tone(90),
3508
- onTertiaryContainer: e.a3.tone(10),
3509
- error: e.error.tone(40),
3510
- onError: e.error.tone(100),
3511
- errorContainer: e.error.tone(90),
3512
- onErrorContainer: e.error.tone(10),
3513
- background: e.n1.tone(99),
3514
- onBackground: e.n1.tone(10),
3515
- surface: e.n1.tone(99),
3516
- onSurface: e.n1.tone(10),
3517
- surfaceVariant: e.n2.tone(90),
3518
- onSurfaceVariant: e.n2.tone(30),
3519
- outline: e.n2.tone(50),
3520
- outlineVariant: e.n2.tone(80),
3521
- shadow: e.n1.tone(0),
3522
- scrim: e.n1.tone(0),
3523
- inverseSurface: e.n1.tone(20),
3524
- inverseOnSurface: e.n1.tone(95),
3525
- inversePrimary: e.a1.tone(80)
3526
- });
3527
- }
3528
- /**
3529
- * Dark scheme from core palette
3530
- */
3531
- static darkFromCorePalette(e) {
3532
- return new J({
3533
- primary: e.a1.tone(80),
3534
- onPrimary: e.a1.tone(20),
3535
- primaryContainer: e.a1.tone(30),
3536
- onPrimaryContainer: e.a1.tone(90),
3537
- secondary: e.a2.tone(80),
3538
- onSecondary: e.a2.tone(20),
3539
- secondaryContainer: e.a2.tone(30),
3540
- onSecondaryContainer: e.a2.tone(90),
3541
- tertiary: e.a3.tone(80),
3542
- onTertiary: e.a3.tone(20),
3543
- tertiaryContainer: e.a3.tone(30),
3544
- onTertiaryContainer: e.a3.tone(90),
3545
- error: e.error.tone(80),
3546
- onError: e.error.tone(20),
3547
- errorContainer: e.error.tone(30),
3548
- onErrorContainer: e.error.tone(80),
3549
- background: e.n1.tone(10),
3550
- onBackground: e.n1.tone(90),
3551
- surface: e.n1.tone(10),
3552
- onSurface: e.n1.tone(90),
3553
- surfaceVariant: e.n2.tone(30),
3554
- onSurfaceVariant: e.n2.tone(80),
3555
- outline: e.n2.tone(60),
3556
- outlineVariant: e.n2.tone(30),
3557
- shadow: e.n1.tone(0),
3558
- scrim: e.n1.tone(0),
3559
- inverseSurface: e.n1.tone(90),
3560
- inverseOnSurface: e.n1.tone(20),
3561
- inversePrimary: e.a1.tone(40)
3562
- });
3563
- }
3564
- constructor(e) {
3565
- this.props = e;
3566
- }
3567
- toJSON() {
3568
- return {
3569
- ...this.props
3570
- };
3571
- }
3572
- }
3573
- /**
3574
- * @license
3575
- * Copyright 2021 Google LLC
3576
- *
3577
- * Licensed under the Apache License, Version 2.0 (the "License");
3578
- * you may not use this file except in compliance with the License.
3579
- * You may obtain a copy of the License at
3580
- *
3581
- * http://www.apache.org/licenses/LICENSE-2.0
3582
- *
3583
- * Unless required by applicable law or agreed to in writing, software
3584
- * distributed under the License is distributed on an "AS IS" BASIS,
3585
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3586
- * See the License for the specific language governing permissions and
3587
- * limitations under the License.
3588
- */
3589
- function pe(t) {
3590
- const e = Ie(t), r = Ee(t), n = Le(t), a = [e.toString(16), r.toString(16), n.toString(16)];
3591
- for (const [s, i] of a.entries())
3592
- i.length === 1 && (a[s] = "0" + i);
3593
- return "#" + a.join("");
3594
- }
3595
- function me(t) {
3596
- t = t.replace("#", "");
3597
- const e = t.length === 3, r = t.length === 6, n = t.length === 8;
3598
- if (!e && !r && !n)
3599
- throw new Error("unexpected hex " + t);
3600
- let a = 0, s = 0, i = 0;
3601
- return e ? (a = $(t.slice(0, 1).repeat(2)), s = $(t.slice(1, 2).repeat(2)), i = $(t.slice(2, 3).repeat(2))) : r ? (a = $(t.slice(0, 2)), s = $(t.slice(2, 4)), i = $(t.slice(4, 6))) : n && (a = $(t.slice(2, 4)), s = $(t.slice(4, 6)), i = $(t.slice(6, 8))), (255 << 24 | (a & 255) << 16 | (s & 255) << 8 | i & 255) >>> 0;
3602
- }
3603
- function $(t) {
3604
- return parseInt(t, 16);
3605
- }
3606
- /**
3607
- * @license
3608
- * Copyright 2021 Google LLC
3609
- *
3610
- * Licensed under the Apache License, Version 2.0 (the "License");
3611
- * you may not use this file except in compliance with the License.
3612
- * You may obtain a copy of the License at
3613
- *
3614
- * http://www.apache.org/licenses/LICENSE-2.0
3615
- *
3616
- * Unless required by applicable law or agreed to in writing, software
3617
- * distributed under the License is distributed on an "AS IS" BASIS,
3618
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3619
- * See the License for the specific language governing permissions and
3620
- * limitations under the License.
3621
- */
3622
- function mr(t, e = []) {
3623
- const r = Y.of(t);
3624
- return {
3625
- source: t,
3626
- schemes: {
3627
- light: J.light(t),
3628
- dark: J.dark(t)
3629
- },
3630
- palettes: {
3631
- primary: r.a1,
3632
- secondary: r.a2,
3633
- tertiary: r.a3,
3634
- neutral: r.n1,
3635
- neutralVariant: r.n2,
3636
- error: r.error
3637
- },
3638
- customColors: e.map((n) => yr(t, n))
3639
- };
3640
- }
3641
- function yr(t, e) {
3642
- let r = e.value;
3643
- const n = r, a = t;
3644
- e.blend && (r = De.harmonize(n, a));
3645
- const i = Y.of(r).a1;
3646
- return {
3647
- color: e,
3648
- value: r,
3649
- light: {
3650
- color: i.tone(40),
3651
- onColor: i.tone(100),
3652
- colorContainer: i.tone(90),
3653
- onColorContainer: i.tone(10)
3654
- },
3655
- dark: {
3656
- color: i.tone(80),
3657
- onColor: i.tone(20),
3658
- colorContainer: i.tone(30),
3659
- onColorContainer: i.tone(90)
3660
- }
3661
- };
3662
- }
3663
- const Ve = [
3664
- 50,
3665
- 100,
3666
- 200,
3667
- 300,
3668
- 400,
3669
- 500,
3670
- 600,
3671
- 700,
3672
- 800,
3673
- 900
3674
- ], Ne = {
3675
- 50: 90,
3676
- 100: 80,
3677
- 200: 70,
3678
- 300: 60,
3679
- 400: 50,
3680
- 500: 40,
3681
- 600: 35,
3682
- 700: 30,
3683
- 800: 20,
3684
- 900: 10
3685
- }, gr = Object.fromEntries(
3686
- Ve.map((t) => [t, Ne[t] >= 60 ? 10 : 100])
3687
- ), Pr = (t) => {
3688
- const e = Ke(t, "#000000");
3689
- return mr(me(e)).palettes.primary;
3690
- }, _e = (t, e) => {
3691
- const r = Pr(t);
3692
- return Object.fromEntries(
3693
- Ve.map((n) => [
3694
- n,
3695
- pe(r.tone(e[n]))
3696
- ])
3697
- );
3698
- }, Ue = (t) => _e(t, Ne), kr = (t) => _e(t, gr), Or = (t) => ({
3699
- colors: Ue(t),
3700
- onColors: kr(t)
3701
- }), W = (t, e) => {
3702
- const r = b.fromInt(me(t));
3703
- return pe(b.from(r.hue, r.chroma, e).toInt());
3704
- }, z = (t, e, r, n = 1) => {
3705
- const a = b.fromInt(me(t)), s = (a.hue + e + 360) % 360, i = Math.min(a.chroma * n, 100);
3706
- return pe(b.from(s, i, r).toInt());
3707
- }, fe = (t) => {
3708
- const e = b.fromInt(me(t)), r = (e.hue + 110) % 360, n = Math.min(e.chroma * 1.2, 100), a = e.tone < 50 ? 65 : Math.min(e.tone + 10, 75);
3709
- return pe(b.from(r, n, a).toInt());
3710
- }, Sr = (t) => {
3711
- const e = fe(t);
3712
- return [
3713
- F(W(e, 95), 0),
3714
- F(e, 25),
3715
- F(t, 50),
3716
- F(W(t, 80), 75),
3717
- F(W(t, 20), 100)
3718
- ];
3719
- }, Cr = (t) => [
3720
- F(W(t, 94), 0),
3721
- F(W(t, 72), 28),
3722
- F(t, 55),
3723
- F(W(t, 24), 100)
3724
- ], br = (t) => [
3725
- F(W(fe(t), 88), 0),
3726
- F(t, 50),
3727
- F(W(fe(t), 32), 100)
3728
- ], Tr = (t) => [
3729
- F(z(t, 148, 82, 0.95), 0),
3730
- F(z(t, -148, 70, 1.05), 28),
3731
- F(t, 56),
3732
- F(z(t, 150, 34, 1.08), 100)
3733
- ], Dr = (t) => [
3734
- F(z(t, -34, 72, 0.95), 0),
3735
- F(t, 50),
3736
- F(z(t, 34, 34, 1.05), 100)
3737
- ], wr = (t) => [
3738
- F(z(t, -120, 78, 0.9), 0),
3739
- F(t, 50),
3740
- F(z(t, 120, 36, 1.05), 100)
3741
- ], Fr = (t) => [
3742
- F(z(t, -90, 78, 0.92), 0),
3743
- F(t, 32),
3744
- F(z(t, 90, 62, 1), 58),
3745
- F(z(t, 180, 34, 1.08), 100)
3746
- ], xr = (t) => [
3747
- F(z(t, -28, 82, 0.96), 0),
3748
- F(t, 27),
3749
- F(z(t, 152, 66, 1.02), 62),
3750
- F(z(t, 180, 34, 1.08), 100)
3751
- ], vr = (t) => [
3752
- F(z(t, -90, 78, 0.94), 0),
3753
- F(t, 30),
3754
- F(z(t, 90, 62, 1), 62),
3755
- F(z(t, 180, 36, 1.08), 100)
3756
- ], Br = (t, e) => {
3757
- const r = (e == null ? void 0 : e[0]) ?? W(t, 84), n = (e == null ? void 0 : e[1]) ?? fe(t);
3758
- return [
3759
- F(r, 0),
3760
- F(t, 48),
3761
- F(n, 100)
3762
- ];
3763
- }, Ar = {
3764
- glare: Sr,
3765
- monochrome: Cr,
3766
- complementary: br,
3767
- "split-complementary": Tr,
3768
- analogous: Dr,
3769
- triadic: wr,
3770
- tetradic: Fr,
3771
- rectangle: xr,
3772
- square: vr,
3773
- duotone: Br
3774
- }, Mr = (t, e, r) => Ar[e](t, r), Ir = (t, e = {}) => {
3775
- const r = e.shade ?? 500, n = e.recipe ?? "glare";
3776
- return {
3777
- type: e.type ?? "linear",
3778
- stops: Mr(t[r], n, e.colors),
3779
- direction: e.direction ?? Xe,
3780
- shape: e.shape ?? "ellipse",
3781
- position: e.position ?? qe,
3782
- size: e.size ?? je
3783
- };
3784
- }, Rr = (t, e = {}) => Ir(Ue(t), e), re = (t) => t, Er = (t) => t, Me = Er({
3785
- materialBorder: re({
3786
- label: "Material border",
3787
- description: "Default Gradient UI border material.",
3788
- gradient: {
3789
- recipe: "glare",
3790
- type: "linear",
3791
- direction: 135
3792
- },
3793
- shadow: {
3794
- layers: 2,
3795
- opacity: 0.22,
3796
- blur: 12,
3797
- y: 4,
3798
- spread: -3
3799
- },
3800
- dropShadow: {
3801
- layers: 2,
3802
- opacity: 0.32,
3803
- blur: 12,
3804
- y: 5
3805
- },
3806
- animation: {
3807
- preset: "shift",
3808
- duration: 6400,
3809
- easing: "ease-in-out"
3810
- }
3811
- }),
3812
- materialAction: re({
3813
- label: "Material action",
3814
- description: "Compact action material for buttons, chips and controls.",
3815
- gradient: {
3816
- recipe: "glare",
3817
- type: "linear",
3818
- direction: 135
3819
- },
3820
- shadow: {
3821
- layers: 2,
3822
- opacity: 0.2,
3823
- blur: 10,
3824
- y: 3,
3825
- spread: -2
3826
- },
3827
- dropShadow: {
3828
- layers: 2,
3829
- opacity: 0.28,
3830
- blur: 10,
3831
- y: 4
3832
- },
3833
- animation: {
3834
- preset: "shift",
3835
- duration: 6800,
3836
- easing: "ease-in-out"
3837
- }
3838
- }),
3839
- materialSurface: re({
3840
- label: "Material surface",
3841
- description: "Soft surface material for calm gradient backgrounds.",
3842
- gradient: {
3843
- recipe: "monochrome",
3844
- type: "linear",
3845
- direction: 145
3846
- },
3847
- shadow: {
3848
- layers: 2,
3849
- opacity: 0.18,
3850
- blur: 14,
3851
- y: 5,
3852
- spread: -3
3853
- },
3854
- dropShadow: {
3855
- layers: 2,
3856
- opacity: 0.22,
3857
- blur: 14,
3858
- y: 5
3859
- },
3860
- animation: {
3861
- preset: "pulse",
3862
- duration: 7600,
3863
- easing: "ease-in-out"
3864
- }
3865
- }),
3866
- brandGlare: re({
3867
- label: "Brand glare",
3868
- description: "Classic Gradient UI glare with a vivid complementary highlight.",
3869
- gradient: {
3870
- recipe: "glare",
3871
- type: "linear",
3872
- direction: 135
3873
- },
3874
- shadow: {
3875
- layers: 2,
3876
- opacity: 0.24,
3877
- blur: 16,
3878
- y: 6,
3879
- spread: -3
3880
- },
3881
- dropShadow: {
3882
- layers: 3,
3883
- opacity: 0.38,
3884
- blur: 16,
3885
- y: 6
3886
- },
3887
- animation: {
3888
- preset: "shift",
3889
- duration: 6e3,
3890
- easing: "ease-in-out"
3891
- }
3892
- }),
3893
- softMono: re({
3894
- label: "Soft mono",
3895
- description: "Quiet monochrome ramp for subtle surfaces.",
3896
- gradient: {
3897
- recipe: "monochrome",
3898
- type: "linear",
3899
- direction: 145
3900
- },
3901
- shadow: {
3902
- layers: 2,
3903
- opacity: 0.18,
3904
- blur: 18,
3905
- y: 7,
3906
- spread: -4
3907
- },
3908
- dropShadow: {
3909
- layers: 2,
3910
- opacity: 0.26,
3911
- blur: 16,
3912
- y: 6
3913
- },
3914
- animation: {
3915
- preset: "pulse",
3916
- duration: 7200,
3917
- easing: "ease-in-out"
3918
- }
3919
- }),
3920
- neonDuo: re({
3921
- label: "Neon duo",
3922
- description: "Punchy duotone setup with stronger glow defaults.",
3923
- gradient: {
3924
- recipe: "duotone",
3925
- type: "linear",
3926
- direction: 120
3927
- },
3928
- shadow: {
3929
- layers: 2,
3930
- opacity: 0.32,
3931
- blur: 18,
3932
- y: 7,
3933
- spread: -3
3934
- },
3935
- dropShadow: {
3936
- layers: 3,
3937
- opacity: 0.52,
3938
- blur: 18,
3939
- y: 7
3940
- },
3941
- animation: {
3942
- preset: "shift",
3943
- duration: 5200,
3944
- easing: "ease-in-out"
3945
- }
3946
- }),
3947
- orbitalConic: re({
3948
- label: "Orbital conic",
3949
- description: "Smooth mirrored conic gradient for badges and marks.",
3950
- gradient: {
3951
- recipe: "triadic",
3952
- type: "conic",
3953
- direction: 35,
3954
- position: "center"
3955
- },
3956
- shadow: {
3957
- layers: 2,
3958
- opacity: 0.24,
3959
- blur: 16,
3960
- y: 6,
3961
- spread: -3
3962
- },
3963
- dropShadow: {
3964
- layers: 3,
3965
- opacity: 0.36,
3966
- blur: 16,
3967
- y: 6
3968
- },
3969
- animation: {
3970
- preset: "rotate",
3971
- duration: 9e3
3972
- }
3973
- }),
3974
- auroraRadial: re({
3975
- label: "Aurora radial",
3976
- description: "Radial analogous gradient with slow hue motion.",
3977
- gradient: {
3978
- recipe: "analogous",
3979
- type: "radial",
3980
- direction: 0,
3981
- position: "top left",
3982
- shape: "circle"
3983
- },
3984
- shadow: {
3985
- layers: 2,
3986
- opacity: 0.22,
3987
- blur: 18,
3988
- y: 7,
3989
- spread: -4
3990
- },
3991
- dropShadow: {
3992
- layers: 3,
3993
- opacity: 0.32,
3994
- blur: 18,
3995
- y: 7
3996
- },
3997
- animation: {
3998
- preset: "hue-rotate",
3999
- duration: 8e3,
4000
- easing: "ease-in-out"
4001
- }
4002
- })
4003
- }), Vr = (t, e = Me) => e[t] ?? Me.brandGlare;
4004
- export {
4005
- Ve as C,
4006
- gr as O,
4007
- Ne as S,
4008
- Rr as a,
4009
- kr as b,
4010
- Ir as c,
4011
- Ue as d,
4012
- Or as e,
4013
- Mr as f,
4014
- re as g,
4015
- Er as h,
4016
- Vr as i,
4017
- Me as j,
4018
- Ar as k,
4019
- me as l,
4020
- pe as m,
4021
- fe as n,
4022
- W as o,
4023
- z as s,
4024
- mr as t
4025
- };