@gradient-ui/core 0.4.0 → 0.4.1
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.
- package/README.md +58 -2
- package/dist/GLoading.vue_vue_type_style_index_0_lang-Bv3dWEq8.cjs +1 -0
- package/dist/GLoading.vue_vue_type_style_index_0_lang-CBB_GocW.js +466 -0
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BS6bb1XY.cjs +1 -0
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-UTBNFP5X.js +7015 -0
- package/dist/{default-585QCoXx.js → camelToKebabCase-6qY6WHvl.js} +987 -1194
- package/dist/camelToKebabCase-BQDotaQm.cjs +316 -0
- package/dist/components.cjs +1 -1
- package/dist/components.mjs +56 -53
- package/dist/default-BhuY-A3o.cjs +4 -0
- package/dist/default-OTmCd0Aq.js +131 -0
- package/dist/directives.cjs +1 -1
- package/dist/directives.mjs +6 -5
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +183 -113
- package/dist/mask-BbofdFd4.cjs +1 -0
- package/dist/mask-CZX-I_iy.js +936 -0
- package/dist/material-Ca7ZZAiO.cjs +194 -0
- package/dist/material-okvXHenb.js +1162 -0
- package/dist/materialSurface-BBrP9ltj.js +591 -0
- package/dist/materialSurface-CK8LN_dU.cjs +1 -0
- package/dist/services.cjs +1 -1
- package/dist/services.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/surface-8z3gR7vF.cjs +1 -0
- package/dist/surface-BKu4KfkY.js +288 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.mjs +55 -9
- package/dist/types/components/index.d.ts +3 -1
- package/dist/types/components/ui/BaseOverlay/BaseOverlay.vue.d.ts +1 -1
- package/dist/types/components/ui/GAlert/GAlert.vue.d.ts +675 -9
- package/dist/types/components/ui/GAlert/types.d.ts +352 -4
- package/dist/types/components/ui/GAside/GAside.vue.d.ts +7 -5
- package/dist/types/components/ui/GAside/types.d.ts +17 -6
- package/dist/types/components/ui/GBadge/GBadge.vue.d.ts +679 -13
- package/dist/types/components/ui/GBadge/types.d.ts +350 -3
- package/dist/types/components/ui/GButton/GButton.vue.d.ts +295 -25
- package/dist/types/components/ui/GButton/types.d.ts +194 -49
- package/dist/types/components/ui/GCheckControl/GCheckControl.vue.d.ts +24 -24
- package/dist/types/components/ui/GCheckControl/GCheckGroup.vue.d.ts +24 -24
- package/dist/types/components/ui/GCheckbox/GCheckbox.vue.d.ts +24 -24
- package/dist/types/components/ui/GChip/GChip.vue.d.ts +295 -25
- package/dist/types/components/ui/GChip/types.d.ts +188 -43
- package/dist/types/components/ui/GDrawer/GDrawer.vue.d.ts +1 -1
- package/dist/types/components/ui/GExpansion/GExpansion.vue.d.ts +47 -13
- package/dist/types/components/ui/GExpansion/types.d.ts +284 -22
- package/dist/types/components/ui/GFAB/GFAB.vue.d.ts +220 -7
- package/dist/types/components/ui/GFAB/types.d.ts +122 -3
- package/dist/types/components/ui/GFieldBase/GFieldBase.vue.d.ts +15 -15
- package/dist/types/components/ui/GFieldBase/props.d.ts +10 -10
- package/dist/types/components/ui/GForm/GForm.vue.d.ts +156 -0
- package/dist/types/components/ui/GForm/index.d.ts +2 -0
- package/dist/types/components/ui/GForm/types.d.ts +107 -0
- package/dist/types/components/ui/GGradient/GGradient.vue.d.ts +165 -66
- package/dist/types/components/ui/GGradient/GGradientBorderLayer.vue.d.ts +11 -0
- package/dist/types/components/ui/GGradient/index.d.ts +1 -0
- package/dist/types/components/ui/GGradient/types.d.ts +10 -1
- package/dist/types/components/ui/GGradientMaterial/GGradientMaterial.vue.d.ts +257 -0
- package/dist/types/components/ui/GGradientMaterial/index.d.ts +2 -0
- package/dist/types/components/ui/GGradientMaterial/types.d.ts +140 -0
- package/dist/types/components/ui/GInput/GInput.vue.d.ts +15 -15
- package/dist/types/components/ui/GLoading/GLoading.vue.d.ts +5 -5
- package/dist/types/components/ui/GLoading/types.d.ts +3 -2
- package/dist/types/components/ui/GMenu/GSubmenu.vue.d.ts +14 -14
- package/dist/types/components/ui/GMenuItem/GMenuItem.vue.d.ts +11 -11
- package/dist/types/components/ui/GMenuItem/types.d.ts +4 -4
- package/dist/types/components/ui/GModal/GModal.vue.d.ts +1 -1
- package/dist/types/components/ui/GNavList/GNavList.vue.d.ts +7 -5
- package/dist/types/components/ui/GNavList/types.d.ts +17 -6
- package/dist/types/components/ui/GNavbar/GNavbar.vue.d.ts +4 -4
- package/dist/types/components/ui/GNavbar/types.d.ts +6 -6
- package/dist/types/components/ui/GProgress/GProgress.vue.d.ts +41 -20
- package/dist/types/components/ui/GProgress/types.d.ts +23 -10
- package/dist/types/components/ui/GQuickActions/GQuickActions.vue.d.ts +1 -1
- package/dist/types/components/ui/GSelectItem.vue.d.ts +5 -3
- package/dist/types/components/ui/GSnackbar/GSnackbar.vue.d.ts +681 -15
- package/dist/types/components/ui/GSnackbar/types.d.ts +350 -3
- package/dist/types/components/ui/GSquircle/GSquircle.vue.d.ts +2 -2
- package/dist/types/components/ui/GSquircle/types.d.ts +8 -2
- package/dist/types/components/ui/GSwitch/GSwitch.vue.d.ts +24 -24
- package/dist/types/components/ui/GTable/GTable.vue.d.ts +51 -3
- package/dist/types/components/ui/GTable/types.d.ts +351 -3
- package/dist/types/components/ui/GTabs/GTabs.vue.d.ts +4 -4
- package/dist/types/components/ui/GTabs/types.d.ts +6 -6
- package/dist/types/components/ui/GTextarea/GTextarea.vue.d.ts +15 -15
- package/dist/types/components/ui/GToggleButton/GToggleButton.vue.d.ts +490 -16
- package/dist/types/components/ui/GToggleButton/types.d.ts +284 -32
- package/dist/types/directives/index.d.ts +2 -0
- package/dist/types/directives/ripple.d.ts +1 -1
- package/dist/types/directives/specular.d.ts +34 -0
- package/dist/types/theme/color.d.ts +11 -0
- package/dist/types/theme/colorSeeds.d.ts +21 -20
- package/dist/types/theme/colorSystem.d.ts +12 -0
- package/dist/types/theme/cssTokens.d.ts +7 -0
- package/dist/types/theme/default.d.ts +26 -80
- package/dist/types/theme/gradient/animation/css.d.ts +12 -0
- package/dist/types/theme/gradient/animation/index.d.ts +1 -0
- package/dist/types/theme/gradient/colorMath.d.ts +3 -0
- package/dist/types/theme/gradient/constants.d.ts +3 -0
- package/dist/types/theme/gradient/core.d.ts +1 -0
- package/dist/types/theme/gradient/effects/index.d.ts +1 -0
- package/dist/types/theme/gradient/effects/morph.d.ts +5 -0
- package/dist/types/theme/gradient/effects/shadow.d.ts +3 -0
- package/dist/types/theme/gradient/formatters/canvas.d.ts +2 -0
- package/dist/types/theme/gradient/formatters/css.d.ts +3 -0
- package/dist/types/theme/gradient/formatters/index.d.ts +1 -0
- package/dist/types/theme/gradient/formatters/svg.d.ts +5 -0
- package/dist/types/theme/gradient/index.d.ts +1 -0
- package/dist/types/theme/gradient/material.d.ts +1 -0
- package/dist/types/theme/gradient/model.d.ts +5 -0
- package/dist/types/theme/gradient/presets.d.ts +158 -0
- package/dist/types/theme/gradient/recipes.d.ts +14 -0
- package/dist/types/theme/gradient/tokens.d.ts +72 -0
- package/dist/types/theme/gradient/types.d.ts +117 -0
- package/dist/types/theme/gradient/utils.d.ts +10 -0
- package/dist/types/theme/gradient.d.ts +1 -0
- package/dist/types/theme/index.d.ts +12 -1
- package/dist/types/theme/palette.d.ts +13 -0
- package/dist/types/theme/scheme.d.ts +2 -0
- package/dist/types/theme/types.d.ts +11 -0
- package/dist/types/use/actionSurface.d.ts +1742 -20
- package/dist/types/use/check/booleanControl.d.ts +9 -9
- package/dist/types/use/check/optionGroup.d.ts +9 -7
- package/dist/types/use/check/types.d.ts +26 -26
- package/dist/types/use/color.d.ts +2 -2
- package/dist/types/use/colorResolver.d.ts +15 -5
- package/dist/types/use/form/context.d.ts +8 -0
- package/dist/types/use/form/control.d.ts +4 -0
- package/dist/types/use/form/props.d.ts +4 -4
- package/dist/types/use/form/textFieldControl.d.ts +1 -1
- package/dist/types/use/glass.d.ts +24 -0
- package/dist/types/use/gradient.d.ts +1759 -43
- package/dist/types/use/gradientGlow.d.ts +4 -4
- package/dist/types/use/gradientMaterial.d.ts +21 -0
- package/dist/types/use/gradientRuntime.d.ts +11 -0
- package/dist/types/use/gradientRuntimeRegistry.d.ts +8 -0
- package/dist/types/use/gradientSurface.d.ts +31 -4
- package/dist/types/use/index.d.ts +8 -0
- package/dist/types/use/input/props.d.ts +11 -11
- package/dist/types/use/material.d.ts +112 -0
- package/dist/types/use/materialSurface.d.ts +376 -0
- package/dist/types/use/surface.d.ts +67 -19
- package/dist/types/use/surfaceColor.d.ts +1 -1
- package/dist/types/use/textarea/props.d.ts +11 -11
- package/dist/types/use/variant.d.ts +1 -1
- package/dist/use.cjs +1 -1
- package/dist/use.mjs +42 -22
- package/dist/useSnackbar-BHQshEZ8.cjs +1 -0
- package/dist/useSnackbar-DeNHZH8v.js +908 -0
- package/package.json +11 -4
- package/dist/GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js +0 -680
- package/dist/GLoading.vue_vue_type_style_index_0_lang-cokm-HBh.cjs +0 -1
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BmbKqNgm.js +0 -6421
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-By_7hZOW.cjs +0 -4
- package/dist/camelToKebabCase-BAESShJ1.cjs +0 -1
- package/dist/camelToKebabCase-KgkZ7-1F.js +0 -28
- package/dist/default-BcPApP1Q.cjs +0 -318
- package/dist/mask-Bu8cjwwH.js +0 -817
- package/dist/mask-D1vJj5Hl.cjs +0 -1
- package/dist/propsFactory-DyyboUaC.cjs +0 -1
- package/dist/propsFactory-UhcvubZJ.js +0 -13
- package/dist/tagName-CYG1CUfd.js +0 -103
- package/dist/tagName-CbsvFHGg.cjs +0 -1
- package/dist/types/theme/changeTone.d.ts +0 -1
- package/dist/types/theme/colorPallete.d.ts +0 -2
- package/dist/types/theme/generateColors.d.ts +0 -1
- package/dist/types/theme/generateGradient.d.ts +0 -9
- package/dist/types/theme/getComplementaryColor.d.ts +0 -1
- package/dist/types/utils/color.d.ts +0 -3
- package/dist/types/utils/colors/normaliseColor.d.ts +0 -5
- package/dist/useSnackbar-2iJU4bdd.js +0 -769
- package/dist/useSnackbar-3QuH25xm.cjs +0 -1
|
@@ -1,5 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const Pr = {
|
|
2
|
+
red: "#F44336",
|
|
3
|
+
pink: "#E91E63",
|
|
4
|
+
purple: "#9C27B0",
|
|
5
|
+
deepPurple: "#673AB7",
|
|
6
|
+
indigo: "#3F51B5",
|
|
7
|
+
blue: "#2196F3",
|
|
8
|
+
lightBlue: "#03A9F4",
|
|
9
|
+
cyan: "#00BCD4",
|
|
10
|
+
teal: "#009688",
|
|
11
|
+
green: "#4CAF50",
|
|
12
|
+
lightGreen: "#8BC34A",
|
|
13
|
+
lime: "#CDDC39",
|
|
14
|
+
yellow: "#FFEB3B",
|
|
15
|
+
amber: "#FFC107",
|
|
16
|
+
orange: "#FF9800",
|
|
17
|
+
deepOrange: "#FF5722",
|
|
18
|
+
brown: "#795548",
|
|
19
|
+
grey: "#9E9E9E",
|
|
20
|
+
blueGrey: "#607D8B"
|
|
21
|
+
}, de = (a, e = 0, r = 1) => Math.min(r, Math.max(e, a)), pe = (a) => {
|
|
22
|
+
const e = a / 255;
|
|
23
|
+
return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
|
|
24
|
+
}, _e = (a) => {
|
|
25
|
+
const e = a.slice(1), r = e.length === 3 || e.length === 4 ? e.slice(0, 3).split("").map((t) => t.repeat(2)).join("") : e.slice(0, 6);
|
|
26
|
+
return r.length !== 6 || !/^[\da-f]{6}$/i.test(r) ? null : {
|
|
27
|
+
r: parseInt(r.slice(0, 2), 16),
|
|
28
|
+
g: parseInt(r.slice(2, 4), 16),
|
|
29
|
+
b: parseInt(r.slice(4, 6), 16)
|
|
30
|
+
};
|
|
31
|
+
}, He = (a) => {
|
|
32
|
+
const e = a.match(
|
|
33
|
+
/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i
|
|
34
|
+
);
|
|
35
|
+
return e ? {
|
|
36
|
+
r: de(Number(e[1]), 0, 255),
|
|
37
|
+
g: de(Number(e[2]), 0, 255),
|
|
38
|
+
b: de(Number(e[3]), 0, 255)
|
|
39
|
+
} : null;
|
|
40
|
+
}, me = (a) => {
|
|
41
|
+
if (typeof a == "number") {
|
|
42
|
+
const r = a & 16777215;
|
|
43
|
+
return {
|
|
44
|
+
r: r >> 16 & 255,
|
|
45
|
+
g: r >> 8 & 255,
|
|
46
|
+
b: r & 255
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const e = a.trim();
|
|
50
|
+
return e.startsWith("#") ? _e(e) : e.toLowerCase().startsWith("rgb") ? He(e) : null;
|
|
51
|
+
}, Ue = ({ r: a, g: e, b: r }) => `#${[a, e, r].map((t) => Math.round(t).toString(16).padStart(2, "0")).join("")}`, kr = ({ r: a, g: e, b: r }) => `${Math.round(a)}, ${Math.round(e)}, ${Math.round(r)}`, Ye = (a, e) => {
|
|
52
|
+
const r = me(a) ?? me(e);
|
|
53
|
+
if (!r)
|
|
54
|
+
throw new Error(`Invalid fallback color: ${e}`);
|
|
55
|
+
return Ue(r);
|
|
56
|
+
}, ze = (a) => 0.2126 * pe(a.r) + 0.7152 * pe(a.g) + 0.0722 * pe(a.b), Cr = (a) => {
|
|
57
|
+
const e = me(a);
|
|
58
|
+
if (!e) return "#ffffff";
|
|
59
|
+
const r = ze(e), t = 1.05 / (r + 0.05), n = (r + 0.05) / 0.055;
|
|
60
|
+
return t >= n ? "#ffffff" : "#0d0d12";
|
|
61
|
+
};
|
|
3
62
|
/**
|
|
4
63
|
* @license
|
|
5
64
|
* Copyright 2021 Google LLC
|
|
@@ -16,30 +75,30 @@ import { ref as je, shallowRef as Pt, provide as kt, inject as bt } from "vue";
|
|
|
16
75
|
* See the License for the specific language governing permissions and
|
|
17
76
|
* limitations under the License.
|
|
18
77
|
*/
|
|
19
|
-
function
|
|
20
|
-
return
|
|
78
|
+
function z(a) {
|
|
79
|
+
return a < 0 ? -1 : a === 0 ? 0 : 1;
|
|
21
80
|
}
|
|
22
|
-
function
|
|
23
|
-
return (1 -
|
|
81
|
+
function ne(a, e, r) {
|
|
82
|
+
return (1 - r) * a + r * e;
|
|
24
83
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
84
|
+
function Ke(a, e, r) {
|
|
85
|
+
return r < a ? a : r > e ? e : r;
|
|
27
86
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
87
|
+
function H(a, e, r) {
|
|
88
|
+
return r < a ? a : r > e ? e : r;
|
|
30
89
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
90
|
+
function ce(a) {
|
|
91
|
+
return a = a % 360, a < 0 && (a = a + 360), a;
|
|
33
92
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
93
|
+
function je(a, e) {
|
|
94
|
+
return ce(e - a) <= 180 ? 1 : -1;
|
|
36
95
|
}
|
|
37
|
-
function
|
|
38
|
-
return 180 - Math.abs(Math.abs(
|
|
96
|
+
function qe(a, e) {
|
|
97
|
+
return 180 - Math.abs(Math.abs(a - e) - 180);
|
|
39
98
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
return [t, n
|
|
99
|
+
function ye(a, e) {
|
|
100
|
+
const r = a[0] * e[0][0] + a[1] * e[0][1] + a[2] * e[0][2], t = a[0] * e[1][0] + a[1] * e[1][1] + a[2] * e[1][2], n = a[0] * e[2][0] + a[1] * e[2][1] + a[2] * e[2][2];
|
|
101
|
+
return [r, t, n];
|
|
43
102
|
}
|
|
44
103
|
/**
|
|
45
104
|
* @license
|
|
@@ -57,11 +116,11 @@ function Le(r, e) {
|
|
|
57
116
|
* See the License for the specific language governing permissions and
|
|
58
117
|
* limitations under the License.
|
|
59
118
|
*/
|
|
60
|
-
const
|
|
119
|
+
const $e = [
|
|
61
120
|
[0.41233895, 0.35762064, 0.18051042],
|
|
62
121
|
[0.2126, 0.7152, 0.0722],
|
|
63
122
|
[0.01932141, 0.11916382, 0.95034478]
|
|
64
|
-
],
|
|
123
|
+
], Xe = [
|
|
65
124
|
[
|
|
66
125
|
3.2413774792388685,
|
|
67
126
|
-1.5376652402851851,
|
|
@@ -77,64 +136,64 @@ const vt = [
|
|
|
77
136
|
-0.20395524564742123,
|
|
78
137
|
1.0571799111220335
|
|
79
138
|
]
|
|
80
|
-
],
|
|
81
|
-
function
|
|
82
|
-
return (255 << 24 | (
|
|
139
|
+
], Ge = [95.047, 100, 108.883];
|
|
140
|
+
function ke(a, e, r) {
|
|
141
|
+
return (255 << 24 | (a & 255) << 16 | (e & 255) << 8 | r & 255) >>> 0;
|
|
83
142
|
}
|
|
84
|
-
function
|
|
85
|
-
const e =
|
|
86
|
-
return
|
|
143
|
+
function Fe(a) {
|
|
144
|
+
const e = Q(a[0]), r = Q(a[1]), t = Q(a[2]);
|
|
145
|
+
return ke(e, r, t);
|
|
87
146
|
}
|
|
88
|
-
function
|
|
89
|
-
return
|
|
147
|
+
function xe(a) {
|
|
148
|
+
return a >> 16 & 255;
|
|
90
149
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
150
|
+
function Be(a) {
|
|
151
|
+
return a >> 8 & 255;
|
|
93
152
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
153
|
+
function ve(a) {
|
|
154
|
+
return a & 255;
|
|
96
155
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
return
|
|
156
|
+
function Je(a, e, r) {
|
|
157
|
+
const t = Xe, n = t[0][0] * a + t[0][1] * e + t[0][2] * r, s = t[1][0] * a + t[1][1] * e + t[1][2] * r, i = t[2][0] * a + t[2][1] * e + t[2][2] * r, u = Q(n), l = Q(s), h = Q(i);
|
|
158
|
+
return ke(u, l, h);
|
|
100
159
|
}
|
|
101
|
-
function
|
|
102
|
-
const e =
|
|
103
|
-
return
|
|
160
|
+
function We(a) {
|
|
161
|
+
const e = te(xe(a)), r = te(Be(a)), t = te(ve(a));
|
|
162
|
+
return ye([e, r, t], $e);
|
|
104
163
|
}
|
|
105
|
-
function
|
|
106
|
-
const e =
|
|
107
|
-
return
|
|
164
|
+
function Ze(a) {
|
|
165
|
+
const e = Z(a), r = Q(e);
|
|
166
|
+
return ke(r, r, r);
|
|
108
167
|
}
|
|
109
|
-
function
|
|
110
|
-
const e =
|
|
111
|
-
return 116 *
|
|
168
|
+
function ge(a) {
|
|
169
|
+
const e = We(a)[1];
|
|
170
|
+
return 116 * Ae(e / 100) - 16;
|
|
112
171
|
}
|
|
113
|
-
function
|
|
114
|
-
return 100 *
|
|
172
|
+
function Z(a) {
|
|
173
|
+
return 100 * er((a + 16) / 116);
|
|
115
174
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
175
|
+
function Pe(a) {
|
|
176
|
+
return Ae(a / 100) * 116 - 16;
|
|
118
177
|
}
|
|
119
|
-
function
|
|
120
|
-
const e =
|
|
178
|
+
function te(a) {
|
|
179
|
+
const e = a / 255;
|
|
121
180
|
return e <= 0.040449936 ? e / 12.92 * 100 : Math.pow((e + 0.055) / 1.055, 2.4) * 100;
|
|
122
181
|
}
|
|
123
|
-
function
|
|
124
|
-
const e =
|
|
125
|
-
let
|
|
126
|
-
return e <= 31308e-7 ?
|
|
182
|
+
function Q(a) {
|
|
183
|
+
const e = a / 100;
|
|
184
|
+
let r = 0;
|
|
185
|
+
return e <= 31308e-7 ? r = e * 12.92 : r = 1.055 * Math.pow(e, 1 / 2.4) - 0.055, Ke(0, 255, Math.round(r * 255));
|
|
127
186
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
187
|
+
function Qe() {
|
|
188
|
+
return Ge;
|
|
130
189
|
}
|
|
131
|
-
function
|
|
132
|
-
const e = 0.008856451679035631,
|
|
133
|
-
return
|
|
190
|
+
function Ae(a) {
|
|
191
|
+
const e = 0.008856451679035631, r = 24389 / 27;
|
|
192
|
+
return a > e ? Math.pow(a, 1 / 3) : (r * a + 16) / 116;
|
|
134
193
|
}
|
|
135
|
-
function
|
|
136
|
-
const e = 0.008856451679035631,
|
|
137
|
-
return
|
|
194
|
+
function er(a) {
|
|
195
|
+
const e = 0.008856451679035631, r = 24389 / 27, t = a * a * a;
|
|
196
|
+
return t > e ? t : (116 * a - 16) / r;
|
|
138
197
|
}
|
|
139
198
|
/**
|
|
140
199
|
* @license
|
|
@@ -152,7 +211,7 @@ function At(r) {
|
|
|
152
211
|
* See the License for the specific language governing permissions and
|
|
153
212
|
* limitations under the License.
|
|
154
213
|
*/
|
|
155
|
-
class
|
|
214
|
+
class j {
|
|
156
215
|
/**
|
|
157
216
|
* Create ViewingConditions from a simple, physically relevant, set of
|
|
158
217
|
* parameters.
|
|
@@ -175,24 +234,24 @@ class J {
|
|
|
175
234
|
* default = false, the eye does not perform this process on
|
|
176
235
|
* self-luminous objects like displays.
|
|
177
236
|
*/
|
|
178
|
-
static make(e =
|
|
179
|
-
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, h = i[0] * -2079e-6 + i[1] * 0.048952 + i[2] * 0.953127,
|
|
180
|
-
let p =
|
|
237
|
+
static make(e = Qe(), r = 200 / Math.PI * Z(50) / 100, t = 50, n = 2, s = !1) {
|
|
238
|
+
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, h = i[0] * -2079e-6 + i[1] * 0.048952 + i[2] * 0.953127, d = 0.8 + n / 10, C = d >= 0.9 ? ne(0.59, 0.69, (d - 0.9) * 10) : ne(0.525, 0.59, (d - 0.8) * 10);
|
|
239
|
+
let p = s ? 1 : d * (1 - 1 / 3.6 * Math.exp((-r - 42) / 92));
|
|
181
240
|
p = p > 1 ? 1 : p < 0 ? 0 : p;
|
|
182
|
-
const
|
|
241
|
+
const D = d, m = [
|
|
183
242
|
p * (100 / u) + 1 - p,
|
|
184
243
|
p * (100 / l) + 1 - p,
|
|
185
244
|
p * (100 / h) + 1 - p
|
|
186
|
-
],
|
|
187
|
-
Math.pow(
|
|
188
|
-
Math.pow(
|
|
189
|
-
Math.pow(
|
|
245
|
+
], g = 1 / (5 * r + 1), P = g * g * g * g, A = 1 - P, B = P * r + 0.1 * A * A * Math.cbrt(5 * r), O = Z(t) / e[1], R = 1.48 + Math.sqrt(O), V = 0.725 / Math.pow(O, 0.2), I = V, x = [
|
|
246
|
+
Math.pow(B * m[0] * u / 100, 0.42),
|
|
247
|
+
Math.pow(B * m[1] * l / 100, 0.42),
|
|
248
|
+
Math.pow(B * m[2] * h / 100, 0.42)
|
|
190
249
|
], L = [
|
|
191
|
-
400 *
|
|
192
|
-
400 *
|
|
193
|
-
400 *
|
|
194
|
-
],
|
|
195
|
-
return new
|
|
250
|
+
400 * x[0] / (x[0] + 27.13),
|
|
251
|
+
400 * x[1] / (x[1] + 27.13),
|
|
252
|
+
400 * x[2] / (x[2] + 27.13)
|
|
253
|
+
], _ = (2 * L[0] + L[1] + 0.05 * L[2]) * V;
|
|
254
|
+
return new j(O, _, V, I, C, D, m, B, Math.pow(B, 0.25), R);
|
|
196
255
|
}
|
|
197
256
|
/**
|
|
198
257
|
* Parameters are intermediate values of the CAM16 conversion process. Their
|
|
@@ -201,11 +260,11 @@ class J {
|
|
|
201
260
|
* is available in the CAM16 specification, and a complete overview requires
|
|
202
261
|
* a color science textbook, such as Fairchild's Color Appearance Models.
|
|
203
262
|
*/
|
|
204
|
-
constructor(e, t, n,
|
|
205
|
-
this.n = e, this.aw =
|
|
263
|
+
constructor(e, r, t, n, s, i, u, l, h, d) {
|
|
264
|
+
this.n = e, this.aw = r, this.nbb = t, this.ncb = n, this.c = s, this.nc = i, this.rgbD = u, this.fl = l, this.fLRoot = h, this.z = d;
|
|
206
265
|
}
|
|
207
266
|
}
|
|
208
|
-
|
|
267
|
+
j.DEFAULT = j.make();
|
|
209
268
|
/**
|
|
210
269
|
* @license
|
|
211
270
|
* Copyright 2021 Google LLC
|
|
@@ -222,7 +281,7 @@ J.DEFAULT = J.make();
|
|
|
222
281
|
* See the License for the specific language governing permissions and
|
|
223
282
|
* limitations under the License.
|
|
224
283
|
*/
|
|
225
|
-
class
|
|
284
|
+
class N {
|
|
226
285
|
/**
|
|
227
286
|
* All of the CAM16 dimensions can be calculated from 3 of the dimensions, in
|
|
228
287
|
* the following combinations:
|
|
@@ -243,8 +302,8 @@ class H {
|
|
|
243
302
|
* @param astar CAM16-UCS a coordinate
|
|
244
303
|
* @param bstar CAM16-UCS b coordinate
|
|
245
304
|
*/
|
|
246
|
-
constructor(e, t, n,
|
|
247
|
-
this.hue = e, this.chroma =
|
|
305
|
+
constructor(e, r, t, n, s, i, u, l, h) {
|
|
306
|
+
this.hue = e, this.chroma = r, this.j = t, this.q = n, this.m = s, this.s = i, this.jstar = u, this.astar = l, this.bstar = h;
|
|
248
307
|
}
|
|
249
308
|
/**
|
|
250
309
|
* CAM16 instances also have coordinates in the CAM16-UCS space, called J*,
|
|
@@ -252,8 +311,8 @@ class H {
|
|
|
252
311
|
* specification, and is used to measure distances between colors.
|
|
253
312
|
*/
|
|
254
313
|
distance(e) {
|
|
255
|
-
const
|
|
256
|
-
return 1.41 * Math.pow(
|
|
314
|
+
const r = this.jstar - e.jstar, t = this.astar - e.astar, n = this.bstar - e.bstar, s = Math.sqrt(r * r + t * t + n * n);
|
|
315
|
+
return 1.41 * Math.pow(s, 0.63);
|
|
257
316
|
}
|
|
258
317
|
/**
|
|
259
318
|
* @param argb ARGB representation of a color.
|
|
@@ -261,7 +320,7 @@ class H {
|
|
|
261
320
|
* conditions.
|
|
262
321
|
*/
|
|
263
322
|
static fromInt(e) {
|
|
264
|
-
return
|
|
323
|
+
return N.fromIntInViewingConditions(e, j.DEFAULT);
|
|
265
324
|
}
|
|
266
325
|
/**
|
|
267
326
|
* @param argb ARGB representation of a color.
|
|
@@ -269,17 +328,17 @@ class H {
|
|
|
269
328
|
* was observed.
|
|
270
329
|
* @return CAM16 color.
|
|
271
330
|
*/
|
|
272
|
-
static fromIntInViewingConditions(e,
|
|
273
|
-
const
|
|
274
|
-
return new
|
|
331
|
+
static fromIntInViewingConditions(e, r) {
|
|
332
|
+
const t = (e & 16711680) >> 16, n = (e & 65280) >> 8, s = e & 255, i = te(t), u = te(n), l = te(s), h = 0.41233895 * i + 0.35762064 * u + 0.18051042 * l, d = 0.2126 * i + 0.7152 * u + 0.0722 * l, C = 0.01932141 * i + 0.11916382 * u + 0.95034478 * l, p = 0.401288 * h + 0.650173 * d - 0.051461 * C, D = -0.250268 * h + 1.204414 * d + 0.045854 * C, m = -2079e-6 * h + 0.048952 * d + 0.953127 * C, g = r.rgbD[0] * p, P = r.rgbD[1] * D, A = r.rgbD[2] * m, B = Math.pow(r.fl * Math.abs(g) / 100, 0.42), O = Math.pow(r.fl * Math.abs(P) / 100, 0.42), R = Math.pow(r.fl * Math.abs(A) / 100, 0.42), V = z(g) * 400 * B / (B + 27.13), I = z(P) * 400 * O / (O + 27.13), x = z(A) * 400 * R / (R + 27.13), L = (11 * V + -12 * I + x) / 11, _ = (V + I - 2 * x) / 9, E = (20 * V + 20 * I + 21 * x) / 20, q = (40 * V + 20 * I + x) / 20, ee = Math.atan2(_, L) * 180 / Math.PI, K = ce(ee), ae = K * Math.PI / 180, oe = q * r.nbb, J = 100 * Math.pow(oe / r.aw, r.c * r.z), ie = 4 / r.c * Math.sqrt(J / 100) * (r.aw + 4) * r.fLRoot, ue = K < 20.14 ? K + 360 : K, le = 0.25 * (Math.cos(ue * Math.PI / 180 + 2) + 3.8), he = 5e4 / 13 * le * r.nc * r.ncb * Math.sqrt(L * L + _ * _) / (E + 0.305), se = Math.pow(he, 0.9) * Math.pow(1.64 - Math.pow(0.29, r.n), 0.73), be = se * Math.sqrt(J / 100), Te = be * r.fLRoot, Oe = 50 * Math.sqrt(se * r.c / (r.aw + 4)), Re = (1 + 100 * 7e-3) * J / (1 + 7e-3 * J), De = 1 / 0.0228 * Math.log(1 + 0.0228 * Te), Ve = De * Math.cos(ae), Ne = De * Math.sin(ae);
|
|
333
|
+
return new N(K, be, J, ie, Te, Oe, Re, Ve, Ne);
|
|
275
334
|
}
|
|
276
335
|
/**
|
|
277
336
|
* @param j CAM16 lightness
|
|
278
337
|
* @param c CAM16 chroma
|
|
279
338
|
* @param h CAM16 hue
|
|
280
339
|
*/
|
|
281
|
-
static fromJch(e,
|
|
282
|
-
return
|
|
340
|
+
static fromJch(e, r, t) {
|
|
341
|
+
return N.fromJchInViewingConditions(e, r, t, j.DEFAULT);
|
|
283
342
|
}
|
|
284
343
|
/**
|
|
285
344
|
* @param j CAM16 lightness
|
|
@@ -288,9 +347,9 @@ class H {
|
|
|
288
347
|
* @param viewingConditions Information about the environment where the color
|
|
289
348
|
* was observed.
|
|
290
349
|
*/
|
|
291
|
-
static fromJchInViewingConditions(e, t, n
|
|
292
|
-
const
|
|
293
|
-
return new
|
|
350
|
+
static fromJchInViewingConditions(e, r, t, n) {
|
|
351
|
+
const s = 4 / n.c * Math.sqrt(e / 100) * (n.aw + 4) * n.fLRoot, i = r * n.fLRoot, u = r / Math.sqrt(e / 100), l = 50 * Math.sqrt(u * n.c / (n.aw + 4)), h = t * Math.PI / 180, d = (1 + 100 * 7e-3) * e / (1 + 7e-3 * e), C = 1 / 0.0228 * Math.log(1 + 0.0228 * i), p = C * Math.cos(h), D = C * Math.sin(h);
|
|
352
|
+
return new N(t, r, e, s, i, l, d, p, D);
|
|
294
353
|
}
|
|
295
354
|
/**
|
|
296
355
|
* @param jstar CAM16-UCS lightness.
|
|
@@ -299,8 +358,8 @@ class H {
|
|
|
299
358
|
* @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
|
|
300
359
|
* coordinate on the X axis.
|
|
301
360
|
*/
|
|
302
|
-
static fromUcs(e,
|
|
303
|
-
return
|
|
361
|
+
static fromUcs(e, r, t) {
|
|
362
|
+
return N.fromUcsInViewingConditions(e, r, t, j.DEFAULT);
|
|
304
363
|
}
|
|
305
364
|
/**
|
|
306
365
|
* @param jstar CAM16-UCS lightness.
|
|
@@ -311,12 +370,12 @@ class H {
|
|
|
311
370
|
* @param viewingConditions Information about the environment where the color
|
|
312
371
|
* was observed.
|
|
313
372
|
*/
|
|
314
|
-
static fromUcsInViewingConditions(e, t, n
|
|
315
|
-
const
|
|
316
|
-
let
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
return
|
|
373
|
+
static fromUcsInViewingConditions(e, r, t, n) {
|
|
374
|
+
const s = r, i = t, u = Math.sqrt(s * s + i * i), h = (Math.exp(u * 0.0228) - 1) / 0.0228 / n.fLRoot;
|
|
375
|
+
let d = Math.atan2(i, s) * (180 / Math.PI);
|
|
376
|
+
d < 0 && (d += 360);
|
|
377
|
+
const C = e / (1 - (e - 100) * 7e-3);
|
|
378
|
+
return N.fromJchInViewingConditions(C, h, d, n);
|
|
320
379
|
}
|
|
321
380
|
/**
|
|
322
381
|
* @return ARGB representation of color, assuming the color was viewed in
|
|
@@ -324,7 +383,7 @@ class H {
|
|
|
324
383
|
* viewing conditions for sRGB.
|
|
325
384
|
*/
|
|
326
385
|
toInt() {
|
|
327
|
-
return this.viewed(
|
|
386
|
+
return this.viewed(j.DEFAULT);
|
|
328
387
|
}
|
|
329
388
|
/**
|
|
330
389
|
* @param viewingConditions Information about the environment where the color
|
|
@@ -332,19 +391,19 @@ class H {
|
|
|
332
391
|
* @return ARGB representation of color
|
|
333
392
|
*/
|
|
334
393
|
viewed(e) {
|
|
335
|
-
const
|
|
336
|
-
return
|
|
394
|
+
const r = this.chroma === 0 || this.j === 0 ? 0 : this.chroma / Math.sqrt(this.j / 100), t = Math.pow(r / Math.pow(1.64 - Math.pow(0.29, e.n), 0.73), 1 / 0.9), n = this.hue * Math.PI / 180, s = 0.25 * (Math.cos(n + 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, h = Math.sin(n), d = Math.cos(n), C = 23 * (l + 0.305) * t / (23 * u + 11 * t * d + 108 * t * h), p = C * d, D = C * h, m = (460 * l + 451 * p + 288 * D) / 1403, g = (460 * l - 891 * p - 261 * D) / 1403, P = (460 * l - 220 * p - 6300 * D) / 1403, A = Math.max(0, 27.13 * Math.abs(m) / (400 - Math.abs(m))), B = z(m) * (100 / e.fl) * Math.pow(A, 1 / 0.42), O = Math.max(0, 27.13 * Math.abs(g) / (400 - Math.abs(g))), R = z(g) * (100 / e.fl) * Math.pow(O, 1 / 0.42), V = Math.max(0, 27.13 * Math.abs(P) / (400 - Math.abs(P))), I = z(P) * (100 / e.fl) * Math.pow(V, 1 / 0.42), x = B / e.rgbD[0], L = R / e.rgbD[1], _ = I / e.rgbD[2], E = 1.86206786 * x - 1.01125463 * L + 0.14918677 * _, q = 0.38752654 * x + 0.62144744 * L - 897398e-8 * _, G = -0.0158415 * x - 0.03412294 * L + 1.04996444 * _;
|
|
395
|
+
return Je(E, q, G);
|
|
337
396
|
}
|
|
338
397
|
/// Given color expressed in XYZ and viewed in [viewingConditions], convert to
|
|
339
398
|
/// CAM16.
|
|
340
|
-
static fromXyzInViewingConditions(e, t, n
|
|
341
|
-
const
|
|
342
|
-
return new
|
|
399
|
+
static fromXyzInViewingConditions(e, r, t, n) {
|
|
400
|
+
const s = 0.401288 * e + 0.650173 * r - 0.051461 * t, i = -0.250268 * e + 1.204414 * r + 0.045854 * t, u = -2079e-6 * e + 0.048952 * r + 0.953127 * t, l = n.rgbD[0] * s, h = n.rgbD[1] * i, d = n.rgbD[2] * u, C = Math.pow(n.fl * Math.abs(l) / 100, 0.42), p = Math.pow(n.fl * Math.abs(h) / 100, 0.42), D = Math.pow(n.fl * Math.abs(d) / 100, 0.42), m = z(l) * 400 * C / (C + 27.13), g = z(h) * 400 * p / (p + 27.13), P = z(d) * 400 * D / (D + 27.13), A = (11 * m + -12 * g + P) / 11, B = (m + g - 2 * P) / 9, O = (20 * m + 20 * g + 21 * P) / 20, R = (40 * m + 20 * g + P) / 20, I = Math.atan2(B, A) * 180 / Math.PI, x = I < 0 ? I + 360 : I >= 360 ? I - 360 : I, L = x * Math.PI / 180, _ = R * n.nbb, E = 100 * Math.pow(_ / n.aw, n.c * n.z), q = 4 / n.c * Math.sqrt(E / 100) * (n.aw + 4) * n.fLRoot, G = x < 20.14 ? x + 360 : x, ee = 1 / 4 * (Math.cos(G * Math.PI / 180 + 2) + 3.8), ae = 5e4 / 13 * ee * n.nc * n.ncb * Math.sqrt(A * A + B * B) / (O + 0.305), oe = Math.pow(ae, 0.9) * Math.pow(1.64 - Math.pow(0.29, n.n), 0.73), J = oe * Math.sqrt(E / 100), ie = J * n.fLRoot, ue = 50 * Math.sqrt(oe * n.c / (n.aw + 4)), le = (1 + 100 * 7e-3) * E / (1 + 7e-3 * E), fe = Math.log(1 + 0.0228 * ie) / 0.0228, he = fe * Math.cos(L), se = fe * Math.sin(L);
|
|
401
|
+
return new N(x, J, E, q, ie, ue, le, he, se);
|
|
343
402
|
}
|
|
344
403
|
/// XYZ representation of CAM16 seen in [viewingConditions].
|
|
345
404
|
xyzInViewingConditions(e) {
|
|
346
|
-
const
|
|
347
|
-
return [E,
|
|
405
|
+
const r = this.chroma === 0 || this.j === 0 ? 0 : this.chroma / Math.sqrt(this.j / 100), t = Math.pow(r / Math.pow(1.64 - Math.pow(0.29, e.n), 0.73), 1 / 0.9), n = this.hue * Math.PI / 180, s = 0.25 * (Math.cos(n + 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, h = Math.sin(n), d = Math.cos(n), C = 23 * (l + 0.305) * t / (23 * u + 11 * t * d + 108 * t * h), p = C * d, D = C * h, m = (460 * l + 451 * p + 288 * D) / 1403, g = (460 * l - 891 * p - 261 * D) / 1403, P = (460 * l - 220 * p - 6300 * D) / 1403, A = Math.max(0, 27.13 * Math.abs(m) / (400 - Math.abs(m))), B = z(m) * (100 / e.fl) * Math.pow(A, 1 / 0.42), O = Math.max(0, 27.13 * Math.abs(g) / (400 - Math.abs(g))), R = z(g) * (100 / e.fl) * Math.pow(O, 1 / 0.42), V = Math.max(0, 27.13 * Math.abs(P) / (400 - Math.abs(P))), I = z(P) * (100 / e.fl) * Math.pow(V, 1 / 0.42), x = B / e.rgbD[0], L = R / e.rgbD[1], _ = I / e.rgbD[2], E = 1.86206786 * x - 1.01125463 * L + 0.14918677 * _, q = 0.38752654 * x + 0.62144744 * L - 897398e-8 * _, G = -0.0158415 * x - 0.03412294 * L + 1.04996444 * _;
|
|
406
|
+
return [E, q, G];
|
|
348
407
|
}
|
|
349
408
|
}
|
|
350
409
|
/**
|
|
@@ -384,13 +443,13 @@ class S {
|
|
|
384
443
|
* regular RGB space
|
|
385
444
|
*/
|
|
386
445
|
static trueDelinearized(e) {
|
|
387
|
-
const
|
|
388
|
-
let
|
|
389
|
-
return
|
|
446
|
+
const r = e / 100;
|
|
447
|
+
let t = 0;
|
|
448
|
+
return r <= 31308e-7 ? t = r * 12.92 : t = 1.055 * Math.pow(r, 1 / 2.4) - 0.055, t * 255;
|
|
390
449
|
}
|
|
391
450
|
static chromaticAdaptation(e) {
|
|
392
|
-
const
|
|
393
|
-
return
|
|
451
|
+
const r = Math.pow(Math.abs(e), 0.42);
|
|
452
|
+
return z(e) * 400 * r / (r + 27.13);
|
|
394
453
|
}
|
|
395
454
|
/**
|
|
396
455
|
* Returns the hue of a linear RGB color in CAM16.
|
|
@@ -399,12 +458,12 @@ class S {
|
|
|
399
458
|
* @return The hue of the color in CAM16, in radians.
|
|
400
459
|
*/
|
|
401
460
|
static hueOf(e) {
|
|
402
|
-
const
|
|
461
|
+
const r = ye(e, S.SCALED_DISCOUNT_FROM_LINRGB), t = S.chromaticAdaptation(r[0]), n = S.chromaticAdaptation(r[1]), s = S.chromaticAdaptation(r[2]), i = (11 * t + -12 * n + s) / 11, u = (t + n - 2 * s) / 9;
|
|
403
462
|
return Math.atan2(u, i);
|
|
404
463
|
}
|
|
405
|
-
static areInCyclicOrder(e,
|
|
406
|
-
const
|
|
407
|
-
return
|
|
464
|
+
static areInCyclicOrder(e, r, t) {
|
|
465
|
+
const n = S.sanitizeRadians(r - e), s = S.sanitizeRadians(t - e);
|
|
466
|
+
return n < s;
|
|
408
467
|
}
|
|
409
468
|
/**
|
|
410
469
|
* Solves the lerp equation.
|
|
@@ -414,14 +473,14 @@ class S {
|
|
|
414
473
|
* @param target The ending number.
|
|
415
474
|
* @return A number t such that lerp(source, target, t) = mid.
|
|
416
475
|
*/
|
|
417
|
-
static intercept(e,
|
|
418
|
-
return (
|
|
476
|
+
static intercept(e, r, t) {
|
|
477
|
+
return (r - e) / (t - e);
|
|
419
478
|
}
|
|
420
|
-
static lerpPoint(e,
|
|
479
|
+
static lerpPoint(e, r, t) {
|
|
421
480
|
return [
|
|
422
|
-
e[0] + (
|
|
423
|
-
e[1] + (
|
|
424
|
-
e[2] + (
|
|
481
|
+
e[0] + (t[0] - e[0]) * r,
|
|
482
|
+
e[1] + (t[1] - e[1]) * r,
|
|
483
|
+
e[2] + (t[2] - e[2]) * r
|
|
425
484
|
];
|
|
426
485
|
}
|
|
427
486
|
/**
|
|
@@ -435,9 +494,9 @@ class S {
|
|
|
435
494
|
* @return The intersection point of the segment AB with the plane
|
|
436
495
|
* R=coordinate, G=coordinate, or B=coordinate
|
|
437
496
|
*/
|
|
438
|
-
static setCoordinate(e, t, n
|
|
439
|
-
const
|
|
440
|
-
return S.lerpPoint(e,
|
|
497
|
+
static setCoordinate(e, r, t, n) {
|
|
498
|
+
const s = S.intercept(e[n], r, t[n]);
|
|
499
|
+
return S.lerpPoint(e, s, t);
|
|
441
500
|
}
|
|
442
501
|
static isBounded(e) {
|
|
443
502
|
return 0 <= e && e <= 100;
|
|
@@ -452,17 +511,17 @@ class S {
|
|
|
452
511
|
* it exists. If this possible vertex lies outside of the cube,
|
|
453
512
|
* [-1.0, -1.0, -1.0] is returned.
|
|
454
513
|
*/
|
|
455
|
-
static nthVertex(e,
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
const l = i, h = u,
|
|
459
|
-
return S.isBounded(
|
|
460
|
-
} else if (
|
|
461
|
-
const l = i, h = u,
|
|
462
|
-
return S.isBounded(
|
|
514
|
+
static nthVertex(e, r) {
|
|
515
|
+
const t = S.Y_FROM_LINRGB[0], n = S.Y_FROM_LINRGB[1], s = S.Y_FROM_LINRGB[2], i = r % 4 <= 1 ? 0 : 100, u = r % 2 === 0 ? 0 : 100;
|
|
516
|
+
if (r < 4) {
|
|
517
|
+
const l = i, h = u, d = (e - l * n - h * s) / t;
|
|
518
|
+
return S.isBounded(d) ? [d, l, h] : [-1, -1, -1];
|
|
519
|
+
} else if (r < 8) {
|
|
520
|
+
const l = i, h = u, d = (e - h * t - l * s) / n;
|
|
521
|
+
return S.isBounded(d) ? [h, d, l] : [-1, -1, -1];
|
|
463
522
|
} else {
|
|
464
|
-
const l = i, h = u,
|
|
465
|
-
return S.isBounded(
|
|
523
|
+
const l = i, h = u, d = (e - l * t - h * n) / s;
|
|
524
|
+
return S.isBounded(d) ? [l, h, d] : [-1, -1, -1];
|
|
466
525
|
}
|
|
467
526
|
}
|
|
468
527
|
/**
|
|
@@ -474,26 +533,26 @@ class S {
|
|
|
474
533
|
* corresponding to an endpoint of the segment containing the
|
|
475
534
|
* desired color.
|
|
476
535
|
*/
|
|
477
|
-
static bisectToSegment(e,
|
|
478
|
-
let
|
|
536
|
+
static bisectToSegment(e, r) {
|
|
537
|
+
let t = [-1, -1, -1], n = t, s = 0, i = 0, u = !1, l = !0;
|
|
479
538
|
for (let h = 0; h < 12; h++) {
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
539
|
+
const d = S.nthVertex(e, h);
|
|
540
|
+
if (d[0] < 0)
|
|
482
541
|
continue;
|
|
483
|
-
const
|
|
542
|
+
const C = S.hueOf(d);
|
|
484
543
|
if (!u) {
|
|
485
|
-
|
|
544
|
+
t = d, n = d, s = C, i = C, u = !0;
|
|
486
545
|
continue;
|
|
487
546
|
}
|
|
488
|
-
(l || S.areInCyclicOrder(
|
|
547
|
+
(l || S.areInCyclicOrder(s, C, i)) && (l = !1, S.areInCyclicOrder(s, r, C) ? (n = d, i = C) : (t = d, s = C));
|
|
489
548
|
}
|
|
490
|
-
return [
|
|
549
|
+
return [t, n];
|
|
491
550
|
}
|
|
492
|
-
static midpoint(e,
|
|
551
|
+
static midpoint(e, r) {
|
|
493
552
|
return [
|
|
494
|
-
(e[0] +
|
|
495
|
-
(e[1] +
|
|
496
|
-
(e[2] +
|
|
553
|
+
(e[0] + r[0]) / 2,
|
|
554
|
+
(e[1] + r[1]) / 2,
|
|
555
|
+
(e[2] + r[2]) / 2
|
|
497
556
|
];
|
|
498
557
|
}
|
|
499
558
|
static criticalPlaneBelow(e) {
|
|
@@ -510,23 +569,23 @@ class S {
|
|
|
510
569
|
* @param targetHue The hue of the color.
|
|
511
570
|
* @return The desired color, in linear RGB coordinates.
|
|
512
571
|
*/
|
|
513
|
-
static bisectToLimit(e,
|
|
514
|
-
const
|
|
515
|
-
let
|
|
572
|
+
static bisectToLimit(e, r) {
|
|
573
|
+
const t = S.bisectToSegment(e, r);
|
|
574
|
+
let n = t[0], s = S.hueOf(n), i = t[1];
|
|
516
575
|
for (let u = 0; u < 3; u++)
|
|
517
|
-
if (
|
|
576
|
+
if (n[u] !== i[u]) {
|
|
518
577
|
let l = -1, h = 255;
|
|
519
|
-
|
|
520
|
-
for (let
|
|
521
|
-
const
|
|
522
|
-
S.areInCyclicOrder(
|
|
578
|
+
n[u] < i[u] ? (l = S.criticalPlaneBelow(S.trueDelinearized(n[u])), h = S.criticalPlaneAbove(S.trueDelinearized(i[u]))) : (l = S.criticalPlaneAbove(S.trueDelinearized(n[u])), h = S.criticalPlaneBelow(S.trueDelinearized(i[u])));
|
|
579
|
+
for (let d = 0; d < 8 && !(Math.abs(h - l) <= 1); d++) {
|
|
580
|
+
const C = Math.floor((l + h) / 2), p = S.CRITICAL_PLANES[C], D = S.setCoordinate(n, p, i, u), m = S.hueOf(D);
|
|
581
|
+
S.areInCyclicOrder(s, r, m) ? (i = D, h = C) : (n = D, s = m, l = C);
|
|
523
582
|
}
|
|
524
583
|
}
|
|
525
|
-
return S.midpoint(
|
|
584
|
+
return S.midpoint(n, i);
|
|
526
585
|
}
|
|
527
586
|
static inverseChromaticAdaptation(e) {
|
|
528
|
-
const
|
|
529
|
-
return
|
|
587
|
+
const r = Math.abs(e), t = Math.max(0, 27.13 * r / (400 - r));
|
|
588
|
+
return z(e) * Math.pow(t, 1 / 0.42);
|
|
530
589
|
}
|
|
531
590
|
/**
|
|
532
591
|
* Finds a color with the given hue, chroma, and Y.
|
|
@@ -537,19 +596,19 @@ class S {
|
|
|
537
596
|
* @return The desired color as a hexadecimal integer, if found; 0
|
|
538
597
|
* otherwise.
|
|
539
598
|
*/
|
|
540
|
-
static findResultByJ(e,
|
|
541
|
-
let
|
|
542
|
-
const
|
|
543
|
-
for (let
|
|
544
|
-
const p =
|
|
599
|
+
static findResultByJ(e, r, t) {
|
|
600
|
+
let n = Math.sqrt(t) * 11;
|
|
601
|
+
const s = j.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, h = Math.sin(e), d = Math.cos(e);
|
|
602
|
+
for (let C = 0; C < 5; C++) {
|
|
603
|
+
const p = n / 100, D = r === 0 || n === 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, A = 23 * (P + 0.305) * m / (23 * l + 11 * m * d + 108 * m * h), B = A * d, O = A * h, R = (460 * P + 451 * B + 288 * O) / 1403, V = (460 * P - 891 * B - 261 * O) / 1403, I = (460 * P - 220 * B - 6300 * O) / 1403, x = S.inverseChromaticAdaptation(R), L = S.inverseChromaticAdaptation(V), _ = S.inverseChromaticAdaptation(I), E = ye([x, L, _], S.LINRGB_FROM_SCALED_DISCOUNT);
|
|
545
604
|
if (E[0] < 0 || E[1] < 0 || E[2] < 0)
|
|
546
605
|
return 0;
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
606
|
+
const q = S.Y_FROM_LINRGB[0], G = S.Y_FROM_LINRGB[1], ee = S.Y_FROM_LINRGB[2], K = q * E[0] + G * E[1] + ee * E[2];
|
|
607
|
+
if (K <= 0)
|
|
549
608
|
return 0;
|
|
550
|
-
if (
|
|
551
|
-
return E[0] > 100.01 || E[1] > 100.01 || E[2] > 100.01 ? 0 :
|
|
552
|
-
|
|
609
|
+
if (C === 4 || Math.abs(K - t) < 2e-3)
|
|
610
|
+
return E[0] > 100.01 || E[1] > 100.01 || E[2] > 100.01 ? 0 : Fe(E);
|
|
611
|
+
n = n - (K - t) * n / (2 * K);
|
|
553
612
|
}
|
|
554
613
|
return 0;
|
|
555
614
|
}
|
|
@@ -565,15 +624,15 @@ class S {
|
|
|
565
624
|
* values, if possible; otherwise, the hue and L* will be
|
|
566
625
|
* sufficiently close, and chroma will be maximized.
|
|
567
626
|
*/
|
|
568
|
-
static solveToInt(e,
|
|
569
|
-
if (
|
|
570
|
-
return
|
|
571
|
-
e =
|
|
572
|
-
const
|
|
627
|
+
static solveToInt(e, r, t) {
|
|
628
|
+
if (r < 1e-4 || t < 1e-4 || t > 99.9999)
|
|
629
|
+
return Ze(t);
|
|
630
|
+
e = ce(e);
|
|
631
|
+
const n = e / 180 * Math.PI, s = Z(t), i = S.findResultByJ(n, r, s);
|
|
573
632
|
if (i !== 0)
|
|
574
633
|
return i;
|
|
575
|
-
const u = S.bisectToLimit(
|
|
576
|
-
return
|
|
634
|
+
const u = S.bisectToLimit(s, n);
|
|
635
|
+
return Fe(u);
|
|
577
636
|
}
|
|
578
637
|
/**
|
|
579
638
|
* Finds an sRGB color with the given hue, chroma, and L*, if
|
|
@@ -587,8 +646,8 @@ class S {
|
|
|
587
646
|
* values, if possible; otherwise, the hue and L* will be
|
|
588
647
|
* sufficiently close, and chroma will be maximized.
|
|
589
648
|
*/
|
|
590
|
-
static solveToCam(e,
|
|
591
|
-
return
|
|
649
|
+
static solveToCam(e, r, t) {
|
|
650
|
+
return N.fromInt(S.solveToInt(e, r, t));
|
|
592
651
|
}
|
|
593
652
|
}
|
|
594
653
|
S.SCALED_DISCOUNT_FROM_LINRGB = [
|
|
@@ -899,16 +958,16 @@ S.CRITICAL_PLANES = [
|
|
|
899
958
|
* See the License for the specific language governing permissions and
|
|
900
959
|
* limitations under the License.
|
|
901
960
|
*/
|
|
902
|
-
class
|
|
903
|
-
static from(e,
|
|
904
|
-
return new
|
|
961
|
+
class T {
|
|
962
|
+
static from(e, r, t) {
|
|
963
|
+
return new T(S.solveToInt(e, r, t));
|
|
905
964
|
}
|
|
906
965
|
/**
|
|
907
966
|
* @param argb ARGB representation of a color.
|
|
908
967
|
* @return HCT representation of a color in default viewing conditions
|
|
909
968
|
*/
|
|
910
969
|
static fromInt(e) {
|
|
911
|
-
return new
|
|
970
|
+
return new T(e);
|
|
912
971
|
}
|
|
913
972
|
toInt() {
|
|
914
973
|
return this.argb;
|
|
@@ -952,8 +1011,8 @@ class C {
|
|
|
952
1011
|
this.setInternalState(S.solveToInt(this.internalHue, this.internalChroma, e));
|
|
953
1012
|
}
|
|
954
1013
|
/** Sets a property of the Hct object. */
|
|
955
|
-
setValue(e,
|
|
956
|
-
this[e] =
|
|
1014
|
+
setValue(e, r) {
|
|
1015
|
+
this[e] = r;
|
|
957
1016
|
}
|
|
958
1017
|
toString() {
|
|
959
1018
|
return `HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`;
|
|
@@ -969,12 +1028,12 @@ class C {
|
|
|
969
1028
|
}
|
|
970
1029
|
constructor(e) {
|
|
971
1030
|
this.argb = e;
|
|
972
|
-
const
|
|
973
|
-
this.internalHue =
|
|
1031
|
+
const r = N.fromInt(e);
|
|
1032
|
+
this.internalHue = r.hue, this.internalChroma = r.chroma, this.internalTone = ge(e), this.argb = e;
|
|
974
1033
|
}
|
|
975
1034
|
setInternalState(e) {
|
|
976
|
-
const
|
|
977
|
-
this.internalHue =
|
|
1035
|
+
const r = N.fromInt(e);
|
|
1036
|
+
this.internalHue = r.hue, this.internalChroma = r.chroma, this.internalTone = ge(e), this.argb = e;
|
|
978
1037
|
}
|
|
979
1038
|
/**
|
|
980
1039
|
* Translates a color into different [ViewingConditions].
|
|
@@ -991,8 +1050,8 @@ class C {
|
|
|
991
1050
|
* See [ViewingConditions.make] for parameters affecting color appearance.
|
|
992
1051
|
*/
|
|
993
1052
|
inViewingConditions(e) {
|
|
994
|
-
const
|
|
995
|
-
return
|
|
1053
|
+
const t = N.fromInt(this.toInt()).xyzInViewingConditions(e), n = N.fromXyzInViewingConditions(t[0], t[1], t[2], j.make());
|
|
1054
|
+
return T.from(n.hue, n.chroma, Pe(t[1]));
|
|
996
1055
|
}
|
|
997
1056
|
}
|
|
998
1057
|
/**
|
|
@@ -1011,7 +1070,7 @@ class C {
|
|
|
1011
1070
|
* See the License for the specific language governing permissions and
|
|
1012
1071
|
* limitations under the License.
|
|
1013
1072
|
*/
|
|
1014
|
-
class
|
|
1073
|
+
class Ce {
|
|
1015
1074
|
/**
|
|
1016
1075
|
* Blend the design color's HCT hue towards the key color's HCT
|
|
1017
1076
|
* hue, in a way that leaves the original color recognizable and
|
|
@@ -1023,9 +1082,9 @@ class Ve {
|
|
|
1023
1082
|
* system's color, a slightly warmer/cooler variant of the design
|
|
1024
1083
|
* color's hue.
|
|
1025
1084
|
*/
|
|
1026
|
-
static harmonize(e,
|
|
1027
|
-
const
|
|
1028
|
-
return
|
|
1085
|
+
static harmonize(e, r) {
|
|
1086
|
+
const t = T.fromInt(e), n = T.fromInt(r), s = qe(t.hue, n.hue), i = Math.min(s * 0.5, 15), u = ce(t.hue + i * je(t.hue, n.hue));
|
|
1087
|
+
return T.from(u, t.chroma, t.tone).toInt();
|
|
1029
1088
|
}
|
|
1030
1089
|
/**
|
|
1031
1090
|
* Blends hue from one color into another. The chroma and tone of
|
|
@@ -1037,9 +1096,9 @@ class Ve {
|
|
|
1037
1096
|
* @return from, with a hue blended towards to. Chroma and tone
|
|
1038
1097
|
* are constant.
|
|
1039
1098
|
*/
|
|
1040
|
-
static hctHue(e,
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1099
|
+
static hctHue(e, r, t) {
|
|
1100
|
+
const n = Ce.cam16Ucs(e, r, t), s = N.fromInt(n), i = N.fromInt(e);
|
|
1101
|
+
return T.from(s.hue, i.chroma, ge(e)).toInt();
|
|
1043
1102
|
}
|
|
1044
1103
|
/**
|
|
1045
1104
|
* Blend in CAM16-UCS space.
|
|
@@ -1050,9 +1109,9 @@ class Ve {
|
|
|
1050
1109
|
* @return from, blended towards to. Hue, chroma, and tone will
|
|
1051
1110
|
* change.
|
|
1052
1111
|
*/
|
|
1053
|
-
static cam16Ucs(e,
|
|
1054
|
-
const
|
|
1055
|
-
return
|
|
1112
|
+
static cam16Ucs(e, r, t) {
|
|
1113
|
+
const n = N.fromInt(e), s = N.fromInt(r), i = n.jstar, u = n.astar, l = n.bstar, h = s.jstar, d = s.astar, C = s.bstar, p = i + (h - i) * t, D = u + (d - u) * t, m = l + (C - l) * t;
|
|
1114
|
+
return N.fromUcs(p, D, m).toInt();
|
|
1056
1115
|
}
|
|
1057
1116
|
}
|
|
1058
1117
|
/**
|
|
@@ -1071,19 +1130,19 @@ class Ve {
|
|
|
1071
1130
|
* See the License for the specific language governing permissions and
|
|
1072
1131
|
* limitations under the License.
|
|
1073
1132
|
*/
|
|
1074
|
-
class
|
|
1133
|
+
class v {
|
|
1075
1134
|
/**
|
|
1076
1135
|
* Returns a contrast ratio, which ranges from 1 to 21.
|
|
1077
1136
|
*
|
|
1078
1137
|
* @param toneA Tone between 0 and 100. Values outside will be clamped.
|
|
1079
1138
|
* @param toneB Tone between 0 and 100. Values outside will be clamped.
|
|
1080
1139
|
*/
|
|
1081
|
-
static ratioOfTones(e,
|
|
1082
|
-
return e =
|
|
1140
|
+
static ratioOfTones(e, r) {
|
|
1141
|
+
return e = H(0, 100, e), r = H(0, 100, r), v.ratioOfYs(Z(e), Z(r));
|
|
1083
1142
|
}
|
|
1084
|
-
static ratioOfYs(e,
|
|
1085
|
-
const
|
|
1086
|
-
return (
|
|
1143
|
+
static ratioOfYs(e, r) {
|
|
1144
|
+
const t = e > r ? e : r, n = t === r ? e : r;
|
|
1145
|
+
return (t + 5) / (n + 5);
|
|
1087
1146
|
}
|
|
1088
1147
|
/**
|
|
1089
1148
|
* Returns a tone >= tone parameter that ensures ratio parameter.
|
|
@@ -1095,13 +1154,13 @@ class M {
|
|
|
1095
1154
|
* @param ratio Contrast ratio of return value and tone.
|
|
1096
1155
|
* Range is 1 to 21, invalid values have undefined behavior.
|
|
1097
1156
|
*/
|
|
1098
|
-
static lighter(e,
|
|
1157
|
+
static lighter(e, r) {
|
|
1099
1158
|
if (e < 0 || e > 100)
|
|
1100
1159
|
return -1;
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1160
|
+
const t = Z(e), n = r * (t + 5) - 5, s = v.ratioOfYs(n, t), i = Math.abs(s - r);
|
|
1161
|
+
if (s < r && i > 0.04)
|
|
1103
1162
|
return -1;
|
|
1104
|
-
const u =
|
|
1163
|
+
const u = Pe(n) + 0.4;
|
|
1105
1164
|
return u < 0 || u > 100 ? -1 : u;
|
|
1106
1165
|
}
|
|
1107
1166
|
/**
|
|
@@ -1114,13 +1173,13 @@ class M {
|
|
|
1114
1173
|
* @param ratio Contrast ratio of return value and tone.
|
|
1115
1174
|
* Range is 1 to 21, invalid values have undefined behavior.
|
|
1116
1175
|
*/
|
|
1117
|
-
static darker(e,
|
|
1176
|
+
static darker(e, r) {
|
|
1118
1177
|
if (e < 0 || e > 100)
|
|
1119
1178
|
return -1;
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1179
|
+
const t = Z(e), n = (t + 5) / r - 5, s = v.ratioOfYs(t, n), i = Math.abs(s - r);
|
|
1180
|
+
if (s < r && i > 0.04)
|
|
1122
1181
|
return -1;
|
|
1123
|
-
const u =
|
|
1182
|
+
const u = Pe(n) - 0.4;
|
|
1124
1183
|
return u < 0 || u > 100 ? -1 : u;
|
|
1125
1184
|
}
|
|
1126
1185
|
/**
|
|
@@ -1137,9 +1196,9 @@ class M {
|
|
|
1137
1196
|
* @param ratio Desired contrast ratio of return value and tone parameter.
|
|
1138
1197
|
* Range is 1 to 21, invalid values have undefined behavior.
|
|
1139
1198
|
*/
|
|
1140
|
-
static lighterUnsafe(e,
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1199
|
+
static lighterUnsafe(e, r) {
|
|
1200
|
+
const t = v.lighter(e, r);
|
|
1201
|
+
return t < 0 ? 100 : t;
|
|
1143
1202
|
}
|
|
1144
1203
|
/**
|
|
1145
1204
|
* Returns a tone >= tone parameter that ensures ratio parameter.
|
|
@@ -1155,9 +1214,9 @@ class M {
|
|
|
1155
1214
|
* @param ratio Desired contrast ratio of return value and tone parameter.
|
|
1156
1215
|
* Range is 1 to 21, invalid values have undefined behavior.
|
|
1157
1216
|
*/
|
|
1158
|
-
static darkerUnsafe(e,
|
|
1159
|
-
const
|
|
1160
|
-
return
|
|
1217
|
+
static darkerUnsafe(e, r) {
|
|
1218
|
+
const t = v.darker(e, r);
|
|
1219
|
+
return t < 0 ? 0 : t;
|
|
1161
1220
|
}
|
|
1162
1221
|
}
|
|
1163
1222
|
/**
|
|
@@ -1176,7 +1235,7 @@ class M {
|
|
|
1176
1235
|
* See the License for the specific language governing permissions and
|
|
1177
1236
|
* limitations under the License.
|
|
1178
1237
|
*/
|
|
1179
|
-
class
|
|
1238
|
+
class Se {
|
|
1180
1239
|
/**
|
|
1181
1240
|
* Returns true if a color is disliked.
|
|
1182
1241
|
*
|
|
@@ -1186,8 +1245,8 @@ class Ne {
|
|
|
1186
1245
|
* Disliked is defined as a dark yellow-green that is not neutral.
|
|
1187
1246
|
*/
|
|
1188
1247
|
static isDisliked(e) {
|
|
1189
|
-
const
|
|
1190
|
-
return
|
|
1248
|
+
const r = Math.round(e.hue) >= 90 && Math.round(e.hue) <= 111, t = Math.round(e.chroma) > 16, n = Math.round(e.tone) < 65;
|
|
1249
|
+
return r && t && n;
|
|
1191
1250
|
}
|
|
1192
1251
|
/**
|
|
1193
1252
|
* If a color is disliked, lighten it to make it likable.
|
|
@@ -1197,7 +1256,7 @@ class Ne {
|
|
|
1197
1256
|
* color if it is acceptable.
|
|
1198
1257
|
*/
|
|
1199
1258
|
static fixIfDisliked(e) {
|
|
1200
|
-
return
|
|
1259
|
+
return Se.isDisliked(e) ? T.from(e.hue, e.chroma, 70) : e;
|
|
1201
1260
|
}
|
|
1202
1261
|
}
|
|
1203
1262
|
/**
|
|
@@ -1216,37 +1275,37 @@ class Ne {
|
|
|
1216
1275
|
* See the License for the specific language governing permissions and
|
|
1217
1276
|
* limitations under the License.
|
|
1218
1277
|
*/
|
|
1219
|
-
function
|
|
1220
|
-
if (
|
|
1221
|
-
throw new Error(`Attempting to extend color ${
|
|
1222
|
-
if (
|
|
1223
|
-
throw new Error(`Attempting to extend color ${
|
|
1224
|
-
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1227
|
-
name:
|
|
1228
|
-
palette: (
|
|
1229
|
-
tone: (
|
|
1230
|
-
isBackground:
|
|
1231
|
-
chromaMultiplier: (
|
|
1232
|
-
const
|
|
1233
|
-
return
|
|
1278
|
+
function rr(a, e, r) {
|
|
1279
|
+
if (a.name !== r.name)
|
|
1280
|
+
throw new Error(`Attempting to extend color ${a.name} with color ${r.name} of different name for spec version ${e}.`);
|
|
1281
|
+
if (a.isBackground !== r.isBackground)
|
|
1282
|
+
throw new Error(`Attempting to extend color ${a.name} as a ${a.isBackground ? "background" : "foreground"} with color ${r.name} as a ${r.isBackground ? "background" : "foreground"} for spec version ${e}.`);
|
|
1283
|
+
}
|
|
1284
|
+
function b(a, e, r) {
|
|
1285
|
+
return rr(a, e, r), c.fromPalette({
|
|
1286
|
+
name: a.name,
|
|
1287
|
+
palette: (t) => t.specVersion === e ? r.palette(t) : a.palette(t),
|
|
1288
|
+
tone: (t) => t.specVersion === e ? r.tone(t) : a.tone(t),
|
|
1289
|
+
isBackground: a.isBackground,
|
|
1290
|
+
chromaMultiplier: (t) => {
|
|
1291
|
+
const n = t.specVersion === e ? r.chromaMultiplier : a.chromaMultiplier;
|
|
1292
|
+
return n !== void 0 ? n(t) : 1;
|
|
1234
1293
|
},
|
|
1235
|
-
background: (
|
|
1236
|
-
const
|
|
1237
|
-
return
|
|
1294
|
+
background: (t) => {
|
|
1295
|
+
const n = t.specVersion === e ? r.background : a.background;
|
|
1296
|
+
return n !== void 0 ? n(t) : void 0;
|
|
1238
1297
|
},
|
|
1239
|
-
secondBackground: (
|
|
1240
|
-
const
|
|
1241
|
-
return
|
|
1298
|
+
secondBackground: (t) => {
|
|
1299
|
+
const n = t.specVersion === e ? r.secondBackground : a.secondBackground;
|
|
1300
|
+
return n !== void 0 ? n(t) : void 0;
|
|
1242
1301
|
},
|
|
1243
|
-
contrastCurve: (
|
|
1244
|
-
const
|
|
1245
|
-
return
|
|
1302
|
+
contrastCurve: (t) => {
|
|
1303
|
+
const n = t.specVersion === e ? r.contrastCurve : a.contrastCurve;
|
|
1304
|
+
return n !== void 0 ? n(t) : void 0;
|
|
1246
1305
|
},
|
|
1247
|
-
toneDeltaPair: (
|
|
1248
|
-
const
|
|
1249
|
-
return
|
|
1306
|
+
toneDeltaPair: (t) => {
|
|
1307
|
+
const n = t.specVersion === e ? r.toneDeltaPair : a.toneDeltaPair;
|
|
1308
|
+
return n !== void 0 ? n(t) : void 0;
|
|
1250
1309
|
}
|
|
1251
1310
|
});
|
|
1252
1311
|
}
|
|
@@ -1261,7 +1320,7 @@ class c {
|
|
|
1261
1320
|
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);
|
|
1262
1321
|
}
|
|
1263
1322
|
static getInitialToneFromBackground(e) {
|
|
1264
|
-
return e === void 0 ? (
|
|
1323
|
+
return e === void 0 ? (r) => 50 : (r) => e(r) ? e(r).getTone(r) : 50;
|
|
1265
1324
|
}
|
|
1266
1325
|
/**
|
|
1267
1326
|
* The base constructor for DynamicColor.
|
|
@@ -1296,8 +1355,8 @@ class c {
|
|
|
1296
1355
|
* constraint between two colors. One of them must be the color being
|
|
1297
1356
|
* constructed.
|
|
1298
1357
|
*/
|
|
1299
|
-
constructor(e, t, n,
|
|
1300
|
-
if (this.name = e, this.palette =
|
|
1358
|
+
constructor(e, r, t, n, s, i, u, l, h) {
|
|
1359
|
+
if (this.name = e, this.palette = r, this.tone = t, this.isBackground = n, this.chromaMultiplier = s, this.background = i, this.secondBackground = u, this.contrastCurve = l, this.toneDeltaPair = h, this.hctCache = /* @__PURE__ */ new Map(), !i && u)
|
|
1301
1360
|
throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);
|
|
1302
1361
|
if (!i && l)
|
|
1303
1362
|
throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);
|
|
@@ -1346,11 +1405,11 @@ class c {
|
|
|
1346
1405
|
* contrast level is.
|
|
1347
1406
|
*/
|
|
1348
1407
|
getHct(e) {
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
return
|
|
1352
|
-
const
|
|
1353
|
-
return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(e,
|
|
1408
|
+
const r = this.hctCache.get(e);
|
|
1409
|
+
if (r != null)
|
|
1410
|
+
return r;
|
|
1411
|
+
const t = we(e.specVersion).getHct(e, this);
|
|
1412
|
+
return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(e, t), t;
|
|
1354
1413
|
}
|
|
1355
1414
|
/**
|
|
1356
1415
|
* Returns a tone, T in the HCT color space, that this DynamicColor is under
|
|
@@ -1361,7 +1420,7 @@ class c {
|
|
|
1361
1420
|
* contrast level is.
|
|
1362
1421
|
*/
|
|
1363
1422
|
getTone(e) {
|
|
1364
|
-
return
|
|
1423
|
+
return we(e.specVersion).getTone(e, this);
|
|
1365
1424
|
}
|
|
1366
1425
|
/**
|
|
1367
1426
|
* Given a background tone, finds a foreground tone, while ensuring they reach
|
|
@@ -1372,13 +1431,13 @@ class c {
|
|
|
1372
1431
|
* @param ratio The contrast ratio desired between bgTone and the return
|
|
1373
1432
|
* value.
|
|
1374
1433
|
*/
|
|
1375
|
-
static foregroundTone(e,
|
|
1376
|
-
const
|
|
1434
|
+
static foregroundTone(e, r) {
|
|
1435
|
+
const t = v.lighterUnsafe(e, r), n = v.darkerUnsafe(e, r), s = v.ratioOfTones(t, e), i = v.ratioOfTones(n, e);
|
|
1377
1436
|
if (c.tonePrefersLightForeground(e)) {
|
|
1378
|
-
const l = Math.abs(
|
|
1379
|
-
return
|
|
1437
|
+
const l = Math.abs(s - i) < 0.1 && s < r && i < r;
|
|
1438
|
+
return s >= r || s >= i || l ? t : n;
|
|
1380
1439
|
} else
|
|
1381
|
-
return i >=
|
|
1440
|
+
return i >= r || i >= s ? n : t;
|
|
1382
1441
|
}
|
|
1383
1442
|
/**
|
|
1384
1443
|
* Returns whether [tone] prefers a light foreground.
|
|
@@ -1409,76 +1468,76 @@ class c {
|
|
|
1409
1468
|
return c.tonePrefersLightForeground(e) && !c.toneAllowsLightForeground(e) ? 49 : e;
|
|
1410
1469
|
}
|
|
1411
1470
|
}
|
|
1412
|
-
class
|
|
1413
|
-
getHct(e,
|
|
1414
|
-
const
|
|
1415
|
-
return
|
|
1416
|
-
}
|
|
1417
|
-
getTone(e,
|
|
1418
|
-
const
|
|
1419
|
-
if (
|
|
1420
|
-
const
|
|
1421
|
-
let
|
|
1422
|
-
if (
|
|
1423
|
-
const
|
|
1424
|
-
if (
|
|
1425
|
-
const R =
|
|
1426
|
-
|
|
1471
|
+
class tr {
|
|
1472
|
+
getHct(e, r) {
|
|
1473
|
+
const t = r.getTone(e);
|
|
1474
|
+
return r.palette(e).getHct(t);
|
|
1475
|
+
}
|
|
1476
|
+
getTone(e, r) {
|
|
1477
|
+
const t = e.contrastLevel < 0, n = r.toneDeltaPair ? r.toneDeltaPair(e) : void 0;
|
|
1478
|
+
if (n) {
|
|
1479
|
+
const s = n.roleA, i = n.roleB, u = n.delta, l = n.polarity, h = n.stayTogether, d = l === "nearer" || l === "lighter" && !e.isDark || l === "darker" && e.isDark, C = d ? s : i, p = d ? i : s, D = r.name === C.name, m = e.isDark ? 1 : -1;
|
|
1480
|
+
let g = C.tone(e), P = p.tone(e);
|
|
1481
|
+
if (r.background && C.contrastCurve && p.contrastCurve) {
|
|
1482
|
+
const A = r.background(e), B = C.contrastCurve(e), O = p.contrastCurve(e);
|
|
1483
|
+
if (A && B && O) {
|
|
1484
|
+
const R = A.getTone(e), V = B.get(e.contrastLevel), I = O.get(e.contrastLevel);
|
|
1485
|
+
v.ratioOfTones(R, g) < V && (g = c.foregroundTone(R, V)), v.ratioOfTones(R, P) < I && (P = c.foregroundTone(R, I)), t && (g = c.foregroundTone(R, V), P = c.foregroundTone(R, I));
|
|
1427
1486
|
}
|
|
1428
1487
|
}
|
|
1429
|
-
return (
|
|
1488
|
+
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 && (h ? 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;
|
|
1430
1489
|
} else {
|
|
1431
|
-
let
|
|
1432
|
-
if (
|
|
1433
|
-
return
|
|
1434
|
-
const i =
|
|
1435
|
-
if (
|
|
1436
|
-
return
|
|
1437
|
-
const [l, h] = [
|
|
1438
|
-
if (
|
|
1439
|
-
return
|
|
1440
|
-
const m =
|
|
1441
|
-
return m !== -1 &&
|
|
1490
|
+
let s = r.tone(e);
|
|
1491
|
+
if (r.background == null || r.background(e) === void 0 || r.contrastCurve == null || r.contrastCurve(e) === void 0)
|
|
1492
|
+
return s;
|
|
1493
|
+
const i = r.background(e).getTone(e), u = r.contrastCurve(e).get(e.contrastLevel);
|
|
1494
|
+
if (v.ratioOfTones(i, s) >= u || (s = c.foregroundTone(i, u)), t && (s = c.foregroundTone(i, u)), r.isBackground && 50 <= s && s < 60 && (v.ratioOfTones(49, i) >= u ? s = 49 : s = 60), r.secondBackground == null || r.secondBackground(e) === void 0)
|
|
1495
|
+
return s;
|
|
1496
|
+
const [l, h] = [r.background, r.secondBackground], [d, C] = [l(e).getTone(e), h(e).getTone(e)], [p, D] = [Math.max(d, C), Math.min(d, C)];
|
|
1497
|
+
if (v.ratioOfTones(p, s) >= u && v.ratioOfTones(D, s) >= u)
|
|
1498
|
+
return s;
|
|
1499
|
+
const m = v.lighter(p, u), g = v.darker(D, u), P = [];
|
|
1500
|
+
return m !== -1 && P.push(m), g !== -1 && P.push(g), c.tonePrefersLightForeground(d) || c.tonePrefersLightForeground(C) ? m < 0 ? 100 : m : P.length === 1 ? P[0] : g < 0 ? 0 : g;
|
|
1442
1501
|
}
|
|
1443
1502
|
}
|
|
1444
1503
|
}
|
|
1445
|
-
class
|
|
1446
|
-
getHct(e,
|
|
1447
|
-
const
|
|
1448
|
-
return
|
|
1504
|
+
class nr {
|
|
1505
|
+
getHct(e, r) {
|
|
1506
|
+
const t = r.palette(e), n = r.getTone(e), s = t.hue, i = t.chroma * (r.chromaMultiplier ? r.chromaMultiplier(e) : 1);
|
|
1507
|
+
return T.from(s, i, n);
|
|
1449
1508
|
}
|
|
1450
|
-
getTone(e,
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1453
|
-
const
|
|
1454
|
-
let p =
|
|
1509
|
+
getTone(e, r) {
|
|
1510
|
+
const t = r.toneDeltaPair ? r.toneDeltaPair(e) : void 0;
|
|
1511
|
+
if (t) {
|
|
1512
|
+
const n = t.roleA, s = t.roleB, i = t.polarity, u = t.constraint, l = i === "darker" || i === "relative_lighter" && e.isDark || i === "relative_darker" && !e.isDark ? -t.delta : t.delta, h = r.name === n.name, d = h ? n : s, C = h ? s : n;
|
|
1513
|
+
let p = d.tone(e), D = C.getTone(e);
|
|
1455
1514
|
const m = l * (h ? 1 : -1);
|
|
1456
|
-
if (u === "exact" ? p =
|
|
1457
|
-
const
|
|
1458
|
-
if (
|
|
1459
|
-
const
|
|
1460
|
-
p =
|
|
1515
|
+
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) {
|
|
1516
|
+
const g = r.background(e), P = r.contrastCurve(e);
|
|
1517
|
+
if (g && P) {
|
|
1518
|
+
const A = g.getTone(e), B = P.get(e.contrastLevel);
|
|
1519
|
+
p = v.ratioOfTones(A, p) >= B && e.contrastLevel >= 0 ? p : c.foregroundTone(A, B);
|
|
1461
1520
|
}
|
|
1462
1521
|
}
|
|
1463
|
-
return
|
|
1522
|
+
return r.isBackground && !r.name.endsWith("_fixed_dim") && (p >= 57 ? p = H(65, 100, p) : p = H(0, 49, p)), p;
|
|
1464
1523
|
} else {
|
|
1465
|
-
let
|
|
1466
|
-
if (
|
|
1467
|
-
return
|
|
1468
|
-
const
|
|
1469
|
-
if (
|
|
1470
|
-
return
|
|
1471
|
-
const [u, l] = [
|
|
1472
|
-
if (
|
|
1473
|
-
return
|
|
1474
|
-
const
|
|
1475
|
-
return
|
|
1524
|
+
let n = r.tone(e);
|
|
1525
|
+
if (r.background == null || r.background(e) === void 0 || r.contrastCurve == null || r.contrastCurve(e) === void 0)
|
|
1526
|
+
return n;
|
|
1527
|
+
const s = r.background(e).getTone(e), i = r.contrastCurve(e).get(e.contrastLevel);
|
|
1528
|
+
if (n = v.ratioOfTones(s, n) >= i && e.contrastLevel >= 0 ? n : c.foregroundTone(s, i), r.isBackground && !r.name.endsWith("_fixed_dim") && (n >= 57 ? n = H(65, 100, n) : n = H(0, 49, n)), r.secondBackground == null || r.secondBackground(e) === void 0)
|
|
1529
|
+
return n;
|
|
1530
|
+
const [u, l] = [r.background, r.secondBackground], [h, d] = [u(e).getTone(e), l(e).getTone(e)], [C, p] = [Math.max(h, d), Math.min(h, d)];
|
|
1531
|
+
if (v.ratioOfTones(C, n) >= i && v.ratioOfTones(p, n) >= i)
|
|
1532
|
+
return n;
|
|
1533
|
+
const D = v.lighter(C, i), m = v.darker(p, i), g = [];
|
|
1534
|
+
return D !== -1 && g.push(D), m !== -1 && g.push(m), c.tonePrefersLightForeground(h) || c.tonePrefersLightForeground(d) ? D < 0 ? 100 : D : g.length === 1 ? g[0] : m < 0 ? 0 : m;
|
|
1476
1535
|
}
|
|
1477
1536
|
}
|
|
1478
1537
|
}
|
|
1479
|
-
const
|
|
1480
|
-
function
|
|
1481
|
-
return
|
|
1538
|
+
const ar = new tr(), or = new nr();
|
|
1539
|
+
function we(a) {
|
|
1540
|
+
return a === "2025" ? or : ar;
|
|
1482
1541
|
}
|
|
1483
1542
|
/**
|
|
1484
1543
|
* @license
|
|
@@ -1502,8 +1561,8 @@ class Y {
|
|
|
1502
1561
|
* @return Tones matching that color's hue and chroma.
|
|
1503
1562
|
*/
|
|
1504
1563
|
static fromInt(e) {
|
|
1505
|
-
const
|
|
1506
|
-
return Y.fromHct(
|
|
1564
|
+
const r = T.fromInt(e);
|
|
1565
|
+
return Y.fromHct(r);
|
|
1507
1566
|
}
|
|
1508
1567
|
/**
|
|
1509
1568
|
* @param hct Hct
|
|
@@ -1517,36 +1576,36 @@ class Y {
|
|
|
1517
1576
|
* @param chroma HCT chroma
|
|
1518
1577
|
* @return Tones matching hue and chroma.
|
|
1519
1578
|
*/
|
|
1520
|
-
static fromHueAndChroma(e,
|
|
1521
|
-
const
|
|
1522
|
-
return new Y(e,
|
|
1579
|
+
static fromHueAndChroma(e, r) {
|
|
1580
|
+
const t = new ir(e, r).create();
|
|
1581
|
+
return new Y(e, r, t);
|
|
1523
1582
|
}
|
|
1524
|
-
constructor(e,
|
|
1525
|
-
this.hue = e, this.chroma =
|
|
1583
|
+
constructor(e, r, t) {
|
|
1584
|
+
this.hue = e, this.chroma = r, this.keyColor = t, this.cache = /* @__PURE__ */ new Map();
|
|
1526
1585
|
}
|
|
1527
1586
|
/**
|
|
1528
1587
|
* @param tone HCT tone, measured from 0 to 100.
|
|
1529
1588
|
* @return ARGB representation of a color with that tone.
|
|
1530
1589
|
*/
|
|
1531
1590
|
tone(e) {
|
|
1532
|
-
let
|
|
1533
|
-
return
|
|
1591
|
+
let r = this.cache.get(e);
|
|
1592
|
+
return r === void 0 && (e == 99 && T.isYellow(this.hue) ? r = this.averageArgb(this.tone(98), this.tone(100)) : r = T.from(this.hue, this.chroma, e).toInt(), this.cache.set(e, r)), r;
|
|
1534
1593
|
}
|
|
1535
1594
|
/**
|
|
1536
1595
|
* @param tone HCT tone.
|
|
1537
1596
|
* @return HCT representation of a color with that tone.
|
|
1538
1597
|
*/
|
|
1539
1598
|
getHct(e) {
|
|
1540
|
-
return
|
|
1599
|
+
return T.fromInt(this.tone(e));
|
|
1541
1600
|
}
|
|
1542
|
-
averageArgb(e,
|
|
1543
|
-
const
|
|
1544
|
-
return (255 << 24 | (h & 255) << 16 | (
|
|
1601
|
+
averageArgb(e, r) {
|
|
1602
|
+
const t = e >>> 16 & 255, n = e >>> 8 & 255, s = e & 255, i = r >>> 16 & 255, u = r >>> 8 & 255, l = r & 255, h = Math.round((t + i) / 2), d = Math.round((n + u) / 2), C = Math.round((s + l) / 2);
|
|
1603
|
+
return (255 << 24 | (h & 255) << 16 | (d & 255) << 8 | C & 255) >>> 0;
|
|
1545
1604
|
}
|
|
1546
1605
|
}
|
|
1547
|
-
class
|
|
1548
|
-
constructor(e,
|
|
1549
|
-
this.hue = e, this.requestedChroma =
|
|
1606
|
+
class ir {
|
|
1607
|
+
constructor(e, r) {
|
|
1608
|
+
this.hue = e, this.requestedChroma = r, this.chromaCache = /* @__PURE__ */ new Map(), this.maxChromaValue = 200;
|
|
1550
1609
|
}
|
|
1551
1610
|
/**
|
|
1552
1611
|
* Creates a key color from a [hue] and a [chroma].
|
|
@@ -1556,28 +1615,28 @@ class Vt {
|
|
|
1556
1615
|
* @return Key color [Hct]
|
|
1557
1616
|
*/
|
|
1558
1617
|
create() {
|
|
1559
|
-
let
|
|
1560
|
-
for (;
|
|
1561
|
-
const i = Math.floor((
|
|
1618
|
+
let n = 0, s = 100;
|
|
1619
|
+
for (; n < s; ) {
|
|
1620
|
+
const i = Math.floor((n + s) / 2), u = this.maxChroma(i) < this.maxChroma(i + 1);
|
|
1562
1621
|
if (this.maxChroma(i) >= this.requestedChroma - 0.01)
|
|
1563
|
-
if (Math.abs(
|
|
1564
|
-
|
|
1622
|
+
if (Math.abs(n - 50) < Math.abs(s - 50))
|
|
1623
|
+
s = i;
|
|
1565
1624
|
else {
|
|
1566
|
-
if (
|
|
1567
|
-
return
|
|
1568
|
-
|
|
1625
|
+
if (n === i)
|
|
1626
|
+
return T.from(this.hue, this.requestedChroma, n);
|
|
1627
|
+
n = i;
|
|
1569
1628
|
}
|
|
1570
1629
|
else
|
|
1571
|
-
u ?
|
|
1630
|
+
u ? n = i + 1 : s = i;
|
|
1572
1631
|
}
|
|
1573
|
-
return
|
|
1632
|
+
return T.from(this.hue, this.requestedChroma, n);
|
|
1574
1633
|
}
|
|
1575
1634
|
// Find the maximum chroma for a given tone
|
|
1576
1635
|
maxChroma(e) {
|
|
1577
1636
|
if (this.chromaCache.has(e))
|
|
1578
1637
|
return this.chromaCache.get(e);
|
|
1579
|
-
const
|
|
1580
|
-
return this.chromaCache.set(e,
|
|
1638
|
+
const r = T.from(this.hue, this.maxChromaValue, e).chroma;
|
|
1639
|
+
return this.chromaCache.set(e, r), r;
|
|
1581
1640
|
}
|
|
1582
1641
|
}
|
|
1583
1642
|
/**
|
|
@@ -1605,8 +1664,8 @@ class y {
|
|
|
1605
1664
|
* @param medium Value for contrast level 0.5
|
|
1606
1665
|
* @param high Value for contrast level 1.0
|
|
1607
1666
|
*/
|
|
1608
|
-
constructor(e, t, n
|
|
1609
|
-
this.low = e, this.normal =
|
|
1667
|
+
constructor(e, r, t, n) {
|
|
1668
|
+
this.low = e, this.normal = r, this.medium = t, this.high = n;
|
|
1610
1669
|
}
|
|
1611
1670
|
/**
|
|
1612
1671
|
* Returns the value at a given contrast level.
|
|
@@ -1616,7 +1675,7 @@ class y {
|
|
|
1616
1675
|
* @return The value. For contrast ratios, a number between 1.0 and 21.0.
|
|
1617
1676
|
*/
|
|
1618
1677
|
get(e) {
|
|
1619
|
-
return e <= -1 ? this.low : e < 0 ?
|
|
1678
|
+
return e <= -1 ? this.low : e < 0 ? ne(this.low, this.normal, (e - -1) / 1) : e < 0.5 ? ne(this.normal, this.medium, (e - 0) / 0.5) : e < 1 ? ne(this.medium, this.high, (e - 0.5) / 0.5) : this.high;
|
|
1620
1679
|
}
|
|
1621
1680
|
}
|
|
1622
1681
|
/**
|
|
@@ -1661,8 +1720,8 @@ class w {
|
|
|
1661
1720
|
* of the "awkward zone" (T50-59). This is necessary for certain cases where
|
|
1662
1721
|
* one role has two backgrounds.
|
|
1663
1722
|
*/
|
|
1664
|
-
constructor(e, t, n,
|
|
1665
|
-
this.roleA = e, this.roleB =
|
|
1723
|
+
constructor(e, r, t, n, s, i) {
|
|
1724
|
+
this.roleA = e, this.roleB = r, this.delta = t, this.polarity = n, this.stayTogether = s, this.constraint = i, this.constraint = i ?? "exact";
|
|
1666
1725
|
}
|
|
1667
1726
|
}
|
|
1668
1727
|
/**
|
|
@@ -1681,10 +1740,10 @@ class w {
|
|
|
1681
1740
|
* See the License for the specific language governing permissions and
|
|
1682
1741
|
* limitations under the License.
|
|
1683
1742
|
*/
|
|
1684
|
-
var
|
|
1685
|
-
(function(
|
|
1686
|
-
|
|
1687
|
-
})(
|
|
1743
|
+
var f;
|
|
1744
|
+
(function(a) {
|
|
1745
|
+
a[a.MONOCHROME = 0] = "MONOCHROME", a[a.NEUTRAL = 1] = "NEUTRAL", a[a.TONAL_SPOT = 2] = "TONAL_SPOT", a[a.VIBRANT = 3] = "VIBRANT", a[a.EXPRESSIVE = 4] = "EXPRESSIVE", a[a.FIDELITY = 5] = "FIDELITY", a[a.CONTENT = 6] = "CONTENT", a[a.RAINBOW = 7] = "RAINBOW", a[a.FRUIT_SALAD = 8] = "FRUIT_SALAD";
|
|
1746
|
+
})(f || (f = {}));
|
|
1688
1747
|
/**
|
|
1689
1748
|
* @license
|
|
1690
1749
|
* Copyright 2025 Google LLC
|
|
@@ -1701,28 +1760,28 @@ var d;
|
|
|
1701
1760
|
* See the License for the specific language governing permissions and
|
|
1702
1761
|
* limitations under the License.
|
|
1703
1762
|
*/
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
1706
|
-
}
|
|
1707
|
-
function
|
|
1708
|
-
return
|
|
1709
|
-
}
|
|
1710
|
-
function
|
|
1711
|
-
let
|
|
1712
|
-
if (
|
|
1713
|
-
let i =
|
|
1714
|
-
for (;
|
|
1715
|
-
|
|
1716
|
-
const u =
|
|
1763
|
+
function re(a) {
|
|
1764
|
+
return a.variant === f.FIDELITY || a.variant === f.CONTENT;
|
|
1765
|
+
}
|
|
1766
|
+
function M(a) {
|
|
1767
|
+
return a.variant === f.MONOCHROME;
|
|
1768
|
+
}
|
|
1769
|
+
function sr(a, e, r, t) {
|
|
1770
|
+
let n = r, s = T.from(a, e, r);
|
|
1771
|
+
if (s.chroma < e) {
|
|
1772
|
+
let i = s.chroma;
|
|
1773
|
+
for (; s.chroma < e; ) {
|
|
1774
|
+
n += t ? -1 : 1;
|
|
1775
|
+
const u = T.from(a, e, n);
|
|
1717
1776
|
if (i > u.chroma || Math.abs(u.chroma - e) < 0.4)
|
|
1718
1777
|
break;
|
|
1719
|
-
const l = Math.abs(u.chroma - e), h = Math.abs(
|
|
1720
|
-
l < h && (
|
|
1778
|
+
const l = Math.abs(u.chroma - e), h = Math.abs(s.chroma - e);
|
|
1779
|
+
l < h && (s = u), i = Math.max(i, u.chroma);
|
|
1721
1780
|
}
|
|
1722
1781
|
}
|
|
1723
|
-
return
|
|
1782
|
+
return n;
|
|
1724
1783
|
}
|
|
1725
|
-
class
|
|
1784
|
+
class cr {
|
|
1726
1785
|
////////////////////////////////////////////////////////////////
|
|
1727
1786
|
// Main Palettes //
|
|
1728
1787
|
////////////////////////////////////////////////////////////////
|
|
@@ -1942,7 +2001,7 @@ class _t {
|
|
|
1942
2001
|
return c.fromPalette({
|
|
1943
2002
|
name: "primary",
|
|
1944
2003
|
palette: (e) => e.primaryPalette,
|
|
1945
|
-
tone: (e) =>
|
|
2004
|
+
tone: (e) => M(e) ? e.isDark ? 100 : 0 : e.isDark ? 80 : 40,
|
|
1946
2005
|
isBackground: !0,
|
|
1947
2006
|
background: (e) => this.highestSurface(e),
|
|
1948
2007
|
contrastCurve: (e) => new y(3, 4.5, 7, 7),
|
|
@@ -1955,7 +2014,7 @@ class _t {
|
|
|
1955
2014
|
return c.fromPalette({
|
|
1956
2015
|
name: "on_primary",
|
|
1957
2016
|
palette: (e) => e.primaryPalette,
|
|
1958
|
-
tone: (e) =>
|
|
2017
|
+
tone: (e) => M(e) ? e.isDark ? 10 : 90 : e.isDark ? 20 : 100,
|
|
1959
2018
|
background: (e) => this.primary(),
|
|
1960
2019
|
contrastCurve: (e) => new y(4.5, 7, 11, 21)
|
|
1961
2020
|
});
|
|
@@ -1964,7 +2023,7 @@ class _t {
|
|
|
1964
2023
|
return c.fromPalette({
|
|
1965
2024
|
name: "primary_container",
|
|
1966
2025
|
palette: (e) => e.primaryPalette,
|
|
1967
|
-
tone: (e) =>
|
|
2026
|
+
tone: (e) => re(e) ? e.sourceColorHct.tone : M(e) ? e.isDark ? 85 : 25 : e.isDark ? 30 : 90,
|
|
1968
2027
|
isBackground: !0,
|
|
1969
2028
|
background: (e) => this.highestSurface(e),
|
|
1970
2029
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -1975,7 +2034,7 @@ class _t {
|
|
|
1975
2034
|
return c.fromPalette({
|
|
1976
2035
|
name: "on_primary_container",
|
|
1977
2036
|
palette: (e) => e.primaryPalette,
|
|
1978
|
-
tone: (e) =>
|
|
2037
|
+
tone: (e) => re(e) ? c.foregroundTone(this.primaryContainer().tone(e), 4.5) : M(e) ? e.isDark ? 0 : 100 : e.isDark ? 90 : 30,
|
|
1979
2038
|
background: (e) => this.primaryContainer(),
|
|
1980
2039
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
1981
2040
|
});
|
|
@@ -2009,7 +2068,7 @@ class _t {
|
|
|
2009
2068
|
return c.fromPalette({
|
|
2010
2069
|
name: "on_secondary",
|
|
2011
2070
|
palette: (e) => e.secondaryPalette,
|
|
2012
|
-
tone: (e) =>
|
|
2071
|
+
tone: (e) => M(e) ? e.isDark ? 10 : 100 : e.isDark ? 20 : 100,
|
|
2013
2072
|
background: (e) => this.secondary(),
|
|
2014
2073
|
contrastCurve: (e) => new y(4.5, 7, 11, 21)
|
|
2015
2074
|
});
|
|
@@ -2019,8 +2078,8 @@ class _t {
|
|
|
2019
2078
|
name: "secondary_container",
|
|
2020
2079
|
palette: (e) => e.secondaryPalette,
|
|
2021
2080
|
tone: (e) => {
|
|
2022
|
-
const
|
|
2023
|
-
return
|
|
2081
|
+
const r = e.isDark ? 30 : 90;
|
|
2082
|
+
return M(e) ? e.isDark ? 30 : 85 : re(e) ? sr(e.secondaryPalette.hue, e.secondaryPalette.chroma, r, !e.isDark) : r;
|
|
2024
2083
|
},
|
|
2025
2084
|
isBackground: !0,
|
|
2026
2085
|
background: (e) => this.highestSurface(e),
|
|
@@ -2032,7 +2091,7 @@ class _t {
|
|
|
2032
2091
|
return c.fromPalette({
|
|
2033
2092
|
name: "on_secondary_container",
|
|
2034
2093
|
palette: (e) => e.secondaryPalette,
|
|
2035
|
-
tone: (e) =>
|
|
2094
|
+
tone: (e) => M(e) ? e.isDark ? 90 : 10 : re(e) ? c.foregroundTone(this.secondaryContainer().tone(e), 4.5) : e.isDark ? 90 : 30,
|
|
2036
2095
|
background: (e) => this.secondaryContainer(),
|
|
2037
2096
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
2038
2097
|
});
|
|
@@ -2044,7 +2103,7 @@ class _t {
|
|
|
2044
2103
|
return c.fromPalette({
|
|
2045
2104
|
name: "tertiary",
|
|
2046
2105
|
palette: (e) => e.tertiaryPalette,
|
|
2047
|
-
tone: (e) =>
|
|
2106
|
+
tone: (e) => M(e) ? e.isDark ? 90 : 25 : e.isDark ? 80 : 40,
|
|
2048
2107
|
isBackground: !0,
|
|
2049
2108
|
background: (e) => this.highestSurface(e),
|
|
2050
2109
|
contrastCurve: (e) => new y(3, 4.5, 7, 7),
|
|
@@ -2057,7 +2116,7 @@ class _t {
|
|
|
2057
2116
|
return c.fromPalette({
|
|
2058
2117
|
name: "on_tertiary",
|
|
2059
2118
|
palette: (e) => e.tertiaryPalette,
|
|
2060
|
-
tone: (e) =>
|
|
2119
|
+
tone: (e) => M(e) ? e.isDark ? 10 : 90 : e.isDark ? 20 : 100,
|
|
2061
2120
|
background: (e) => this.tertiary(),
|
|
2062
2121
|
contrastCurve: (e) => new y(4.5, 7, 11, 21)
|
|
2063
2122
|
});
|
|
@@ -2067,12 +2126,12 @@ class _t {
|
|
|
2067
2126
|
name: "tertiary_container",
|
|
2068
2127
|
palette: (e) => e.tertiaryPalette,
|
|
2069
2128
|
tone: (e) => {
|
|
2070
|
-
if (
|
|
2129
|
+
if (M(e))
|
|
2071
2130
|
return e.isDark ? 60 : 49;
|
|
2072
|
-
if (!
|
|
2131
|
+
if (!re(e))
|
|
2073
2132
|
return e.isDark ? 30 : 90;
|
|
2074
|
-
const
|
|
2075
|
-
return
|
|
2133
|
+
const r = e.tertiaryPalette.getHct(e.sourceColorHct.tone);
|
|
2134
|
+
return Se.fixIfDisliked(r).tone;
|
|
2076
2135
|
},
|
|
2077
2136
|
isBackground: !0,
|
|
2078
2137
|
background: (e) => this.highestSurface(e),
|
|
@@ -2084,7 +2143,7 @@ class _t {
|
|
|
2084
2143
|
return c.fromPalette({
|
|
2085
2144
|
name: "on_tertiary_container",
|
|
2086
2145
|
palette: (e) => e.tertiaryPalette,
|
|
2087
|
-
tone: (e) =>
|
|
2146
|
+
tone: (e) => M(e) ? e.isDark ? 0 : 100 : re(e) ? c.foregroundTone(this.tertiaryContainer().tone(e), 4.5) : e.isDark ? 90 : 30,
|
|
2088
2147
|
background: (e) => this.tertiaryContainer(),
|
|
2089
2148
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
2090
2149
|
});
|
|
@@ -2129,7 +2188,7 @@ class _t {
|
|
|
2129
2188
|
return c.fromPalette({
|
|
2130
2189
|
name: "on_error_container",
|
|
2131
2190
|
palette: (e) => e.errorPalette,
|
|
2132
|
-
tone: (e) =>
|
|
2191
|
+
tone: (e) => M(e) ? e.isDark ? 90 : 10 : e.isDark ? 90 : 30,
|
|
2133
2192
|
background: (e) => this.errorContainer(),
|
|
2134
2193
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
2135
2194
|
});
|
|
@@ -2141,7 +2200,7 @@ class _t {
|
|
|
2141
2200
|
return c.fromPalette({
|
|
2142
2201
|
name: "primary_fixed",
|
|
2143
2202
|
palette: (e) => e.primaryPalette,
|
|
2144
|
-
tone: (e) =>
|
|
2203
|
+
tone: (e) => M(e) ? 40 : 90,
|
|
2145
2204
|
isBackground: !0,
|
|
2146
2205
|
background: (e) => this.highestSurface(e),
|
|
2147
2206
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2152,7 +2211,7 @@ class _t {
|
|
|
2152
2211
|
return c.fromPalette({
|
|
2153
2212
|
name: "primary_fixed_dim",
|
|
2154
2213
|
palette: (e) => e.primaryPalette,
|
|
2155
|
-
tone: (e) =>
|
|
2214
|
+
tone: (e) => M(e) ? 30 : 80,
|
|
2156
2215
|
isBackground: !0,
|
|
2157
2216
|
background: (e) => this.highestSurface(e),
|
|
2158
2217
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2163,7 +2222,7 @@ class _t {
|
|
|
2163
2222
|
return c.fromPalette({
|
|
2164
2223
|
name: "on_primary_fixed",
|
|
2165
2224
|
palette: (e) => e.primaryPalette,
|
|
2166
|
-
tone: (e) =>
|
|
2225
|
+
tone: (e) => M(e) ? 100 : 10,
|
|
2167
2226
|
background: (e) => this.primaryFixedDim(),
|
|
2168
2227
|
secondBackground: (e) => this.primaryFixed(),
|
|
2169
2228
|
contrastCurve: (e) => new y(4.5, 7, 11, 21)
|
|
@@ -2173,7 +2232,7 @@ class _t {
|
|
|
2173
2232
|
return c.fromPalette({
|
|
2174
2233
|
name: "on_primary_fixed_variant",
|
|
2175
2234
|
palette: (e) => e.primaryPalette,
|
|
2176
|
-
tone: (e) =>
|
|
2235
|
+
tone: (e) => M(e) ? 90 : 30,
|
|
2177
2236
|
background: (e) => this.primaryFixedDim(),
|
|
2178
2237
|
secondBackground: (e) => this.primaryFixed(),
|
|
2179
2238
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
@@ -2186,7 +2245,7 @@ class _t {
|
|
|
2186
2245
|
return c.fromPalette({
|
|
2187
2246
|
name: "secondary_fixed",
|
|
2188
2247
|
palette: (e) => e.secondaryPalette,
|
|
2189
|
-
tone: (e) =>
|
|
2248
|
+
tone: (e) => M(e) ? 80 : 90,
|
|
2190
2249
|
isBackground: !0,
|
|
2191
2250
|
background: (e) => this.highestSurface(e),
|
|
2192
2251
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2197,7 +2256,7 @@ class _t {
|
|
|
2197
2256
|
return c.fromPalette({
|
|
2198
2257
|
name: "secondary_fixed_dim",
|
|
2199
2258
|
palette: (e) => e.secondaryPalette,
|
|
2200
|
-
tone: (e) =>
|
|
2259
|
+
tone: (e) => M(e) ? 70 : 80,
|
|
2201
2260
|
isBackground: !0,
|
|
2202
2261
|
background: (e) => this.highestSurface(e),
|
|
2203
2262
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2218,7 +2277,7 @@ class _t {
|
|
|
2218
2277
|
return c.fromPalette({
|
|
2219
2278
|
name: "on_secondary_fixed_variant",
|
|
2220
2279
|
palette: (e) => e.secondaryPalette,
|
|
2221
|
-
tone: (e) =>
|
|
2280
|
+
tone: (e) => M(e) ? 25 : 30,
|
|
2222
2281
|
background: (e) => this.secondaryFixedDim(),
|
|
2223
2282
|
secondBackground: (e) => this.secondaryFixed(),
|
|
2224
2283
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
@@ -2231,7 +2290,7 @@ class _t {
|
|
|
2231
2290
|
return c.fromPalette({
|
|
2232
2291
|
name: "tertiary_fixed",
|
|
2233
2292
|
palette: (e) => e.tertiaryPalette,
|
|
2234
|
-
tone: (e) =>
|
|
2293
|
+
tone: (e) => M(e) ? 40 : 90,
|
|
2235
2294
|
isBackground: !0,
|
|
2236
2295
|
background: (e) => this.highestSurface(e),
|
|
2237
2296
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2242,7 +2301,7 @@ class _t {
|
|
|
2242
2301
|
return c.fromPalette({
|
|
2243
2302
|
name: "tertiary_fixed_dim",
|
|
2244
2303
|
palette: (e) => e.tertiaryPalette,
|
|
2245
|
-
tone: (e) =>
|
|
2304
|
+
tone: (e) => M(e) ? 30 : 80,
|
|
2246
2305
|
isBackground: !0,
|
|
2247
2306
|
background: (e) => this.highestSurface(e),
|
|
2248
2307
|
contrastCurve: (e) => new y(1, 1, 3, 4.5),
|
|
@@ -2253,7 +2312,7 @@ class _t {
|
|
|
2253
2312
|
return c.fromPalette({
|
|
2254
2313
|
name: "on_tertiary_fixed",
|
|
2255
2314
|
palette: (e) => e.tertiaryPalette,
|
|
2256
|
-
tone: (e) =>
|
|
2315
|
+
tone: (e) => M(e) ? 100 : 10,
|
|
2257
2316
|
background: (e) => this.tertiaryFixedDim(),
|
|
2258
2317
|
secondBackground: (e) => this.tertiaryFixed(),
|
|
2259
2318
|
contrastCurve: (e) => new y(4.5, 7, 11, 21)
|
|
@@ -2263,7 +2322,7 @@ class _t {
|
|
|
2263
2322
|
return c.fromPalette({
|
|
2264
2323
|
name: "on_tertiary_fixed_variant",
|
|
2265
2324
|
palette: (e) => e.tertiaryPalette,
|
|
2266
|
-
tone: (e) =>
|
|
2325
|
+
tone: (e) => M(e) ? 90 : 30,
|
|
2267
2326
|
background: (e) => this.tertiaryFixedDim(),
|
|
2268
2327
|
secondBackground: (e) => this.tertiaryFixed(),
|
|
2269
2328
|
contrastCurve: (e) => new y(3, 4.5, 7, 11)
|
|
@@ -2292,266 +2351,266 @@ class _t {
|
|
|
2292
2351
|
* See the License for the specific language governing permissions and
|
|
2293
2352
|
* limitations under the License.
|
|
2294
2353
|
*/
|
|
2295
|
-
function
|
|
2296
|
-
let
|
|
2297
|
-
return
|
|
2354
|
+
function F(a, e = 0, r = 100, t = 1) {
|
|
2355
|
+
let n = Me(a.hue, a.chroma * t, 100, !0);
|
|
2356
|
+
return H(e, r, n);
|
|
2298
2357
|
}
|
|
2299
|
-
function
|
|
2300
|
-
let
|
|
2301
|
-
return
|
|
2358
|
+
function W(a, e = 0, r = 100) {
|
|
2359
|
+
let t = Me(a.hue, a.chroma, 0, !1);
|
|
2360
|
+
return H(e, r, t);
|
|
2302
2361
|
}
|
|
2303
|
-
function
|
|
2304
|
-
let
|
|
2305
|
-
for (;
|
|
2306
|
-
|
|
2307
|
-
const i =
|
|
2308
|
-
|
|
2309
|
-
}
|
|
2310
|
-
return
|
|
2362
|
+
function Me(a, e, r, t) {
|
|
2363
|
+
let n = r, s = T.from(a, e, n);
|
|
2364
|
+
for (; s.chroma < e && !(r < 0 || r > 100); ) {
|
|
2365
|
+
r += t ? -1 : 1;
|
|
2366
|
+
const i = T.from(a, e, r);
|
|
2367
|
+
s.chroma < i.chroma && (s = i, n = r);
|
|
2368
|
+
}
|
|
2369
|
+
return n;
|
|
2311
2370
|
}
|
|
2312
|
-
function
|
|
2313
|
-
return
|
|
2371
|
+
function k(a) {
|
|
2372
|
+
return a === 1.5 ? new y(1.5, 1.5, 3, 5.5) : a === 3 ? new y(3, 3, 4.5, 7) : a === 4.5 ? new y(4.5, 4.5, 7, 11) : a === 6 ? new y(6, 6, 7, 11) : a === 7 ? new y(7, 7, 11, 21) : a === 9 ? new y(9, 9, 11, 21) : a === 11 ? new y(11, 11, 21, 21) : a === 21 ? new y(21, 21, 21, 21) : new y(a, a, 7, 21);
|
|
2314
2373
|
}
|
|
2315
|
-
class
|
|
2374
|
+
class ur extends cr {
|
|
2316
2375
|
////////////////////////////////////////////////////////////////
|
|
2317
2376
|
// Surfaces [S] //
|
|
2318
2377
|
////////////////////////////////////////////////////////////////
|
|
2319
2378
|
surface() {
|
|
2320
2379
|
const e = c.fromPalette({
|
|
2321
2380
|
name: "surface",
|
|
2322
|
-
palette: (
|
|
2323
|
-
tone: (
|
|
2381
|
+
palette: (r) => r.neutralPalette,
|
|
2382
|
+
tone: (r) => (super.surface().tone(r), r.platform === "phone" ? r.isDark ? 4 : T.isYellow(r.neutralPalette.hue) ? 99 : r.variant === f.VIBRANT ? 97 : 98 : 0),
|
|
2324
2383
|
isBackground: !0
|
|
2325
2384
|
});
|
|
2326
|
-
return
|
|
2385
|
+
return b(super.surface(), "2025", e);
|
|
2327
2386
|
}
|
|
2328
2387
|
surfaceDim() {
|
|
2329
2388
|
const e = c.fromPalette({
|
|
2330
2389
|
name: "surface_dim",
|
|
2331
|
-
palette: (
|
|
2332
|
-
tone: (
|
|
2390
|
+
palette: (r) => r.neutralPalette,
|
|
2391
|
+
tone: (r) => r.isDark ? 4 : T.isYellow(r.neutralPalette.hue) ? 90 : r.variant === f.VIBRANT ? 85 : 87,
|
|
2333
2392
|
isBackground: !0,
|
|
2334
|
-
chromaMultiplier: (
|
|
2335
|
-
if (!
|
|
2336
|
-
if (
|
|
2393
|
+
chromaMultiplier: (r) => {
|
|
2394
|
+
if (!r.isDark) {
|
|
2395
|
+
if (r.variant === f.NEUTRAL)
|
|
2337
2396
|
return 2.5;
|
|
2338
|
-
if (
|
|
2397
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2339
2398
|
return 1.7;
|
|
2340
|
-
if (
|
|
2341
|
-
return
|
|
2342
|
-
if (
|
|
2399
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2400
|
+
return T.isYellow(r.neutralPalette.hue) ? 2.7 : 1.75;
|
|
2401
|
+
if (r.variant === f.VIBRANT)
|
|
2343
2402
|
return 1.36;
|
|
2344
2403
|
}
|
|
2345
2404
|
return 1;
|
|
2346
2405
|
}
|
|
2347
2406
|
});
|
|
2348
|
-
return
|
|
2407
|
+
return b(super.surfaceDim(), "2025", e);
|
|
2349
2408
|
}
|
|
2350
2409
|
surfaceBright() {
|
|
2351
2410
|
const e = c.fromPalette({
|
|
2352
2411
|
name: "surface_bright",
|
|
2353
|
-
palette: (
|
|
2354
|
-
tone: (
|
|
2412
|
+
palette: (r) => r.neutralPalette,
|
|
2413
|
+
tone: (r) => r.isDark ? 18 : T.isYellow(r.neutralPalette.hue) ? 99 : r.variant === f.VIBRANT ? 97 : 98,
|
|
2355
2414
|
isBackground: !0,
|
|
2356
|
-
chromaMultiplier: (
|
|
2357
|
-
if (
|
|
2358
|
-
if (
|
|
2415
|
+
chromaMultiplier: (r) => {
|
|
2416
|
+
if (r.isDark) {
|
|
2417
|
+
if (r.variant === f.NEUTRAL)
|
|
2359
2418
|
return 2.5;
|
|
2360
|
-
if (
|
|
2419
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2361
2420
|
return 1.7;
|
|
2362
|
-
if (
|
|
2363
|
-
return
|
|
2364
|
-
if (
|
|
2421
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2422
|
+
return T.isYellow(r.neutralPalette.hue) ? 2.7 : 1.75;
|
|
2423
|
+
if (r.variant === f.VIBRANT)
|
|
2365
2424
|
return 1.36;
|
|
2366
2425
|
}
|
|
2367
2426
|
return 1;
|
|
2368
2427
|
}
|
|
2369
2428
|
});
|
|
2370
|
-
return
|
|
2429
|
+
return b(super.surfaceBright(), "2025", e);
|
|
2371
2430
|
}
|
|
2372
2431
|
surfaceContainerLowest() {
|
|
2373
2432
|
const e = c.fromPalette({
|
|
2374
2433
|
name: "surface_container_lowest",
|
|
2375
|
-
palette: (
|
|
2376
|
-
tone: (
|
|
2434
|
+
palette: (r) => r.neutralPalette,
|
|
2435
|
+
tone: (r) => r.isDark ? 0 : 100,
|
|
2377
2436
|
isBackground: !0
|
|
2378
2437
|
});
|
|
2379
|
-
return
|
|
2438
|
+
return b(super.surfaceContainerLowest(), "2025", e);
|
|
2380
2439
|
}
|
|
2381
2440
|
surfaceContainerLow() {
|
|
2382
2441
|
const e = c.fromPalette({
|
|
2383
2442
|
name: "surface_container_low",
|
|
2384
|
-
palette: (
|
|
2385
|
-
tone: (
|
|
2443
|
+
palette: (r) => r.neutralPalette,
|
|
2444
|
+
tone: (r) => r.platform === "phone" ? r.isDark ? 6 : T.isYellow(r.neutralPalette.hue) ? 98 : r.variant === f.VIBRANT ? 95 : 96 : 15,
|
|
2386
2445
|
isBackground: !0,
|
|
2387
|
-
chromaMultiplier: (
|
|
2388
|
-
if (
|
|
2389
|
-
if (
|
|
2446
|
+
chromaMultiplier: (r) => {
|
|
2447
|
+
if (r.platform === "phone") {
|
|
2448
|
+
if (r.variant === f.NEUTRAL)
|
|
2390
2449
|
return 1.3;
|
|
2391
|
-
if (
|
|
2450
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2392
2451
|
return 1.25;
|
|
2393
|
-
if (
|
|
2394
|
-
return
|
|
2395
|
-
if (
|
|
2452
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2453
|
+
return T.isYellow(r.neutralPalette.hue) ? 1.3 : 1.15;
|
|
2454
|
+
if (r.variant === f.VIBRANT)
|
|
2396
2455
|
return 1.08;
|
|
2397
2456
|
}
|
|
2398
2457
|
return 1;
|
|
2399
2458
|
}
|
|
2400
2459
|
});
|
|
2401
|
-
return
|
|
2460
|
+
return b(super.surfaceContainerLow(), "2025", e);
|
|
2402
2461
|
}
|
|
2403
2462
|
surfaceContainer() {
|
|
2404
2463
|
const e = c.fromPalette({
|
|
2405
2464
|
name: "surface_container",
|
|
2406
|
-
palette: (
|
|
2407
|
-
tone: (
|
|
2465
|
+
palette: (r) => r.neutralPalette,
|
|
2466
|
+
tone: (r) => r.platform === "phone" ? r.isDark ? 9 : T.isYellow(r.neutralPalette.hue) ? 96 : r.variant === f.VIBRANT ? 92 : 94 : 20,
|
|
2408
2467
|
isBackground: !0,
|
|
2409
|
-
chromaMultiplier: (
|
|
2410
|
-
if (
|
|
2411
|
-
if (
|
|
2468
|
+
chromaMultiplier: (r) => {
|
|
2469
|
+
if (r.platform === "phone") {
|
|
2470
|
+
if (r.variant === f.NEUTRAL)
|
|
2412
2471
|
return 1.6;
|
|
2413
|
-
if (
|
|
2472
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2414
2473
|
return 1.4;
|
|
2415
|
-
if (
|
|
2416
|
-
return
|
|
2417
|
-
if (
|
|
2474
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2475
|
+
return T.isYellow(r.neutralPalette.hue) ? 1.6 : 1.3;
|
|
2476
|
+
if (r.variant === f.VIBRANT)
|
|
2418
2477
|
return 1.15;
|
|
2419
2478
|
}
|
|
2420
2479
|
return 1;
|
|
2421
2480
|
}
|
|
2422
2481
|
});
|
|
2423
|
-
return
|
|
2482
|
+
return b(super.surfaceContainer(), "2025", e);
|
|
2424
2483
|
}
|
|
2425
2484
|
surfaceContainerHigh() {
|
|
2426
2485
|
const e = c.fromPalette({
|
|
2427
2486
|
name: "surface_container_high",
|
|
2428
|
-
palette: (
|
|
2429
|
-
tone: (
|
|
2487
|
+
palette: (r) => r.neutralPalette,
|
|
2488
|
+
tone: (r) => r.platform === "phone" ? r.isDark ? 12 : T.isYellow(r.neutralPalette.hue) ? 94 : r.variant === f.VIBRANT ? 90 : 92 : 25,
|
|
2430
2489
|
isBackground: !0,
|
|
2431
|
-
chromaMultiplier: (
|
|
2432
|
-
if (
|
|
2433
|
-
if (
|
|
2490
|
+
chromaMultiplier: (r) => {
|
|
2491
|
+
if (r.platform === "phone") {
|
|
2492
|
+
if (r.variant === f.NEUTRAL)
|
|
2434
2493
|
return 1.9;
|
|
2435
|
-
if (
|
|
2494
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2436
2495
|
return 1.5;
|
|
2437
|
-
if (
|
|
2438
|
-
return
|
|
2439
|
-
if (
|
|
2496
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2497
|
+
return T.isYellow(r.neutralPalette.hue) ? 1.95 : 1.45;
|
|
2498
|
+
if (r.variant === f.VIBRANT)
|
|
2440
2499
|
return 1.22;
|
|
2441
2500
|
}
|
|
2442
2501
|
return 1;
|
|
2443
2502
|
}
|
|
2444
2503
|
});
|
|
2445
|
-
return
|
|
2504
|
+
return b(super.surfaceContainerHigh(), "2025", e);
|
|
2446
2505
|
}
|
|
2447
2506
|
surfaceContainerHighest() {
|
|
2448
2507
|
const e = c.fromPalette({
|
|
2449
2508
|
name: "surface_container_highest",
|
|
2450
|
-
palette: (
|
|
2451
|
-
tone: (
|
|
2509
|
+
palette: (r) => r.neutralPalette,
|
|
2510
|
+
tone: (r) => r.isDark ? 15 : T.isYellow(r.neutralPalette.hue) ? 92 : r.variant === f.VIBRANT ? 88 : 90,
|
|
2452
2511
|
isBackground: !0,
|
|
2453
|
-
chromaMultiplier: (
|
|
2512
|
+
chromaMultiplier: (r) => r.variant === f.NEUTRAL ? 2.2 : r.variant === f.TONAL_SPOT ? 1.7 : r.variant === f.EXPRESSIVE ? T.isYellow(r.neutralPalette.hue) ? 2.3 : 1.6 : r.variant === f.VIBRANT ? 1.29 : 1
|
|
2454
2513
|
});
|
|
2455
|
-
return
|
|
2514
|
+
return b(super.surfaceContainerHighest(), "2025", e);
|
|
2456
2515
|
}
|
|
2457
2516
|
onSurface() {
|
|
2458
2517
|
const e = c.fromPalette({
|
|
2459
2518
|
name: "on_surface",
|
|
2460
|
-
palette: (
|
|
2461
|
-
tone: (
|
|
2462
|
-
chromaMultiplier: (
|
|
2463
|
-
if (
|
|
2464
|
-
if (
|
|
2519
|
+
palette: (r) => r.neutralPalette,
|
|
2520
|
+
tone: (r) => r.variant === f.VIBRANT ? F(r.neutralPalette, 0, 100, 1.1) : c.getInitialToneFromBackground((t) => t.platform === "phone" ? this.highestSurface(t) : this.surfaceContainerHigh())(r),
|
|
2521
|
+
chromaMultiplier: (r) => {
|
|
2522
|
+
if (r.platform === "phone") {
|
|
2523
|
+
if (r.variant === f.NEUTRAL)
|
|
2465
2524
|
return 2.2;
|
|
2466
|
-
if (
|
|
2525
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2467
2526
|
return 1.7;
|
|
2468
|
-
if (
|
|
2469
|
-
return
|
|
2527
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2528
|
+
return T.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
|
|
2470
2529
|
}
|
|
2471
2530
|
return 1;
|
|
2472
2531
|
},
|
|
2473
|
-
background: (
|
|
2474
|
-
contrastCurve: (
|
|
2532
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2533
|
+
contrastCurve: (r) => r.isDark && r.platform === "phone" ? k(11) : k(9)
|
|
2475
2534
|
});
|
|
2476
|
-
return
|
|
2535
|
+
return b(super.onSurface(), "2025", e);
|
|
2477
2536
|
}
|
|
2478
2537
|
onSurfaceVariant() {
|
|
2479
2538
|
const e = c.fromPalette({
|
|
2480
2539
|
name: "on_surface_variant",
|
|
2481
|
-
palette: (
|
|
2482
|
-
chromaMultiplier: (
|
|
2483
|
-
if (
|
|
2484
|
-
if (
|
|
2540
|
+
palette: (r) => r.neutralPalette,
|
|
2541
|
+
chromaMultiplier: (r) => {
|
|
2542
|
+
if (r.platform === "phone") {
|
|
2543
|
+
if (r.variant === f.NEUTRAL)
|
|
2485
2544
|
return 2.2;
|
|
2486
|
-
if (
|
|
2545
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2487
2546
|
return 1.7;
|
|
2488
|
-
if (
|
|
2489
|
-
return
|
|
2547
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2548
|
+
return T.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
|
|
2490
2549
|
}
|
|
2491
2550
|
return 1;
|
|
2492
2551
|
},
|
|
2493
|
-
background: (
|
|
2494
|
-
contrastCurve: (
|
|
2552
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2553
|
+
contrastCurve: (r) => r.platform === "phone" ? r.isDark ? k(6) : k(4.5) : k(7)
|
|
2495
2554
|
});
|
|
2496
|
-
return
|
|
2555
|
+
return b(super.onSurfaceVariant(), "2025", e);
|
|
2497
2556
|
}
|
|
2498
2557
|
outline() {
|
|
2499
2558
|
const e = c.fromPalette({
|
|
2500
2559
|
name: "outline",
|
|
2501
|
-
palette: (
|
|
2502
|
-
chromaMultiplier: (
|
|
2503
|
-
if (
|
|
2504
|
-
if (
|
|
2560
|
+
palette: (r) => r.neutralPalette,
|
|
2561
|
+
chromaMultiplier: (r) => {
|
|
2562
|
+
if (r.platform === "phone") {
|
|
2563
|
+
if (r.variant === f.NEUTRAL)
|
|
2505
2564
|
return 2.2;
|
|
2506
|
-
if (
|
|
2565
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2507
2566
|
return 1.7;
|
|
2508
|
-
if (
|
|
2509
|
-
return
|
|
2567
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2568
|
+
return T.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
|
|
2510
2569
|
}
|
|
2511
2570
|
return 1;
|
|
2512
2571
|
},
|
|
2513
|
-
background: (
|
|
2514
|
-
contrastCurve: (
|
|
2572
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2573
|
+
contrastCurve: (r) => r.platform === "phone" ? k(3) : k(4.5)
|
|
2515
2574
|
});
|
|
2516
|
-
return
|
|
2575
|
+
return b(super.outline(), "2025", e);
|
|
2517
2576
|
}
|
|
2518
2577
|
outlineVariant() {
|
|
2519
2578
|
const e = c.fromPalette({
|
|
2520
2579
|
name: "outline_variant",
|
|
2521
|
-
palette: (
|
|
2522
|
-
chromaMultiplier: (
|
|
2523
|
-
if (
|
|
2524
|
-
if (
|
|
2580
|
+
palette: (r) => r.neutralPalette,
|
|
2581
|
+
chromaMultiplier: (r) => {
|
|
2582
|
+
if (r.platform === "phone") {
|
|
2583
|
+
if (r.variant === f.NEUTRAL)
|
|
2525
2584
|
return 2.2;
|
|
2526
|
-
if (
|
|
2585
|
+
if (r.variant === f.TONAL_SPOT)
|
|
2527
2586
|
return 1.7;
|
|
2528
|
-
if (
|
|
2529
|
-
return
|
|
2587
|
+
if (r.variant === f.EXPRESSIVE)
|
|
2588
|
+
return T.isYellow(r.neutralPalette.hue) ? r.isDark ? 3 : 2.3 : 1.6;
|
|
2530
2589
|
}
|
|
2531
2590
|
return 1;
|
|
2532
2591
|
},
|
|
2533
|
-
background: (
|
|
2534
|
-
contrastCurve: (
|
|
2592
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2593
|
+
contrastCurve: (r) => r.platform === "phone" ? k(1.5) : k(3)
|
|
2535
2594
|
});
|
|
2536
|
-
return
|
|
2595
|
+
return b(super.outlineVariant(), "2025", e);
|
|
2537
2596
|
}
|
|
2538
2597
|
inverseSurface() {
|
|
2539
2598
|
const e = c.fromPalette({
|
|
2540
2599
|
name: "inverse_surface",
|
|
2541
|
-
palette: (
|
|
2542
|
-
tone: (
|
|
2600
|
+
palette: (r) => r.neutralPalette,
|
|
2601
|
+
tone: (r) => r.isDark ? 98 : 4,
|
|
2543
2602
|
isBackground: !0
|
|
2544
2603
|
});
|
|
2545
|
-
return
|
|
2604
|
+
return b(super.inverseSurface(), "2025", e);
|
|
2546
2605
|
}
|
|
2547
2606
|
inverseOnSurface() {
|
|
2548
2607
|
const e = c.fromPalette({
|
|
2549
2608
|
name: "inverse_on_surface",
|
|
2550
|
-
palette: (
|
|
2551
|
-
background: (
|
|
2552
|
-
contrastCurve: (
|
|
2609
|
+
palette: (r) => r.neutralPalette,
|
|
2610
|
+
background: (r) => this.inverseSurface(),
|
|
2611
|
+
contrastCurve: (r) => k(7)
|
|
2553
2612
|
});
|
|
2554
|
-
return
|
|
2613
|
+
return b(super.inverseOnSurface(), "2025", e);
|
|
2555
2614
|
}
|
|
2556
2615
|
////////////////////////////////////////////////////////////////
|
|
2557
2616
|
// Primaries [P] //
|
|
@@ -2559,107 +2618,107 @@ class Ht extends _t {
|
|
|
2559
2618
|
primary() {
|
|
2560
2619
|
const e = c.fromPalette({
|
|
2561
2620
|
name: "primary",
|
|
2562
|
-
palette: (
|
|
2563
|
-
tone: (
|
|
2621
|
+
palette: (r) => r.primaryPalette,
|
|
2622
|
+
tone: (r) => r.variant === f.NEUTRAL ? r.platform === "phone" ? r.isDark ? 80 : 40 : 90 : r.variant === f.TONAL_SPOT ? r.platform === "phone" ? r.isDark ? 80 : F(r.primaryPalette) : F(r.primaryPalette, 0, 90) : r.variant === f.EXPRESSIVE ? r.platform === "phone" ? F(r.primaryPalette, 0, T.isYellow(r.primaryPalette.hue) ? 25 : T.isCyan(r.primaryPalette.hue) ? 88 : 98) : F(r.primaryPalette) : r.platform === "phone" ? F(r.primaryPalette, 0, T.isCyan(r.primaryPalette.hue) ? 88 : 98) : F(r.primaryPalette),
|
|
2564
2623
|
isBackground: !0,
|
|
2565
|
-
background: (
|
|
2566
|
-
contrastCurve: (
|
|
2567
|
-
toneDeltaPair: (
|
|
2624
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2625
|
+
contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
|
|
2626
|
+
toneDeltaPair: (r) => r.platform === "phone" ? new w(this.primaryContainer(), this.primary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
2568
2627
|
});
|
|
2569
|
-
return
|
|
2628
|
+
return b(super.primary(), "2025", e);
|
|
2570
2629
|
}
|
|
2571
2630
|
primaryDim() {
|
|
2572
2631
|
return c.fromPalette({
|
|
2573
2632
|
name: "primary_dim",
|
|
2574
2633
|
palette: (e) => e.primaryPalette,
|
|
2575
|
-
tone: (e) => e.variant ===
|
|
2634
|
+
tone: (e) => e.variant === f.NEUTRAL ? 85 : e.variant === f.TONAL_SPOT ? F(e.primaryPalette, 0, 90) : F(e.primaryPalette),
|
|
2576
2635
|
isBackground: !0,
|
|
2577
2636
|
background: (e) => this.surfaceContainerHigh(),
|
|
2578
|
-
contrastCurve: (e) =>
|
|
2637
|
+
contrastCurve: (e) => k(4.5),
|
|
2579
2638
|
toneDeltaPair: (e) => new w(this.primaryDim(), this.primary(), 5, "darker", !0, "farther")
|
|
2580
2639
|
});
|
|
2581
2640
|
}
|
|
2582
2641
|
onPrimary() {
|
|
2583
2642
|
const e = c.fromPalette({
|
|
2584
2643
|
name: "on_primary",
|
|
2585
|
-
palette: (
|
|
2586
|
-
background: (
|
|
2587
|
-
contrastCurve: (
|
|
2644
|
+
palette: (r) => r.primaryPalette,
|
|
2645
|
+
background: (r) => r.platform === "phone" ? this.primary() : this.primaryDim(),
|
|
2646
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2588
2647
|
});
|
|
2589
|
-
return
|
|
2648
|
+
return b(super.onPrimary(), "2025", e);
|
|
2590
2649
|
}
|
|
2591
2650
|
primaryContainer() {
|
|
2592
2651
|
const e = c.fromPalette({
|
|
2593
2652
|
name: "primary_container",
|
|
2594
|
-
palette: (
|
|
2595
|
-
tone: (
|
|
2653
|
+
palette: (r) => r.primaryPalette,
|
|
2654
|
+
tone: (r) => r.platform === "watch" ? 30 : r.variant === f.NEUTRAL ? r.isDark ? 30 : 90 : r.variant === f.TONAL_SPOT ? r.isDark ? W(r.primaryPalette, 35, 93) : F(r.primaryPalette, 0, 90) : r.variant === f.EXPRESSIVE ? r.isDark ? F(r.primaryPalette, 30, 93) : F(r.primaryPalette, 78, T.isCyan(r.primaryPalette.hue) ? 88 : 90) : r.isDark ? W(r.primaryPalette, 66, 93) : F(r.primaryPalette, 66, T.isCyan(r.primaryPalette.hue) ? 88 : 93),
|
|
2596
2655
|
isBackground: !0,
|
|
2597
|
-
background: (
|
|
2598
|
-
toneDeltaPair: (
|
|
2599
|
-
contrastCurve: (
|
|
2656
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2657
|
+
toneDeltaPair: (r) => r.platform === "phone" ? void 0 : new w(this.primaryContainer(), this.primaryDim(), 10, "darker", !0, "farther"),
|
|
2658
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2600
2659
|
});
|
|
2601
|
-
return
|
|
2660
|
+
return b(super.primaryContainer(), "2025", e);
|
|
2602
2661
|
}
|
|
2603
2662
|
onPrimaryContainer() {
|
|
2604
2663
|
const e = c.fromPalette({
|
|
2605
2664
|
name: "on_primary_container",
|
|
2606
|
-
palette: (
|
|
2607
|
-
background: (
|
|
2608
|
-
contrastCurve: (
|
|
2665
|
+
palette: (r) => r.primaryPalette,
|
|
2666
|
+
background: (r) => this.primaryContainer(),
|
|
2667
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2609
2668
|
});
|
|
2610
|
-
return
|
|
2669
|
+
return b(super.onPrimaryContainer(), "2025", e);
|
|
2611
2670
|
}
|
|
2612
2671
|
primaryFixed() {
|
|
2613
2672
|
const e = c.fromPalette({
|
|
2614
2673
|
name: "primary_fixed",
|
|
2615
|
-
palette: (
|
|
2616
|
-
tone: (
|
|
2617
|
-
let
|
|
2618
|
-
return this.primaryContainer().getTone(
|
|
2674
|
+
palette: (r) => r.primaryPalette,
|
|
2675
|
+
tone: (r) => {
|
|
2676
|
+
let t = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
|
|
2677
|
+
return this.primaryContainer().getTone(t);
|
|
2619
2678
|
},
|
|
2620
2679
|
isBackground: !0,
|
|
2621
|
-
background: (
|
|
2622
|
-
contrastCurve: (
|
|
2680
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2681
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2623
2682
|
});
|
|
2624
|
-
return
|
|
2683
|
+
return b(super.primaryFixed(), "2025", e);
|
|
2625
2684
|
}
|
|
2626
2685
|
primaryFixedDim() {
|
|
2627
2686
|
const e = c.fromPalette({
|
|
2628
2687
|
name: "primary_fixed_dim",
|
|
2629
|
-
palette: (
|
|
2630
|
-
tone: (
|
|
2688
|
+
palette: (r) => r.primaryPalette,
|
|
2689
|
+
tone: (r) => this.primaryFixed().getTone(r),
|
|
2631
2690
|
isBackground: !0,
|
|
2632
|
-
toneDeltaPair: (
|
|
2691
|
+
toneDeltaPair: (r) => new w(this.primaryFixedDim(), this.primaryFixed(), 5, "darker", !0, "exact")
|
|
2633
2692
|
});
|
|
2634
|
-
return
|
|
2693
|
+
return b(super.primaryFixedDim(), "2025", e);
|
|
2635
2694
|
}
|
|
2636
2695
|
onPrimaryFixed() {
|
|
2637
2696
|
const e = c.fromPalette({
|
|
2638
2697
|
name: "on_primary_fixed",
|
|
2639
|
-
palette: (
|
|
2640
|
-
background: (
|
|
2641
|
-
contrastCurve: (
|
|
2698
|
+
palette: (r) => r.primaryPalette,
|
|
2699
|
+
background: (r) => this.primaryFixedDim(),
|
|
2700
|
+
contrastCurve: (r) => k(7)
|
|
2642
2701
|
});
|
|
2643
|
-
return
|
|
2702
|
+
return b(super.onPrimaryFixed(), "2025", e);
|
|
2644
2703
|
}
|
|
2645
2704
|
onPrimaryFixedVariant() {
|
|
2646
2705
|
const e = c.fromPalette({
|
|
2647
2706
|
name: "on_primary_fixed_variant",
|
|
2648
|
-
palette: (
|
|
2649
|
-
background: (
|
|
2650
|
-
contrastCurve: (
|
|
2707
|
+
palette: (r) => r.primaryPalette,
|
|
2708
|
+
background: (r) => this.primaryFixedDim(),
|
|
2709
|
+
contrastCurve: (r) => k(4.5)
|
|
2651
2710
|
});
|
|
2652
|
-
return
|
|
2711
|
+
return b(super.onPrimaryFixedVariant(), "2025", e);
|
|
2653
2712
|
}
|
|
2654
2713
|
inversePrimary() {
|
|
2655
2714
|
const e = c.fromPalette({
|
|
2656
2715
|
name: "inverse_primary",
|
|
2657
|
-
palette: (
|
|
2658
|
-
tone: (
|
|
2659
|
-
background: (
|
|
2660
|
-
contrastCurve: (
|
|
2716
|
+
palette: (r) => r.primaryPalette,
|
|
2717
|
+
tone: (r) => F(r.primaryPalette),
|
|
2718
|
+
background: (r) => this.inverseSurface(),
|
|
2719
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2661
2720
|
});
|
|
2662
|
-
return
|
|
2721
|
+
return b(super.inversePrimary(), "2025", e);
|
|
2663
2722
|
}
|
|
2664
2723
|
////////////////////////////////////////////////////////////////
|
|
2665
2724
|
// Secondaries [Q] //
|
|
@@ -2667,97 +2726,97 @@ class Ht extends _t {
|
|
|
2667
2726
|
secondary() {
|
|
2668
2727
|
const e = c.fromPalette({
|
|
2669
2728
|
name: "secondary",
|
|
2670
|
-
palette: (
|
|
2671
|
-
tone: (
|
|
2729
|
+
palette: (r) => r.secondaryPalette,
|
|
2730
|
+
tone: (r) => r.platform === "watch" ? r.variant === f.NEUTRAL ? 90 : F(r.secondaryPalette, 0, 90) : r.variant === f.NEUTRAL ? r.isDark ? W(r.secondaryPalette, 0, 98) : F(r.secondaryPalette) : r.variant === f.VIBRANT ? F(r.secondaryPalette, 0, r.isDark ? 90 : 98) : r.isDark ? 80 : F(r.secondaryPalette),
|
|
2672
2731
|
isBackground: !0,
|
|
2673
|
-
background: (
|
|
2674
|
-
contrastCurve: (
|
|
2675
|
-
toneDeltaPair: (
|
|
2732
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2733
|
+
contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
|
|
2734
|
+
toneDeltaPair: (r) => r.platform === "phone" ? new w(this.secondaryContainer(), this.secondary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
2676
2735
|
});
|
|
2677
|
-
return
|
|
2736
|
+
return b(super.secondary(), "2025", e);
|
|
2678
2737
|
}
|
|
2679
2738
|
secondaryDim() {
|
|
2680
2739
|
return c.fromPalette({
|
|
2681
2740
|
name: "secondary_dim",
|
|
2682
2741
|
palette: (e) => e.secondaryPalette,
|
|
2683
|
-
tone: (e) => e.variant ===
|
|
2742
|
+
tone: (e) => e.variant === f.NEUTRAL ? 85 : F(e.secondaryPalette, 0, 90),
|
|
2684
2743
|
isBackground: !0,
|
|
2685
2744
|
background: (e) => this.surfaceContainerHigh(),
|
|
2686
|
-
contrastCurve: (e) =>
|
|
2745
|
+
contrastCurve: (e) => k(4.5),
|
|
2687
2746
|
toneDeltaPair: (e) => new w(this.secondaryDim(), this.secondary(), 5, "darker", !0, "farther")
|
|
2688
2747
|
});
|
|
2689
2748
|
}
|
|
2690
2749
|
onSecondary() {
|
|
2691
2750
|
const e = c.fromPalette({
|
|
2692
2751
|
name: "on_secondary",
|
|
2693
|
-
palette: (
|
|
2694
|
-
background: (
|
|
2695
|
-
contrastCurve: (
|
|
2752
|
+
palette: (r) => r.secondaryPalette,
|
|
2753
|
+
background: (r) => r.platform === "phone" ? this.secondary() : this.secondaryDim(),
|
|
2754
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2696
2755
|
});
|
|
2697
|
-
return
|
|
2756
|
+
return b(super.onSecondary(), "2025", e);
|
|
2698
2757
|
}
|
|
2699
2758
|
secondaryContainer() {
|
|
2700
2759
|
const e = c.fromPalette({
|
|
2701
2760
|
name: "secondary_container",
|
|
2702
|
-
palette: (
|
|
2703
|
-
tone: (
|
|
2761
|
+
palette: (r) => r.secondaryPalette,
|
|
2762
|
+
tone: (r) => r.platform === "watch" ? 30 : r.variant === f.VIBRANT ? r.isDark ? W(r.secondaryPalette, 30, 40) : F(r.secondaryPalette, 84, 90) : r.variant === f.EXPRESSIVE ? r.isDark ? 15 : F(r.secondaryPalette, 90, 95) : r.isDark ? 25 : 90,
|
|
2704
2763
|
isBackground: !0,
|
|
2705
|
-
background: (
|
|
2706
|
-
toneDeltaPair: (
|
|
2707
|
-
contrastCurve: (
|
|
2764
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2765
|
+
toneDeltaPair: (r) => r.platform === "watch" ? new w(this.secondaryContainer(), this.secondaryDim(), 10, "darker", !0, "farther") : void 0,
|
|
2766
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2708
2767
|
});
|
|
2709
|
-
return
|
|
2768
|
+
return b(super.secondaryContainer(), "2025", e);
|
|
2710
2769
|
}
|
|
2711
2770
|
onSecondaryContainer() {
|
|
2712
2771
|
const e = c.fromPalette({
|
|
2713
2772
|
name: "on_secondary_container",
|
|
2714
|
-
palette: (
|
|
2715
|
-
background: (
|
|
2716
|
-
contrastCurve: (
|
|
2773
|
+
palette: (r) => r.secondaryPalette,
|
|
2774
|
+
background: (r) => this.secondaryContainer(),
|
|
2775
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2717
2776
|
});
|
|
2718
|
-
return
|
|
2777
|
+
return b(super.onSecondaryContainer(), "2025", e);
|
|
2719
2778
|
}
|
|
2720
2779
|
secondaryFixed() {
|
|
2721
2780
|
const e = c.fromPalette({
|
|
2722
2781
|
name: "secondary_fixed",
|
|
2723
|
-
palette: (
|
|
2724
|
-
tone: (
|
|
2725
|
-
let
|
|
2726
|
-
return this.secondaryContainer().getTone(
|
|
2782
|
+
palette: (r) => r.secondaryPalette,
|
|
2783
|
+
tone: (r) => {
|
|
2784
|
+
let t = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
|
|
2785
|
+
return this.secondaryContainer().getTone(t);
|
|
2727
2786
|
},
|
|
2728
2787
|
isBackground: !0,
|
|
2729
|
-
background: (
|
|
2730
|
-
contrastCurve: (
|
|
2788
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2789
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2731
2790
|
});
|
|
2732
|
-
return
|
|
2791
|
+
return b(super.secondaryFixed(), "2025", e);
|
|
2733
2792
|
}
|
|
2734
2793
|
secondaryFixedDim() {
|
|
2735
2794
|
const e = c.fromPalette({
|
|
2736
2795
|
name: "secondary_fixed_dim",
|
|
2737
|
-
palette: (
|
|
2738
|
-
tone: (
|
|
2796
|
+
palette: (r) => r.secondaryPalette,
|
|
2797
|
+
tone: (r) => this.secondaryFixed().getTone(r),
|
|
2739
2798
|
isBackground: !0,
|
|
2740
|
-
toneDeltaPair: (
|
|
2799
|
+
toneDeltaPair: (r) => new w(this.secondaryFixedDim(), this.secondaryFixed(), 5, "darker", !0, "exact")
|
|
2741
2800
|
});
|
|
2742
|
-
return
|
|
2801
|
+
return b(super.secondaryFixedDim(), "2025", e);
|
|
2743
2802
|
}
|
|
2744
2803
|
onSecondaryFixed() {
|
|
2745
2804
|
const e = c.fromPalette({
|
|
2746
2805
|
name: "on_secondary_fixed",
|
|
2747
|
-
palette: (
|
|
2748
|
-
background: (
|
|
2749
|
-
contrastCurve: (
|
|
2806
|
+
palette: (r) => r.secondaryPalette,
|
|
2807
|
+
background: (r) => this.secondaryFixedDim(),
|
|
2808
|
+
contrastCurve: (r) => k(7)
|
|
2750
2809
|
});
|
|
2751
|
-
return
|
|
2810
|
+
return b(super.onSecondaryFixed(), "2025", e);
|
|
2752
2811
|
}
|
|
2753
2812
|
onSecondaryFixedVariant() {
|
|
2754
2813
|
const e = c.fromPalette({
|
|
2755
2814
|
name: "on_secondary_fixed_variant",
|
|
2756
|
-
palette: (
|
|
2757
|
-
background: (
|
|
2758
|
-
contrastCurve: (
|
|
2815
|
+
palette: (r) => r.secondaryPalette,
|
|
2816
|
+
background: (r) => this.secondaryFixedDim(),
|
|
2817
|
+
contrastCurve: (r) => k(4.5)
|
|
2759
2818
|
});
|
|
2760
|
-
return
|
|
2819
|
+
return b(super.onSecondaryFixedVariant(), "2025", e);
|
|
2761
2820
|
}
|
|
2762
2821
|
////////////////////////////////////////////////////////////////
|
|
2763
2822
|
// Tertiaries [T] //
|
|
@@ -2765,97 +2824,97 @@ class Ht extends _t {
|
|
|
2765
2824
|
tertiary() {
|
|
2766
2825
|
const e = c.fromPalette({
|
|
2767
2826
|
name: "tertiary",
|
|
2768
|
-
palette: (
|
|
2769
|
-
tone: (
|
|
2827
|
+
palette: (r) => r.tertiaryPalette,
|
|
2828
|
+
tone: (r) => r.platform === "watch" ? r.variant === f.TONAL_SPOT ? F(r.tertiaryPalette, 0, 90) : F(r.tertiaryPalette) : r.variant === f.EXPRESSIVE || r.variant === f.VIBRANT ? F(r.tertiaryPalette, 0, T.isCyan(r.tertiaryPalette.hue) ? 88 : r.isDark ? 98 : 100) : r.isDark ? F(r.tertiaryPalette, 0, 98) : F(r.tertiaryPalette),
|
|
2770
2829
|
isBackground: !0,
|
|
2771
|
-
background: (
|
|
2772
|
-
contrastCurve: (
|
|
2773
|
-
toneDeltaPair: (
|
|
2830
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2831
|
+
contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
|
|
2832
|
+
toneDeltaPair: (r) => r.platform === "phone" ? new w(this.tertiaryContainer(), this.tertiary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
2774
2833
|
});
|
|
2775
|
-
return
|
|
2834
|
+
return b(super.tertiary(), "2025", e);
|
|
2776
2835
|
}
|
|
2777
2836
|
tertiaryDim() {
|
|
2778
2837
|
return c.fromPalette({
|
|
2779
2838
|
name: "tertiary_dim",
|
|
2780
2839
|
palette: (e) => e.tertiaryPalette,
|
|
2781
|
-
tone: (e) => e.variant ===
|
|
2840
|
+
tone: (e) => e.variant === f.TONAL_SPOT ? F(e.tertiaryPalette, 0, 90) : F(e.tertiaryPalette),
|
|
2782
2841
|
isBackground: !0,
|
|
2783
2842
|
background: (e) => this.surfaceContainerHigh(),
|
|
2784
|
-
contrastCurve: (e) =>
|
|
2843
|
+
contrastCurve: (e) => k(4.5),
|
|
2785
2844
|
toneDeltaPair: (e) => new w(this.tertiaryDim(), this.tertiary(), 5, "darker", !0, "farther")
|
|
2786
2845
|
});
|
|
2787
2846
|
}
|
|
2788
2847
|
onTertiary() {
|
|
2789
2848
|
const e = c.fromPalette({
|
|
2790
2849
|
name: "on_tertiary",
|
|
2791
|
-
palette: (
|
|
2792
|
-
background: (
|
|
2793
|
-
contrastCurve: (
|
|
2850
|
+
palette: (r) => r.tertiaryPalette,
|
|
2851
|
+
background: (r) => r.platform === "phone" ? this.tertiary() : this.tertiaryDim(),
|
|
2852
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2794
2853
|
});
|
|
2795
|
-
return
|
|
2854
|
+
return b(super.onTertiary(), "2025", e);
|
|
2796
2855
|
}
|
|
2797
2856
|
tertiaryContainer() {
|
|
2798
2857
|
const e = c.fromPalette({
|
|
2799
2858
|
name: "tertiary_container",
|
|
2800
|
-
palette: (
|
|
2801
|
-
tone: (
|
|
2859
|
+
palette: (r) => r.tertiaryPalette,
|
|
2860
|
+
tone: (r) => r.platform === "watch" ? r.variant === f.TONAL_SPOT ? F(r.tertiaryPalette, 0, 90) : F(r.tertiaryPalette) : r.variant === f.NEUTRAL ? r.isDark ? F(r.tertiaryPalette, 0, 93) : F(r.tertiaryPalette, 0, 96) : r.variant === f.TONAL_SPOT ? F(r.tertiaryPalette, 0, r.isDark ? 93 : 100) : r.variant === f.EXPRESSIVE ? F(r.tertiaryPalette, 75, T.isCyan(r.tertiaryPalette.hue) ? 88 : r.isDark ? 93 : 100) : r.isDark ? F(r.tertiaryPalette, 0, 93) : F(r.tertiaryPalette, 72, 100),
|
|
2802
2861
|
isBackground: !0,
|
|
2803
|
-
background: (
|
|
2804
|
-
toneDeltaPair: (
|
|
2805
|
-
contrastCurve: (
|
|
2862
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2863
|
+
toneDeltaPair: (r) => r.platform === "watch" ? new w(this.tertiaryContainer(), this.tertiaryDim(), 10, "darker", !0, "farther") : void 0,
|
|
2864
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2806
2865
|
});
|
|
2807
|
-
return
|
|
2866
|
+
return b(super.tertiaryContainer(), "2025", e);
|
|
2808
2867
|
}
|
|
2809
2868
|
onTertiaryContainer() {
|
|
2810
2869
|
const e = c.fromPalette({
|
|
2811
2870
|
name: "on_tertiary_container",
|
|
2812
|
-
palette: (
|
|
2813
|
-
background: (
|
|
2814
|
-
contrastCurve: (
|
|
2871
|
+
palette: (r) => r.tertiaryPalette,
|
|
2872
|
+
background: (r) => this.tertiaryContainer(),
|
|
2873
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2815
2874
|
});
|
|
2816
|
-
return
|
|
2875
|
+
return b(super.onTertiaryContainer(), "2025", e);
|
|
2817
2876
|
}
|
|
2818
2877
|
tertiaryFixed() {
|
|
2819
2878
|
const e = c.fromPalette({
|
|
2820
2879
|
name: "tertiary_fixed",
|
|
2821
|
-
palette: (
|
|
2822
|
-
tone: (
|
|
2823
|
-
let
|
|
2824
|
-
return this.tertiaryContainer().getTone(
|
|
2880
|
+
palette: (r) => r.tertiaryPalette,
|
|
2881
|
+
tone: (r) => {
|
|
2882
|
+
let t = Object.assign({}, r, { isDark: !1, contrastLevel: 0 });
|
|
2883
|
+
return this.tertiaryContainer().getTone(t);
|
|
2825
2884
|
},
|
|
2826
2885
|
isBackground: !0,
|
|
2827
|
-
background: (
|
|
2828
|
-
contrastCurve: (
|
|
2886
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2887
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2829
2888
|
});
|
|
2830
|
-
return
|
|
2889
|
+
return b(super.tertiaryFixed(), "2025", e);
|
|
2831
2890
|
}
|
|
2832
2891
|
tertiaryFixedDim() {
|
|
2833
2892
|
const e = c.fromPalette({
|
|
2834
2893
|
name: "tertiary_fixed_dim",
|
|
2835
|
-
palette: (
|
|
2836
|
-
tone: (
|
|
2894
|
+
palette: (r) => r.tertiaryPalette,
|
|
2895
|
+
tone: (r) => this.tertiaryFixed().getTone(r),
|
|
2837
2896
|
isBackground: !0,
|
|
2838
|
-
toneDeltaPair: (
|
|
2897
|
+
toneDeltaPair: (r) => new w(this.tertiaryFixedDim(), this.tertiaryFixed(), 5, "darker", !0, "exact")
|
|
2839
2898
|
});
|
|
2840
|
-
return
|
|
2899
|
+
return b(super.tertiaryFixedDim(), "2025", e);
|
|
2841
2900
|
}
|
|
2842
2901
|
onTertiaryFixed() {
|
|
2843
2902
|
const e = c.fromPalette({
|
|
2844
2903
|
name: "on_tertiary_fixed",
|
|
2845
|
-
palette: (
|
|
2846
|
-
background: (
|
|
2847
|
-
contrastCurve: (
|
|
2904
|
+
palette: (r) => r.tertiaryPalette,
|
|
2905
|
+
background: (r) => this.tertiaryFixedDim(),
|
|
2906
|
+
contrastCurve: (r) => k(7)
|
|
2848
2907
|
});
|
|
2849
|
-
return
|
|
2908
|
+
return b(super.onTertiaryFixed(), "2025", e);
|
|
2850
2909
|
}
|
|
2851
2910
|
onTertiaryFixedVariant() {
|
|
2852
2911
|
const e = c.fromPalette({
|
|
2853
2912
|
name: "on_tertiary_fixed_variant",
|
|
2854
|
-
palette: (
|
|
2855
|
-
background: (
|
|
2856
|
-
contrastCurve: (
|
|
2913
|
+
palette: (r) => r.tertiaryPalette,
|
|
2914
|
+
background: (r) => this.tertiaryFixedDim(),
|
|
2915
|
+
contrastCurve: (r) => k(4.5)
|
|
2857
2916
|
});
|
|
2858
|
-
return
|
|
2917
|
+
return b(super.onTertiaryFixedVariant(), "2025", e);
|
|
2859
2918
|
}
|
|
2860
2919
|
////////////////////////////////////////////////////////////////
|
|
2861
2920
|
// Errors [E] //
|
|
@@ -2863,77 +2922,77 @@ class Ht extends _t {
|
|
|
2863
2922
|
error() {
|
|
2864
2923
|
const e = c.fromPalette({
|
|
2865
2924
|
name: "error",
|
|
2866
|
-
palette: (
|
|
2867
|
-
tone: (
|
|
2925
|
+
palette: (r) => r.errorPalette,
|
|
2926
|
+
tone: (r) => r.platform === "phone" ? r.isDark ? W(r.errorPalette, 0, 98) : F(r.errorPalette) : W(r.errorPalette),
|
|
2868
2927
|
isBackground: !0,
|
|
2869
|
-
background: (
|
|
2870
|
-
contrastCurve: (
|
|
2871
|
-
toneDeltaPair: (
|
|
2928
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : this.surfaceContainerHigh(),
|
|
2929
|
+
contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7),
|
|
2930
|
+
toneDeltaPair: (r) => r.platform === "phone" ? new w(this.errorContainer(), this.error(), 5, "relative_lighter", !0, "farther") : void 0
|
|
2872
2931
|
});
|
|
2873
|
-
return
|
|
2932
|
+
return b(super.error(), "2025", e);
|
|
2874
2933
|
}
|
|
2875
2934
|
errorDim() {
|
|
2876
2935
|
return c.fromPalette({
|
|
2877
2936
|
name: "error_dim",
|
|
2878
2937
|
palette: (e) => e.errorPalette,
|
|
2879
|
-
tone: (e) =>
|
|
2938
|
+
tone: (e) => W(e.errorPalette),
|
|
2880
2939
|
isBackground: !0,
|
|
2881
2940
|
background: (e) => this.surfaceContainerHigh(),
|
|
2882
|
-
contrastCurve: (e) =>
|
|
2941
|
+
contrastCurve: (e) => k(4.5),
|
|
2883
2942
|
toneDeltaPair: (e) => new w(this.errorDim(), this.error(), 5, "darker", !0, "farther")
|
|
2884
2943
|
});
|
|
2885
2944
|
}
|
|
2886
2945
|
onError() {
|
|
2887
2946
|
const e = c.fromPalette({
|
|
2888
2947
|
name: "on_error",
|
|
2889
|
-
palette: (
|
|
2890
|
-
background: (
|
|
2891
|
-
contrastCurve: (
|
|
2948
|
+
palette: (r) => r.errorPalette,
|
|
2949
|
+
background: (r) => r.platform === "phone" ? this.error() : this.errorDim(),
|
|
2950
|
+
contrastCurve: (r) => r.platform === "phone" ? k(6) : k(7)
|
|
2892
2951
|
});
|
|
2893
|
-
return
|
|
2952
|
+
return b(super.onError(), "2025", e);
|
|
2894
2953
|
}
|
|
2895
2954
|
errorContainer() {
|
|
2896
2955
|
const e = c.fromPalette({
|
|
2897
2956
|
name: "error_container",
|
|
2898
|
-
palette: (
|
|
2899
|
-
tone: (
|
|
2957
|
+
palette: (r) => r.errorPalette,
|
|
2958
|
+
tone: (r) => r.platform === "watch" ? 30 : r.isDark ? W(r.errorPalette, 30, 93) : F(r.errorPalette, 0, 90),
|
|
2900
2959
|
isBackground: !0,
|
|
2901
|
-
background: (
|
|
2902
|
-
toneDeltaPair: (
|
|
2903
|
-
contrastCurve: (
|
|
2960
|
+
background: (r) => r.platform === "phone" ? this.highestSurface(r) : void 0,
|
|
2961
|
+
toneDeltaPair: (r) => r.platform === "watch" ? new w(this.errorContainer(), this.errorDim(), 10, "darker", !0, "farther") : void 0,
|
|
2962
|
+
contrastCurve: (r) => r.platform === "phone" && r.contrastLevel > 0 ? k(1.5) : void 0
|
|
2904
2963
|
});
|
|
2905
|
-
return
|
|
2964
|
+
return b(super.errorContainer(), "2025", e);
|
|
2906
2965
|
}
|
|
2907
2966
|
onErrorContainer() {
|
|
2908
2967
|
const e = c.fromPalette({
|
|
2909
2968
|
name: "on_error_container",
|
|
2910
|
-
palette: (
|
|
2911
|
-
background: (
|
|
2912
|
-
contrastCurve: (
|
|
2969
|
+
palette: (r) => r.errorPalette,
|
|
2970
|
+
background: (r) => this.errorContainer(),
|
|
2971
|
+
contrastCurve: (r) => r.platform === "phone" ? k(4.5) : k(7)
|
|
2913
2972
|
});
|
|
2914
|
-
return
|
|
2973
|
+
return b(super.onErrorContainer(), "2025", e);
|
|
2915
2974
|
}
|
|
2916
2975
|
/////////////////////////////////////////////////////////////////
|
|
2917
2976
|
// Remapped Colors //
|
|
2918
2977
|
/////////////////////////////////////////////////////////////////
|
|
2919
2978
|
surfaceVariant() {
|
|
2920
2979
|
const e = Object.assign(this.surfaceContainerHighest().clone(), { name: "surface_variant" });
|
|
2921
|
-
return
|
|
2980
|
+
return b(super.surfaceVariant(), "2025", e);
|
|
2922
2981
|
}
|
|
2923
2982
|
surfaceTint() {
|
|
2924
2983
|
const e = Object.assign(this.primary().clone(), { name: "surface_tint" });
|
|
2925
|
-
return
|
|
2984
|
+
return b(super.surfaceTint(), "2025", e);
|
|
2926
2985
|
}
|
|
2927
2986
|
background() {
|
|
2928
2987
|
const e = Object.assign(this.surface().clone(), { name: "background" });
|
|
2929
|
-
return
|
|
2988
|
+
return b(super.background(), "2025", e);
|
|
2930
2989
|
}
|
|
2931
2990
|
onBackground() {
|
|
2932
2991
|
const e = Object.assign(this.onSurface().clone(), {
|
|
2933
2992
|
name: "on_background",
|
|
2934
|
-
tone: (
|
|
2993
|
+
tone: (r) => r.platform === "watch" ? 100 : this.onSurface().getTone(r)
|
|
2935
2994
|
});
|
|
2936
|
-
return
|
|
2995
|
+
return b(super.onBackground(), "2025", e);
|
|
2937
2996
|
}
|
|
2938
2997
|
}
|
|
2939
2998
|
/**
|
|
@@ -2952,7 +3011,7 @@ class Ht extends _t {
|
|
|
2952
3011
|
* See the License for the specific language governing permissions and
|
|
2953
3012
|
* limitations under the License.
|
|
2954
3013
|
*/
|
|
2955
|
-
class
|
|
3014
|
+
class o {
|
|
2956
3015
|
constructor() {
|
|
2957
3016
|
this.allColors = [
|
|
2958
3017
|
this.background(),
|
|
@@ -3007,275 +3066,275 @@ class s {
|
|
|
3007
3066
|
].filter((e) => e !== void 0);
|
|
3008
3067
|
}
|
|
3009
3068
|
highestSurface(e) {
|
|
3010
|
-
return
|
|
3069
|
+
return o.colorSpec.highestSurface(e);
|
|
3011
3070
|
}
|
|
3012
3071
|
////////////////////////////////////////////////////////////////
|
|
3013
3072
|
// Main Palettes //
|
|
3014
3073
|
////////////////////////////////////////////////////////////////
|
|
3015
3074
|
primaryPaletteKeyColor() {
|
|
3016
|
-
return
|
|
3075
|
+
return o.colorSpec.primaryPaletteKeyColor();
|
|
3017
3076
|
}
|
|
3018
3077
|
secondaryPaletteKeyColor() {
|
|
3019
|
-
return
|
|
3078
|
+
return o.colorSpec.secondaryPaletteKeyColor();
|
|
3020
3079
|
}
|
|
3021
3080
|
tertiaryPaletteKeyColor() {
|
|
3022
|
-
return
|
|
3081
|
+
return o.colorSpec.tertiaryPaletteKeyColor();
|
|
3023
3082
|
}
|
|
3024
3083
|
neutralPaletteKeyColor() {
|
|
3025
|
-
return
|
|
3084
|
+
return o.colorSpec.neutralPaletteKeyColor();
|
|
3026
3085
|
}
|
|
3027
3086
|
neutralVariantPaletteKeyColor() {
|
|
3028
|
-
return
|
|
3087
|
+
return o.colorSpec.neutralVariantPaletteKeyColor();
|
|
3029
3088
|
}
|
|
3030
3089
|
errorPaletteKeyColor() {
|
|
3031
|
-
return
|
|
3090
|
+
return o.colorSpec.errorPaletteKeyColor();
|
|
3032
3091
|
}
|
|
3033
3092
|
////////////////////////////////////////////////////////////////
|
|
3034
3093
|
// Surfaces [S] //
|
|
3035
3094
|
////////////////////////////////////////////////////////////////
|
|
3036
3095
|
background() {
|
|
3037
|
-
return
|
|
3096
|
+
return o.colorSpec.background();
|
|
3038
3097
|
}
|
|
3039
3098
|
onBackground() {
|
|
3040
|
-
return
|
|
3099
|
+
return o.colorSpec.onBackground();
|
|
3041
3100
|
}
|
|
3042
3101
|
surface() {
|
|
3043
|
-
return
|
|
3102
|
+
return o.colorSpec.surface();
|
|
3044
3103
|
}
|
|
3045
3104
|
surfaceDim() {
|
|
3046
|
-
return
|
|
3105
|
+
return o.colorSpec.surfaceDim();
|
|
3047
3106
|
}
|
|
3048
3107
|
surfaceBright() {
|
|
3049
|
-
return
|
|
3108
|
+
return o.colorSpec.surfaceBright();
|
|
3050
3109
|
}
|
|
3051
3110
|
surfaceContainerLowest() {
|
|
3052
|
-
return
|
|
3111
|
+
return o.colorSpec.surfaceContainerLowest();
|
|
3053
3112
|
}
|
|
3054
3113
|
surfaceContainerLow() {
|
|
3055
|
-
return
|
|
3114
|
+
return o.colorSpec.surfaceContainerLow();
|
|
3056
3115
|
}
|
|
3057
3116
|
surfaceContainer() {
|
|
3058
|
-
return
|
|
3117
|
+
return o.colorSpec.surfaceContainer();
|
|
3059
3118
|
}
|
|
3060
3119
|
surfaceContainerHigh() {
|
|
3061
|
-
return
|
|
3120
|
+
return o.colorSpec.surfaceContainerHigh();
|
|
3062
3121
|
}
|
|
3063
3122
|
surfaceContainerHighest() {
|
|
3064
|
-
return
|
|
3123
|
+
return o.colorSpec.surfaceContainerHighest();
|
|
3065
3124
|
}
|
|
3066
3125
|
onSurface() {
|
|
3067
|
-
return
|
|
3126
|
+
return o.colorSpec.onSurface();
|
|
3068
3127
|
}
|
|
3069
3128
|
surfaceVariant() {
|
|
3070
|
-
return
|
|
3129
|
+
return o.colorSpec.surfaceVariant();
|
|
3071
3130
|
}
|
|
3072
3131
|
onSurfaceVariant() {
|
|
3073
|
-
return
|
|
3132
|
+
return o.colorSpec.onSurfaceVariant();
|
|
3074
3133
|
}
|
|
3075
3134
|
outline() {
|
|
3076
|
-
return
|
|
3135
|
+
return o.colorSpec.outline();
|
|
3077
3136
|
}
|
|
3078
3137
|
outlineVariant() {
|
|
3079
|
-
return
|
|
3138
|
+
return o.colorSpec.outlineVariant();
|
|
3080
3139
|
}
|
|
3081
3140
|
inverseSurface() {
|
|
3082
|
-
return
|
|
3141
|
+
return o.colorSpec.inverseSurface();
|
|
3083
3142
|
}
|
|
3084
3143
|
inverseOnSurface() {
|
|
3085
|
-
return
|
|
3144
|
+
return o.colorSpec.inverseOnSurface();
|
|
3086
3145
|
}
|
|
3087
3146
|
shadow() {
|
|
3088
|
-
return
|
|
3147
|
+
return o.colorSpec.shadow();
|
|
3089
3148
|
}
|
|
3090
3149
|
scrim() {
|
|
3091
|
-
return
|
|
3150
|
+
return o.colorSpec.scrim();
|
|
3092
3151
|
}
|
|
3093
3152
|
surfaceTint() {
|
|
3094
|
-
return
|
|
3153
|
+
return o.colorSpec.surfaceTint();
|
|
3095
3154
|
}
|
|
3096
3155
|
////////////////////////////////////////////////////////////////
|
|
3097
3156
|
// Primaries [P] //
|
|
3098
3157
|
////////////////////////////////////////////////////////////////
|
|
3099
3158
|
primary() {
|
|
3100
|
-
return
|
|
3159
|
+
return o.colorSpec.primary();
|
|
3101
3160
|
}
|
|
3102
3161
|
primaryDim() {
|
|
3103
|
-
return
|
|
3162
|
+
return o.colorSpec.primaryDim();
|
|
3104
3163
|
}
|
|
3105
3164
|
onPrimary() {
|
|
3106
|
-
return
|
|
3165
|
+
return o.colorSpec.onPrimary();
|
|
3107
3166
|
}
|
|
3108
3167
|
primaryContainer() {
|
|
3109
|
-
return
|
|
3168
|
+
return o.colorSpec.primaryContainer();
|
|
3110
3169
|
}
|
|
3111
3170
|
onPrimaryContainer() {
|
|
3112
|
-
return
|
|
3171
|
+
return o.colorSpec.onPrimaryContainer();
|
|
3113
3172
|
}
|
|
3114
3173
|
inversePrimary() {
|
|
3115
|
-
return
|
|
3174
|
+
return o.colorSpec.inversePrimary();
|
|
3116
3175
|
}
|
|
3117
3176
|
/////////////////////////////////////////////////////////////////
|
|
3118
3177
|
// Primary Fixed [PF] //
|
|
3119
3178
|
/////////////////////////////////////////////////////////////////
|
|
3120
3179
|
primaryFixed() {
|
|
3121
|
-
return
|
|
3180
|
+
return o.colorSpec.primaryFixed();
|
|
3122
3181
|
}
|
|
3123
3182
|
primaryFixedDim() {
|
|
3124
|
-
return
|
|
3183
|
+
return o.colorSpec.primaryFixedDim();
|
|
3125
3184
|
}
|
|
3126
3185
|
onPrimaryFixed() {
|
|
3127
|
-
return
|
|
3186
|
+
return o.colorSpec.onPrimaryFixed();
|
|
3128
3187
|
}
|
|
3129
3188
|
onPrimaryFixedVariant() {
|
|
3130
|
-
return
|
|
3189
|
+
return o.colorSpec.onPrimaryFixedVariant();
|
|
3131
3190
|
}
|
|
3132
3191
|
////////////////////////////////////////////////////////////////
|
|
3133
3192
|
// Secondaries [Q] //
|
|
3134
3193
|
////////////////////////////////////////////////////////////////
|
|
3135
3194
|
secondary() {
|
|
3136
|
-
return
|
|
3195
|
+
return o.colorSpec.secondary();
|
|
3137
3196
|
}
|
|
3138
3197
|
secondaryDim() {
|
|
3139
|
-
return
|
|
3198
|
+
return o.colorSpec.secondaryDim();
|
|
3140
3199
|
}
|
|
3141
3200
|
onSecondary() {
|
|
3142
|
-
return
|
|
3201
|
+
return o.colorSpec.onSecondary();
|
|
3143
3202
|
}
|
|
3144
3203
|
secondaryContainer() {
|
|
3145
|
-
return
|
|
3204
|
+
return o.colorSpec.secondaryContainer();
|
|
3146
3205
|
}
|
|
3147
3206
|
onSecondaryContainer() {
|
|
3148
|
-
return
|
|
3207
|
+
return o.colorSpec.onSecondaryContainer();
|
|
3149
3208
|
}
|
|
3150
3209
|
/////////////////////////////////////////////////////////////////
|
|
3151
3210
|
// Secondary Fixed [QF] //
|
|
3152
3211
|
/////////////////////////////////////////////////////////////////
|
|
3153
3212
|
secondaryFixed() {
|
|
3154
|
-
return
|
|
3213
|
+
return o.colorSpec.secondaryFixed();
|
|
3155
3214
|
}
|
|
3156
3215
|
secondaryFixedDim() {
|
|
3157
|
-
return
|
|
3216
|
+
return o.colorSpec.secondaryFixedDim();
|
|
3158
3217
|
}
|
|
3159
3218
|
onSecondaryFixed() {
|
|
3160
|
-
return
|
|
3219
|
+
return o.colorSpec.onSecondaryFixed();
|
|
3161
3220
|
}
|
|
3162
3221
|
onSecondaryFixedVariant() {
|
|
3163
|
-
return
|
|
3222
|
+
return o.colorSpec.onSecondaryFixedVariant();
|
|
3164
3223
|
}
|
|
3165
3224
|
////////////////////////////////////////////////////////////////
|
|
3166
3225
|
// Tertiaries [T] //
|
|
3167
3226
|
////////////////////////////////////////////////////////////////
|
|
3168
3227
|
tertiary() {
|
|
3169
|
-
return
|
|
3228
|
+
return o.colorSpec.tertiary();
|
|
3170
3229
|
}
|
|
3171
3230
|
tertiaryDim() {
|
|
3172
|
-
return
|
|
3231
|
+
return o.colorSpec.tertiaryDim();
|
|
3173
3232
|
}
|
|
3174
3233
|
onTertiary() {
|
|
3175
|
-
return
|
|
3234
|
+
return o.colorSpec.onTertiary();
|
|
3176
3235
|
}
|
|
3177
3236
|
tertiaryContainer() {
|
|
3178
|
-
return
|
|
3237
|
+
return o.colorSpec.tertiaryContainer();
|
|
3179
3238
|
}
|
|
3180
3239
|
onTertiaryContainer() {
|
|
3181
|
-
return
|
|
3240
|
+
return o.colorSpec.onTertiaryContainer();
|
|
3182
3241
|
}
|
|
3183
3242
|
/////////////////////////////////////////////////////////////////
|
|
3184
3243
|
// Tertiary Fixed [TF] //
|
|
3185
3244
|
/////////////////////////////////////////////////////////////////
|
|
3186
3245
|
tertiaryFixed() {
|
|
3187
|
-
return
|
|
3246
|
+
return o.colorSpec.tertiaryFixed();
|
|
3188
3247
|
}
|
|
3189
3248
|
tertiaryFixedDim() {
|
|
3190
|
-
return
|
|
3249
|
+
return o.colorSpec.tertiaryFixedDim();
|
|
3191
3250
|
}
|
|
3192
3251
|
onTertiaryFixed() {
|
|
3193
|
-
return
|
|
3252
|
+
return o.colorSpec.onTertiaryFixed();
|
|
3194
3253
|
}
|
|
3195
3254
|
onTertiaryFixedVariant() {
|
|
3196
|
-
return
|
|
3255
|
+
return o.colorSpec.onTertiaryFixedVariant();
|
|
3197
3256
|
}
|
|
3198
3257
|
////////////////////////////////////////////////////////////////
|
|
3199
3258
|
// Errors [E] //
|
|
3200
3259
|
////////////////////////////////////////////////////////////////
|
|
3201
3260
|
error() {
|
|
3202
|
-
return
|
|
3261
|
+
return o.colorSpec.error();
|
|
3203
3262
|
}
|
|
3204
3263
|
errorDim() {
|
|
3205
|
-
return
|
|
3264
|
+
return o.colorSpec.errorDim();
|
|
3206
3265
|
}
|
|
3207
3266
|
onError() {
|
|
3208
|
-
return
|
|
3267
|
+
return o.colorSpec.onError();
|
|
3209
3268
|
}
|
|
3210
3269
|
errorContainer() {
|
|
3211
|
-
return
|
|
3270
|
+
return o.colorSpec.errorContainer();
|
|
3212
3271
|
}
|
|
3213
3272
|
onErrorContainer() {
|
|
3214
|
-
return
|
|
3273
|
+
return o.colorSpec.onErrorContainer();
|
|
3215
3274
|
}
|
|
3216
3275
|
// Static variables are deprecated. Use the instance methods to get correct
|
|
3217
3276
|
// specs based on request.
|
|
3218
3277
|
/** @deprecated Use highestSurface() instead. */
|
|
3219
3278
|
static highestSurface(e) {
|
|
3220
|
-
return
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
+
return o.colorSpec.highestSurface(e);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
o.contentAccentToneDelta = 15;
|
|
3283
|
+
o.colorSpec = new ur();
|
|
3284
|
+
o.primaryPaletteKeyColor = o.colorSpec.primaryPaletteKeyColor();
|
|
3285
|
+
o.secondaryPaletteKeyColor = o.colorSpec.secondaryPaletteKeyColor();
|
|
3286
|
+
o.tertiaryPaletteKeyColor = o.colorSpec.tertiaryPaletteKeyColor();
|
|
3287
|
+
o.neutralPaletteKeyColor = o.colorSpec.neutralPaletteKeyColor();
|
|
3288
|
+
o.neutralVariantPaletteKeyColor = o.colorSpec.neutralVariantPaletteKeyColor();
|
|
3289
|
+
o.background = o.colorSpec.background();
|
|
3290
|
+
o.onBackground = o.colorSpec.onBackground();
|
|
3291
|
+
o.surface = o.colorSpec.surface();
|
|
3292
|
+
o.surfaceDim = o.colorSpec.surfaceDim();
|
|
3293
|
+
o.surfaceBright = o.colorSpec.surfaceBright();
|
|
3294
|
+
o.surfaceContainerLowest = o.colorSpec.surfaceContainerLowest();
|
|
3295
|
+
o.surfaceContainerLow = o.colorSpec.surfaceContainerLow();
|
|
3296
|
+
o.surfaceContainer = o.colorSpec.surfaceContainer();
|
|
3297
|
+
o.surfaceContainerHigh = o.colorSpec.surfaceContainerHigh();
|
|
3298
|
+
o.surfaceContainerHighest = o.colorSpec.surfaceContainerHighest();
|
|
3299
|
+
o.onSurface = o.colorSpec.onSurface();
|
|
3300
|
+
o.surfaceVariant = o.colorSpec.surfaceVariant();
|
|
3301
|
+
o.onSurfaceVariant = o.colorSpec.onSurfaceVariant();
|
|
3302
|
+
o.inverseSurface = o.colorSpec.inverseSurface();
|
|
3303
|
+
o.inverseOnSurface = o.colorSpec.inverseOnSurface();
|
|
3304
|
+
o.outline = o.colorSpec.outline();
|
|
3305
|
+
o.outlineVariant = o.colorSpec.outlineVariant();
|
|
3306
|
+
o.shadow = o.colorSpec.shadow();
|
|
3307
|
+
o.scrim = o.colorSpec.scrim();
|
|
3308
|
+
o.surfaceTint = o.colorSpec.surfaceTint();
|
|
3309
|
+
o.primary = o.colorSpec.primary();
|
|
3310
|
+
o.onPrimary = o.colorSpec.onPrimary();
|
|
3311
|
+
o.primaryContainer = o.colorSpec.primaryContainer();
|
|
3312
|
+
o.onPrimaryContainer = o.colorSpec.onPrimaryContainer();
|
|
3313
|
+
o.inversePrimary = o.colorSpec.inversePrimary();
|
|
3314
|
+
o.secondary = o.colorSpec.secondary();
|
|
3315
|
+
o.onSecondary = o.colorSpec.onSecondary();
|
|
3316
|
+
o.secondaryContainer = o.colorSpec.secondaryContainer();
|
|
3317
|
+
o.onSecondaryContainer = o.colorSpec.onSecondaryContainer();
|
|
3318
|
+
o.tertiary = o.colorSpec.tertiary();
|
|
3319
|
+
o.onTertiary = o.colorSpec.onTertiary();
|
|
3320
|
+
o.tertiaryContainer = o.colorSpec.tertiaryContainer();
|
|
3321
|
+
o.onTertiaryContainer = o.colorSpec.onTertiaryContainer();
|
|
3322
|
+
o.error = o.colorSpec.error();
|
|
3323
|
+
o.onError = o.colorSpec.onError();
|
|
3324
|
+
o.errorContainer = o.colorSpec.errorContainer();
|
|
3325
|
+
o.onErrorContainer = o.colorSpec.onErrorContainer();
|
|
3326
|
+
o.primaryFixed = o.colorSpec.primaryFixed();
|
|
3327
|
+
o.primaryFixedDim = o.colorSpec.primaryFixedDim();
|
|
3328
|
+
o.onPrimaryFixed = o.colorSpec.onPrimaryFixed();
|
|
3329
|
+
o.onPrimaryFixedVariant = o.colorSpec.onPrimaryFixedVariant();
|
|
3330
|
+
o.secondaryFixed = o.colorSpec.secondaryFixed();
|
|
3331
|
+
o.secondaryFixedDim = o.colorSpec.secondaryFixedDim();
|
|
3332
|
+
o.onSecondaryFixed = o.colorSpec.onSecondaryFixed();
|
|
3333
|
+
o.onSecondaryFixedVariant = o.colorSpec.onSecondaryFixedVariant();
|
|
3334
|
+
o.tertiaryFixed = o.colorSpec.tertiaryFixed();
|
|
3335
|
+
o.tertiaryFixedDim = o.colorSpec.tertiaryFixedDim();
|
|
3336
|
+
o.onTertiaryFixed = o.colorSpec.onTertiaryFixed();
|
|
3337
|
+
o.onTertiaryFixedVariant = o.colorSpec.onTertiaryFixedVariant();
|
|
3279
3338
|
/**
|
|
3280
3339
|
* @license
|
|
3281
3340
|
* Copyright 2021 Google LLC
|
|
@@ -3292,7 +3351,7 @@ s.onTertiaryFixedVariant = s.colorSpec.onTertiaryFixedVariant();
|
|
|
3292
3351
|
* See the License for the specific language governing permissions and
|
|
3293
3352
|
* limitations under the License.
|
|
3294
3353
|
*/
|
|
3295
|
-
class
|
|
3354
|
+
class U {
|
|
3296
3355
|
/**
|
|
3297
3356
|
* @param argb ARGB representation of a color
|
|
3298
3357
|
*
|
|
@@ -3300,7 +3359,7 @@ class $ {
|
|
|
3300
3359
|
* Use {@link CorePalettes} for core palettes container class.
|
|
3301
3360
|
*/
|
|
3302
3361
|
static of(e) {
|
|
3303
|
-
return new
|
|
3362
|
+
return new U(e, !1);
|
|
3304
3363
|
}
|
|
3305
3364
|
/**
|
|
3306
3365
|
* @param argb ARGB representation of a color
|
|
@@ -3309,7 +3368,7 @@ class $ {
|
|
|
3309
3368
|
* Use {@link CorePalettes} for core palettes container class.
|
|
3310
3369
|
*/
|
|
3311
3370
|
static contentOf(e) {
|
|
3312
|
-
return new
|
|
3371
|
+
return new U(e, !0);
|
|
3313
3372
|
}
|
|
3314
3373
|
/**
|
|
3315
3374
|
* Create a [CorePalette] from a set of colors
|
|
@@ -3318,7 +3377,7 @@ class $ {
|
|
|
3318
3377
|
* Use {@link CorePalettes} for core palettes container class.
|
|
3319
3378
|
*/
|
|
3320
3379
|
static fromColors(e) {
|
|
3321
|
-
return
|
|
3380
|
+
return U.createPaletteFromColors(!1, e);
|
|
3322
3381
|
}
|
|
3323
3382
|
/**
|
|
3324
3383
|
* Create a content [CorePalette] from a set of colors
|
|
@@ -3327,35 +3386,35 @@ class $ {
|
|
|
3327
3386
|
* Use {@link CorePalettes} for core palettes container class.
|
|
3328
3387
|
*/
|
|
3329
3388
|
static contentFromColors(e) {
|
|
3330
|
-
return
|
|
3389
|
+
return U.createPaletteFromColors(!0, e);
|
|
3331
3390
|
}
|
|
3332
|
-
static createPaletteFromColors(e,
|
|
3333
|
-
const
|
|
3334
|
-
if (
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3391
|
+
static createPaletteFromColors(e, r) {
|
|
3392
|
+
const t = new U(r.primary, e);
|
|
3393
|
+
if (r.secondary) {
|
|
3394
|
+
const n = new U(r.secondary, e);
|
|
3395
|
+
t.a2 = n.a1;
|
|
3337
3396
|
}
|
|
3338
|
-
if (
|
|
3339
|
-
const
|
|
3340
|
-
|
|
3397
|
+
if (r.tertiary) {
|
|
3398
|
+
const n = new U(r.tertiary, e);
|
|
3399
|
+
t.a3 = n.a1;
|
|
3341
3400
|
}
|
|
3342
|
-
if (
|
|
3343
|
-
const
|
|
3344
|
-
|
|
3401
|
+
if (r.error) {
|
|
3402
|
+
const n = new U(r.error, e);
|
|
3403
|
+
t.error = n.a1;
|
|
3345
3404
|
}
|
|
3346
|
-
if (
|
|
3347
|
-
const
|
|
3348
|
-
|
|
3405
|
+
if (r.neutral) {
|
|
3406
|
+
const n = new U(r.neutral, e);
|
|
3407
|
+
t.n1 = n.n1;
|
|
3349
3408
|
}
|
|
3350
|
-
if (
|
|
3351
|
-
const
|
|
3352
|
-
|
|
3409
|
+
if (r.neutralVariant) {
|
|
3410
|
+
const n = new U(r.neutralVariant, e);
|
|
3411
|
+
t.n2 = n.n2;
|
|
3353
3412
|
}
|
|
3354
|
-
return
|
|
3413
|
+
return t;
|
|
3355
3414
|
}
|
|
3356
|
-
constructor(e,
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3415
|
+
constructor(e, r) {
|
|
3416
|
+
const t = T.fromInt(e), n = t.hue, s = t.chroma;
|
|
3417
|
+
r ? (this.a1 = Y.fromHueAndChroma(n, s), this.a2 = Y.fromHueAndChroma(n, s / 3), this.a3 = Y.fromHueAndChroma(n + 60, s / 2), this.n1 = Y.fromHueAndChroma(n, Math.min(s / 12, 4)), this.n2 = Y.fromHueAndChroma(n, Math.min(s / 6, 8))) : (this.a1 = Y.fromHueAndChroma(n, Math.max(48, s)), this.a2 = Y.fromHueAndChroma(n, 16), this.a3 = Y.fromHueAndChroma(n + 60, 24), this.n1 = Y.fromHueAndChroma(n, 4), this.n2 = Y.fromHueAndChroma(n, 8)), this.error = Y.fromHueAndChroma(25, 84);
|
|
3359
3418
|
}
|
|
3360
3419
|
}
|
|
3361
3420
|
/**
|
|
@@ -3374,7 +3433,7 @@ class $ {
|
|
|
3374
3433
|
* See the License for the specific language governing permissions and
|
|
3375
3434
|
* limitations under the License.
|
|
3376
3435
|
*/
|
|
3377
|
-
class
|
|
3436
|
+
class X {
|
|
3378
3437
|
get primary() {
|
|
3379
3438
|
return this.props.primary;
|
|
3380
3439
|
}
|
|
@@ -3467,34 +3526,34 @@ class ee {
|
|
|
3467
3526
|
* @return Light Material color scheme, based on the color's hue.
|
|
3468
3527
|
*/
|
|
3469
3528
|
static light(e) {
|
|
3470
|
-
return
|
|
3529
|
+
return X.lightFromCorePalette(U.of(e));
|
|
3471
3530
|
}
|
|
3472
3531
|
/**
|
|
3473
3532
|
* @param argb ARGB representation of a color.
|
|
3474
3533
|
* @return Dark Material color scheme, based on the color's hue.
|
|
3475
3534
|
*/
|
|
3476
3535
|
static dark(e) {
|
|
3477
|
-
return
|
|
3536
|
+
return X.darkFromCorePalette(U.of(e));
|
|
3478
3537
|
}
|
|
3479
3538
|
/**
|
|
3480
3539
|
* @param argb ARGB representation of a color.
|
|
3481
3540
|
* @return Light Material content color scheme, based on the color's hue.
|
|
3482
3541
|
*/
|
|
3483
3542
|
static lightContent(e) {
|
|
3484
|
-
return
|
|
3543
|
+
return X.lightFromCorePalette(U.contentOf(e));
|
|
3485
3544
|
}
|
|
3486
3545
|
/**
|
|
3487
3546
|
* @param argb ARGB representation of a color.
|
|
3488
3547
|
* @return Dark Material content color scheme, based on the color's hue.
|
|
3489
3548
|
*/
|
|
3490
3549
|
static darkContent(e) {
|
|
3491
|
-
return
|
|
3550
|
+
return X.darkFromCorePalette(U.contentOf(e));
|
|
3492
3551
|
}
|
|
3493
3552
|
/**
|
|
3494
3553
|
* Light scheme from core palette
|
|
3495
3554
|
*/
|
|
3496
3555
|
static lightFromCorePalette(e) {
|
|
3497
|
-
return new
|
|
3556
|
+
return new X({
|
|
3498
3557
|
primary: e.a1.tone(40),
|
|
3499
3558
|
onPrimary: e.a1.tone(100),
|
|
3500
3559
|
primaryContainer: e.a1.tone(90),
|
|
@@ -3530,7 +3589,7 @@ class ee {
|
|
|
3530
3589
|
* Dark scheme from core palette
|
|
3531
3590
|
*/
|
|
3532
3591
|
static darkFromCorePalette(e) {
|
|
3533
|
-
return new
|
|
3592
|
+
return new X({
|
|
3534
3593
|
primary: e.a1.tone(80),
|
|
3535
3594
|
onPrimary: e.a1.tone(20),
|
|
3536
3595
|
primaryContainer: e.a1.tone(30),
|
|
@@ -3587,22 +3646,22 @@ class ee {
|
|
|
3587
3646
|
* See the License for the specific language governing permissions and
|
|
3588
3647
|
* limitations under the License.
|
|
3589
3648
|
*/
|
|
3590
|
-
function
|
|
3591
|
-
const e =
|
|
3592
|
-
for (const [
|
|
3593
|
-
i.length === 1 && (
|
|
3594
|
-
return "#" +
|
|
3595
|
-
}
|
|
3596
|
-
function
|
|
3597
|
-
|
|
3598
|
-
const e =
|
|
3599
|
-
if (!e && !
|
|
3600
|
-
throw new Error("unexpected hex " +
|
|
3601
|
-
let
|
|
3602
|
-
return e ? (
|
|
3603
|
-
}
|
|
3604
|
-
function
|
|
3605
|
-
return parseInt(
|
|
3649
|
+
function lr(a) {
|
|
3650
|
+
const e = xe(a), r = Be(a), t = ve(a), n = [e.toString(16), r.toString(16), t.toString(16)];
|
|
3651
|
+
for (const [s, i] of n.entries())
|
|
3652
|
+
i.length === 1 && (n[s] = "0" + i);
|
|
3653
|
+
return "#" + n.join("");
|
|
3654
|
+
}
|
|
3655
|
+
function fr(a) {
|
|
3656
|
+
a = a.replace("#", "");
|
|
3657
|
+
const e = a.length === 3, r = a.length === 6, t = a.length === 8;
|
|
3658
|
+
if (!e && !r && !t)
|
|
3659
|
+
throw new Error("unexpected hex " + a);
|
|
3660
|
+
let n = 0, s = 0, i = 0;
|
|
3661
|
+
return e ? (n = $(a.slice(0, 1).repeat(2)), s = $(a.slice(1, 2).repeat(2)), i = $(a.slice(2, 3).repeat(2))) : r ? (n = $(a.slice(0, 2)), s = $(a.slice(2, 4)), i = $(a.slice(4, 6))) : t && (n = $(a.slice(2, 4)), s = $(a.slice(4, 6)), i = $(a.slice(6, 8))), (255 << 24 | (n & 255) << 16 | (s & 255) << 8 | i & 255) >>> 0;
|
|
3662
|
+
}
|
|
3663
|
+
function $(a) {
|
|
3664
|
+
return parseInt(a, 16);
|
|
3606
3665
|
}
|
|
3607
3666
|
/**
|
|
3608
3667
|
* @license
|
|
@@ -3620,33 +3679,33 @@ function Z(r) {
|
|
|
3620
3679
|
* See the License for the specific language governing permissions and
|
|
3621
3680
|
* limitations under the License.
|
|
3622
3681
|
*/
|
|
3623
|
-
function
|
|
3624
|
-
const
|
|
3682
|
+
function hr(a, e = []) {
|
|
3683
|
+
const r = U.of(a);
|
|
3625
3684
|
return {
|
|
3626
|
-
source:
|
|
3685
|
+
source: a,
|
|
3627
3686
|
schemes: {
|
|
3628
|
-
light:
|
|
3629
|
-
dark:
|
|
3687
|
+
light: X.light(a),
|
|
3688
|
+
dark: X.dark(a)
|
|
3630
3689
|
},
|
|
3631
3690
|
palettes: {
|
|
3632
|
-
primary:
|
|
3633
|
-
secondary:
|
|
3634
|
-
tertiary:
|
|
3635
|
-
neutral:
|
|
3636
|
-
neutralVariant:
|
|
3637
|
-
error:
|
|
3691
|
+
primary: r.a1,
|
|
3692
|
+
secondary: r.a2,
|
|
3693
|
+
tertiary: r.a3,
|
|
3694
|
+
neutral: r.n1,
|
|
3695
|
+
neutralVariant: r.n2,
|
|
3696
|
+
error: r.error
|
|
3638
3697
|
},
|
|
3639
|
-
customColors: e.map((
|
|
3698
|
+
customColors: e.map((t) => dr(a, t))
|
|
3640
3699
|
};
|
|
3641
3700
|
}
|
|
3642
|
-
function
|
|
3643
|
-
let
|
|
3644
|
-
const
|
|
3645
|
-
e.blend && (
|
|
3646
|
-
const i =
|
|
3701
|
+
function dr(a, e) {
|
|
3702
|
+
let r = e.value;
|
|
3703
|
+
const t = r, n = a;
|
|
3704
|
+
e.blend && (r = Ce.harmonize(t, n));
|
|
3705
|
+
const i = U.of(r).a1;
|
|
3647
3706
|
return {
|
|
3648
3707
|
color: e,
|
|
3649
|
-
value:
|
|
3708
|
+
value: r,
|
|
3650
3709
|
light: {
|
|
3651
3710
|
color: i.tone(40),
|
|
3652
3711
|
onColor: i.tone(100),
|
|
@@ -3661,330 +3720,64 @@ function zt(r, e) {
|
|
|
3661
3720
|
}
|
|
3662
3721
|
};
|
|
3663
3722
|
}
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
const u = N(o.tone(i));
|
|
3699
|
-
r[`${e}${i}`] = he(u, n);
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
function X(r) {
|
|
3703
|
-
const e = parseInt(r.slice(1, 3), 16), t = parseInt(r.slice(3, 5), 16), n = parseInt(r.slice(5, 7), 16);
|
|
3704
|
-
return `${e}, ${t}, ${n}`;
|
|
3705
|
-
}
|
|
3706
|
-
function jt(r) {
|
|
3707
|
-
const e = {};
|
|
3708
|
-
return Ge(e, "source", r), Object.entries(Ee).forEach(([t]) => {
|
|
3709
|
-
Ge(e, t, Ee[t]);
|
|
3710
|
-
}), e;
|
|
3711
|
-
}
|
|
3712
|
-
function Ge(r, e, t) {
|
|
3713
|
-
const a = oe(Ce(t)).palettes.primary;
|
|
3714
|
-
for (let o = 10; o <= 100; o += 10) {
|
|
3715
|
-
const i = N(a.tone(o)), u = o >= 60 ? 10 : 100, l = N(a.tone(u)), h = X(i), f = X(l);
|
|
3716
|
-
r[`${e}${o}`] = h, r[`on${Kt(e)}${o}`] = f;
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
function Kt(r) {
|
|
3720
|
-
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
3721
|
-
}
|
|
3722
|
-
var qt = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, Q = function(r) {
|
|
3723
|
-
return typeof r == "string" ? r.length > 0 : typeof r == "number";
|
|
3724
|
-
}, _ = function(r, e, t) {
|
|
3725
|
-
return e === void 0 && (e = 0), t === void 0 && (t = Math.pow(10, e)), Math.round(t * r) / t + 0;
|
|
3726
|
-
}, K = function(r, e, t) {
|
|
3727
|
-
return e === void 0 && (e = 0), t === void 0 && (t = 1), r > t ? t : r > e ? r : e;
|
|
3728
|
-
}, ut = function(r) {
|
|
3729
|
-
return (r = isFinite(r) ? r % 360 : 0) > 0 ? r : r + 360;
|
|
3730
|
-
}, Je = function(r) {
|
|
3731
|
-
return { r: K(r.r, 0, 255), g: K(r.g, 0, 255), b: K(r.b, 0, 255), a: K(r.a) };
|
|
3732
|
-
}, xe = function(r) {
|
|
3733
|
-
return { r: _(r.r), g: _(r.g), b: _(r.b), a: _(r.a, 3) };
|
|
3734
|
-
}, Xt = /^#([0-9a-f]{3,8})$/i, ke = function(r) {
|
|
3735
|
-
var e = r.toString(16);
|
|
3736
|
-
return e.length < 2 ? "0" + e : e;
|
|
3737
|
-
}, lt = function(r) {
|
|
3738
|
-
var e = r.r, t = r.g, n = r.b, a = r.a, o = Math.max(e, t, n), i = o - Math.min(e, t, n), u = i ? o === e ? (t - n) / i : o === t ? 2 + (n - e) / i : 4 + (e - t) / i : 0;
|
|
3739
|
-
return { h: 60 * (u < 0 ? u + 6 : u), s: o ? i / o * 100 : 0, v: o / 255 * 100, a };
|
|
3740
|
-
}, ht = function(r) {
|
|
3741
|
-
var e = r.h, t = r.s, n = r.v, a = r.a;
|
|
3742
|
-
e = e / 360 * 6, t /= 100, n /= 100;
|
|
3743
|
-
var o = Math.floor(e), i = n * (1 - t), u = n * (1 - (e - o) * t), l = n * (1 - (1 - e + o) * t), h = o % 6;
|
|
3744
|
-
return { r: 255 * [n, u, i, i, l, n][h], g: 255 * [l, n, n, u, i, i][h], b: 255 * [i, i, l, n, n, u][h], a };
|
|
3745
|
-
}, We = function(r) {
|
|
3746
|
-
return { h: ut(r.h), s: K(r.s, 0, 100), l: K(r.l, 0, 100), a: K(r.a) };
|
|
3747
|
-
}, Ze = function(r) {
|
|
3748
|
-
return { h: _(r.h), s: _(r.s), l: _(r.l), a: _(r.a, 3) };
|
|
3749
|
-
}, Qe = function(r) {
|
|
3750
|
-
return ht((t = (e = r).s, { h: e.h, s: (t *= ((n = e.l) < 50 ? n : 100 - n) / 100) > 0 ? 2 * t / (n + t) * 100 : 0, v: n + t, a: e.a }));
|
|
3751
|
-
var e, t, n;
|
|
3752
|
-
}, de = function(r) {
|
|
3753
|
-
return { h: (e = lt(r)).h, s: (a = (200 - (t = e.s)) * (n = e.v) / 100) > 0 && a < 200 ? t * n / 100 / (a <= 100 ? a : 200 - a) * 100 : 0, l: a / 2, a: e.a };
|
|
3754
|
-
var e, t, n, a;
|
|
3755
|
-
}, Gt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Jt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Wt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Zt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, et = { string: [[function(r) {
|
|
3756
|
-
var e = Xt.exec(r);
|
|
3757
|
-
return e ? (r = e[1]).length <= 4 ? { r: parseInt(r[0] + r[0], 16), g: parseInt(r[1] + r[1], 16), b: parseInt(r[2] + r[2], 16), a: r.length === 4 ? _(parseInt(r[3] + r[3], 16) / 255, 2) : 1 } : r.length === 6 || r.length === 8 ? { r: parseInt(r.substr(0, 2), 16), g: parseInt(r.substr(2, 2), 16), b: parseInt(r.substr(4, 2), 16), a: r.length === 8 ? _(parseInt(r.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
3758
|
-
}, "hex"], [function(r) {
|
|
3759
|
-
var e = Wt.exec(r) || Zt.exec(r);
|
|
3760
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Je({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
3761
|
-
}, "rgb"], [function(r) {
|
|
3762
|
-
var e = Gt.exec(r) || Jt.exec(r);
|
|
3763
|
-
if (!e) return null;
|
|
3764
|
-
var t, n, a = We({ h: (t = e[1], n = e[2], n === void 0 && (n = "deg"), Number(t) * (qt[n] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
3765
|
-
return Qe(a);
|
|
3766
|
-
}, "hsl"]], object: [[function(r) {
|
|
3767
|
-
var e = r.r, t = r.g, n = r.b, a = r.a, o = a === void 0 ? 1 : a;
|
|
3768
|
-
return Q(e) && Q(t) && Q(n) ? Je({ r: Number(e), g: Number(t), b: Number(n), a: Number(o) }) : null;
|
|
3769
|
-
}, "rgb"], [function(r) {
|
|
3770
|
-
var e = r.h, t = r.s, n = r.l, a = r.a, o = a === void 0 ? 1 : a;
|
|
3771
|
-
if (!Q(e) || !Q(t) || !Q(n)) return null;
|
|
3772
|
-
var i = We({ h: Number(e), s: Number(t), l: Number(n), a: Number(o) });
|
|
3773
|
-
return Qe(i);
|
|
3774
|
-
}, "hsl"], [function(r) {
|
|
3775
|
-
var e = r.h, t = r.s, n = r.v, a = r.a, o = a === void 0 ? 1 : a;
|
|
3776
|
-
if (!Q(e) || !Q(t) || !Q(n)) return null;
|
|
3777
|
-
var i = function(u) {
|
|
3778
|
-
return { h: ut(u.h), s: K(u.s, 0, 100), v: K(u.v, 0, 100), a: K(u.a) };
|
|
3779
|
-
}({ h: Number(e), s: Number(t), v: Number(n), a: Number(o) });
|
|
3780
|
-
return ht(i);
|
|
3781
|
-
}, "hsv"]] }, tt = function(r, e) {
|
|
3782
|
-
for (var t = 0; t < e.length; t++) {
|
|
3783
|
-
var n = e[t][0](r);
|
|
3784
|
-
if (n) return [n, e[t][1]];
|
|
3785
|
-
}
|
|
3786
|
-
return [null, void 0];
|
|
3787
|
-
}, Qt = function(r) {
|
|
3788
|
-
return typeof r == "string" ? tt(r.trim(), et.string) : typeof r == "object" && r !== null ? tt(r, et.object) : [null, void 0];
|
|
3789
|
-
}, Me = function(r, e) {
|
|
3790
|
-
var t = de(r);
|
|
3791
|
-
return { h: t.h, s: K(t.s + 100 * e, 0, 100), l: t.l, a: t.a };
|
|
3792
|
-
}, Be = function(r) {
|
|
3793
|
-
return (299 * r.r + 587 * r.g + 114 * r.b) / 1e3 / 255;
|
|
3794
|
-
}, rt = function(r, e) {
|
|
3795
|
-
var t = de(r);
|
|
3796
|
-
return { h: t.h, s: t.s, l: K(t.l + 100 * e, 0, 100), a: t.a };
|
|
3797
|
-
}, nt = function() {
|
|
3798
|
-
function r(e) {
|
|
3799
|
-
this.parsed = Qt(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
3800
|
-
}
|
|
3801
|
-
return r.prototype.isValid = function() {
|
|
3802
|
-
return this.parsed !== null;
|
|
3803
|
-
}, r.prototype.brightness = function() {
|
|
3804
|
-
return _(Be(this.rgba), 2);
|
|
3805
|
-
}, r.prototype.isDark = function() {
|
|
3806
|
-
return Be(this.rgba) < 0.5;
|
|
3807
|
-
}, r.prototype.isLight = function() {
|
|
3808
|
-
return Be(this.rgba) >= 0.5;
|
|
3809
|
-
}, r.prototype.toHex = function() {
|
|
3810
|
-
return e = xe(this.rgba), t = e.r, n = e.g, a = e.b, i = (o = e.a) < 1 ? ke(_(255 * o)) : "", "#" + ke(t) + ke(n) + ke(a) + i;
|
|
3811
|
-
var e, t, n, a, o, i;
|
|
3812
|
-
}, r.prototype.toRgb = function() {
|
|
3813
|
-
return xe(this.rgba);
|
|
3814
|
-
}, r.prototype.toRgbString = function() {
|
|
3815
|
-
return e = xe(this.rgba), t = e.r, n = e.g, a = e.b, (o = e.a) < 1 ? "rgba(" + t + ", " + n + ", " + a + ", " + o + ")" : "rgb(" + t + ", " + n + ", " + a + ")";
|
|
3816
|
-
var e, t, n, a, o;
|
|
3817
|
-
}, r.prototype.toHsl = function() {
|
|
3818
|
-
return Ze(de(this.rgba));
|
|
3819
|
-
}, r.prototype.toHslString = function() {
|
|
3820
|
-
return e = Ze(de(this.rgba)), t = e.h, n = e.s, a = e.l, (o = e.a) < 1 ? "hsla(" + t + ", " + n + "%, " + a + "%, " + o + ")" : "hsl(" + t + ", " + n + "%, " + a + "%)";
|
|
3821
|
-
var e, t, n, a, o;
|
|
3822
|
-
}, r.prototype.toHsv = function() {
|
|
3823
|
-
return e = lt(this.rgba), { h: _(e.h), s: _(e.s), v: _(e.v), a: _(e.a, 3) };
|
|
3824
|
-
var e;
|
|
3825
|
-
}, r.prototype.invert = function() {
|
|
3826
|
-
return G({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
3827
|
-
var e;
|
|
3828
|
-
}, r.prototype.saturate = function(e) {
|
|
3829
|
-
return e === void 0 && (e = 0.1), G(Me(this.rgba, e));
|
|
3830
|
-
}, r.prototype.desaturate = function(e) {
|
|
3831
|
-
return e === void 0 && (e = 0.1), G(Me(this.rgba, -e));
|
|
3832
|
-
}, r.prototype.grayscale = function() {
|
|
3833
|
-
return G(Me(this.rgba, -1));
|
|
3834
|
-
}, r.prototype.lighten = function(e) {
|
|
3835
|
-
return e === void 0 && (e = 0.1), G(rt(this.rgba, e));
|
|
3836
|
-
}, r.prototype.darken = function(e) {
|
|
3837
|
-
return e === void 0 && (e = 0.1), G(rt(this.rgba, -e));
|
|
3838
|
-
}, r.prototype.rotate = function(e) {
|
|
3839
|
-
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
3840
|
-
}, r.prototype.alpha = function(e) {
|
|
3841
|
-
return typeof e == "number" ? G({ r: (t = this.rgba).r, g: t.g, b: t.b, a: e }) : _(this.rgba.a, 3);
|
|
3842
|
-
var t;
|
|
3843
|
-
}, r.prototype.hue = function(e) {
|
|
3844
|
-
var t = de(this.rgba);
|
|
3845
|
-
return typeof e == "number" ? G({ h: e, s: t.s, l: t.l, a: t.a }) : _(t.h);
|
|
3846
|
-
}, r.prototype.isEqual = function(e) {
|
|
3847
|
-
return this.toHex() === G(e).toHex();
|
|
3848
|
-
}, r;
|
|
3849
|
-
}(), G = function(r) {
|
|
3850
|
-
return r instanceof nt ? r : new nt(r);
|
|
3851
|
-
};
|
|
3852
|
-
function se(r, e) {
|
|
3853
|
-
if (typeof r == "number")
|
|
3854
|
-
return r > 16777215 ? r : 4278190080 | r;
|
|
3855
|
-
const t = r.trim();
|
|
3856
|
-
if (t === "currentColor")
|
|
3857
|
-
return null;
|
|
3858
|
-
if (t.startsWith("var("))
|
|
3859
|
-
return t.slice(4, -1).trim(), null;
|
|
3860
|
-
const n = G(t);
|
|
3861
|
-
if (n.isValid()) {
|
|
3862
|
-
const { r: a, g: o, b: i } = n.toRgb();
|
|
3863
|
-
return Se(a, o, i);
|
|
3864
|
-
}
|
|
3865
|
-
return null;
|
|
3866
|
-
}
|
|
3867
|
-
const pe = "#4e51ff", ft = "g-theme--material", Ae = "g-theme--", _e = Symbol("gradient-theme");
|
|
3868
|
-
function er(r) {
|
|
3869
|
-
const e = se("#FFC107"), t = se("#4CAF50");
|
|
3870
|
-
if (e == null || t == null)
|
|
3871
|
-
throw new Error("Failed to normalize semantic seed color.");
|
|
3872
|
-
const n = r === "dark" ? "dark" : "light", a = oe(e).schemes[n].toJSON(), o = oe(t).schemes[n].toJSON();
|
|
3873
|
-
return {
|
|
3874
|
-
warning: X(N(a.primary)),
|
|
3875
|
-
onWarning: X(N(a.onPrimary)),
|
|
3876
|
-
warningContainer: X(
|
|
3877
|
-
N(a.primaryContainer)
|
|
3878
|
-
),
|
|
3879
|
-
onWarningContainer: X(
|
|
3880
|
-
N(a.onPrimaryContainer)
|
|
3881
|
-
),
|
|
3882
|
-
success: X(N(o.primary)),
|
|
3883
|
-
onSuccess: X(N(o.onPrimary)),
|
|
3884
|
-
successContainer: X(
|
|
3885
|
-
N(o.primaryContainer)
|
|
3886
|
-
),
|
|
3887
|
-
onSuccessContainer: X(
|
|
3888
|
-
N(o.onPrimaryContainer)
|
|
3889
|
-
)
|
|
3890
|
-
};
|
|
3891
|
-
}
|
|
3892
|
-
function tr(r, e) {
|
|
3893
|
-
const t = He(r), n = se(t);
|
|
3894
|
-
if (n == null)
|
|
3895
|
-
throw new Error("Failed to normalize seed color.");
|
|
3896
|
-
const a = oe(n), o = e === "dark" ? "dark" : "light", i = a.schemes[o].toJSON(), u = {};
|
|
3897
|
-
return Object.entries(i).forEach(([l, h]) => {
|
|
3898
|
-
const f = N(h), g = X(f);
|
|
3899
|
-
u[l] = g;
|
|
3900
|
-
}), {
|
|
3901
|
-
...u,
|
|
3902
|
-
...er(e)
|
|
3903
|
-
};
|
|
3904
|
-
}
|
|
3905
|
-
function rr(r) {
|
|
3906
|
-
const e = He(r), t = se(e), n = se("#FFC107"), a = se("#4CAF50");
|
|
3907
|
-
if (t == null || n == null || a == null)
|
|
3908
|
-
throw new Error("Failed to normalize gradient seed color.");
|
|
3909
|
-
const o = oe(t), i = oe(n), u = oe(a), l = o.schemes.light.toJSON(), h = i.schemes.light.toJSON(), f = u.schemes.light.toJSON(), g = N(l.error), p = N(h.primary), v = N(f.primary);
|
|
3910
|
-
return {
|
|
3911
|
-
...Yt(e, 135),
|
|
3912
|
-
main: he(e, 135),
|
|
3913
|
-
error: he(g, 135),
|
|
3914
|
-
warning: he(p, 135),
|
|
3915
|
-
success: he(v, 135)
|
|
3916
|
-
};
|
|
3917
|
-
}
|
|
3918
|
-
function He(r) {
|
|
3919
|
-
const e = se(r);
|
|
3920
|
-
return e == null ? pe : N(e);
|
|
3921
|
-
}
|
|
3922
|
-
function Ie(r, e) {
|
|
3923
|
-
let t = `.${ft} {
|
|
3924
|
-
`;
|
|
3925
|
-
for (const [a, o] of Object.entries(r))
|
|
3926
|
-
t += ` --g-${e}-${yt(a)}: ${o};
|
|
3927
|
-
`;
|
|
3928
|
-
t += "}";
|
|
3929
|
-
let n = document.getElementById(
|
|
3930
|
-
`g-${e}-style`
|
|
3723
|
+
const Ie = [
|
|
3724
|
+
50,
|
|
3725
|
+
100,
|
|
3726
|
+
200,
|
|
3727
|
+
300,
|
|
3728
|
+
400,
|
|
3729
|
+
500,
|
|
3730
|
+
600,
|
|
3731
|
+
700,
|
|
3732
|
+
800,
|
|
3733
|
+
900
|
|
3734
|
+
], Ee = {
|
|
3735
|
+
50: 90,
|
|
3736
|
+
100: 80,
|
|
3737
|
+
200: 70,
|
|
3738
|
+
300: 60,
|
|
3739
|
+
400: 50,
|
|
3740
|
+
500: 40,
|
|
3741
|
+
600: 35,
|
|
3742
|
+
700: 30,
|
|
3743
|
+
800: 20,
|
|
3744
|
+
900: 10
|
|
3745
|
+
}, pr = Object.fromEntries(
|
|
3746
|
+
Ie.map((a) => [a, Ee[a] >= 60 ? 10 : 100])
|
|
3747
|
+
), mr = (a) => {
|
|
3748
|
+
const e = Ye(a, "#000000");
|
|
3749
|
+
return hr(fr(e)).palettes.primary;
|
|
3750
|
+
}, Le = (a, e) => {
|
|
3751
|
+
const r = mr(a);
|
|
3752
|
+
return Object.fromEntries(
|
|
3753
|
+
Ie.map((t) => [
|
|
3754
|
+
t,
|
|
3755
|
+
lr(r.tone(e[t]))
|
|
3756
|
+
])
|
|
3931
3757
|
);
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
return ze(r, "dark");
|
|
3939
|
-
}
|
|
3940
|
-
function ze(r = pe, e = "light") {
|
|
3941
|
-
const t = document.documentElement;
|
|
3942
|
-
t.classList.add(ft), t.classList.remove(
|
|
3943
|
-
`${Ae}light`,
|
|
3944
|
-
`${Ae}dark`
|
|
3945
|
-
), t.classList.add(`${Ae}${e}`);
|
|
3946
|
-
const n = He(r), a = {
|
|
3947
|
-
theme: tr(n, e),
|
|
3948
|
-
colors: jt(n),
|
|
3949
|
-
gradient: rr(n)
|
|
3950
|
-
};
|
|
3951
|
-
return {
|
|
3952
|
-
tokens: a,
|
|
3953
|
-
themeCSS: Ie(a.theme, "theme"),
|
|
3954
|
-
colorsCSS: Ie(a.colors, "color"),
|
|
3955
|
-
gradientCSS: Ie(a.gradient, "gradient")
|
|
3956
|
-
};
|
|
3957
|
-
}
|
|
3958
|
-
function nr(r = {}) {
|
|
3959
|
-
const e = je(r.seed ?? pe), t = je(r.mode ?? "light"), n = Pt(
|
|
3960
|
-
null
|
|
3961
|
-
), a = () => typeof window > "u" ? null : (n.value = ze(e.value, t.value), n.value), o = (l) => (e.value = l, a()), i = (l) => (t.value = l, a()), u = () => (t.value = t.value === "dark" ? "light" : "dark", a());
|
|
3962
|
-
return r.autoApply !== !1 && a(), {
|
|
3963
|
-
seed: e,
|
|
3964
|
-
mode: t,
|
|
3965
|
-
result: n,
|
|
3966
|
-
apply: a,
|
|
3967
|
-
setSeed: o,
|
|
3968
|
-
setMode: i,
|
|
3969
|
-
toggleMode: u
|
|
3970
|
-
};
|
|
3971
|
-
}
|
|
3972
|
-
function cr(r = nr()) {
|
|
3973
|
-
return kt(_e, r), r;
|
|
3974
|
-
}
|
|
3975
|
-
function ur(r, e) {
|
|
3976
|
-
r.provide(_e, e);
|
|
3977
|
-
}
|
|
3978
|
-
function lr() {
|
|
3979
|
-
return bt(_e, null);
|
|
3758
|
+
}, yr = (a) => Le(a, Ee), gr = (a) => Le(a, pr), Sr = (a) => ({
|
|
3759
|
+
colors: yr(a),
|
|
3760
|
+
onColors: gr(a)
|
|
3761
|
+
});
|
|
3762
|
+
function br(a) {
|
|
3763
|
+
return a.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/([a-zA-Z])(\d+)/g, "$1-$2");
|
|
3980
3764
|
}
|
|
3981
3765
|
export {
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3766
|
+
Ie as C,
|
|
3767
|
+
T as H,
|
|
3768
|
+
pr as O,
|
|
3769
|
+
Ee as S,
|
|
3770
|
+
gr as a,
|
|
3771
|
+
yr as b,
|
|
3772
|
+
Ye as c,
|
|
3773
|
+
Sr as d,
|
|
3774
|
+
Ue as e,
|
|
3775
|
+
Pr as f,
|
|
3776
|
+
Cr as g,
|
|
3777
|
+
br as h,
|
|
3778
|
+
fr as i,
|
|
3779
|
+
lr as j,
|
|
3780
|
+
me as p,
|
|
3781
|
+
kr as r,
|
|
3782
|
+
hr as t
|
|
3990
3783
|
};
|