@burdenoff/fe-libs 2026.1118.10 → 2026.1118.11
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/dist/shared/backgrounds/color.js +68 -51
- package/package.json +1 -1
|
@@ -37,71 +37,88 @@ function r(r) {
|
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
var i;
|
|
41
|
-
function a(
|
|
40
|
+
var i = null;
|
|
41
|
+
function a() {
|
|
42
|
+
if (typeof document > "u") return null;
|
|
43
|
+
if (i?.document !== document) {
|
|
44
|
+
let e = null;
|
|
45
|
+
try {
|
|
46
|
+
let t = document.createElement("canvas");
|
|
47
|
+
t.width = 1, t.height = 1, e = t.getContext("2d", { willReadFrequently: !0 });
|
|
48
|
+
} catch {
|
|
49
|
+
e = null;
|
|
50
|
+
}
|
|
51
|
+
i = {
|
|
52
|
+
document,
|
|
53
|
+
context: e
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return i.context;
|
|
57
|
+
}
|
|
58
|
+
function o(e, t) {
|
|
59
|
+
e.fillStyle = "#000000", e.fillStyle = t;
|
|
60
|
+
let n = String(e.fillStyle);
|
|
61
|
+
return e.fillStyle = "#ffffff", e.fillStyle = t, String(e.fillStyle) === n;
|
|
62
|
+
}
|
|
63
|
+
function s(e) {
|
|
42
64
|
let t = r(e);
|
|
43
65
|
if (t) return t;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
if (!i || typeof CSS < "u" && typeof CSS.supports == "function" && !CSS.supports("color", e)) return null;
|
|
51
|
-
i.fillStyle = e, i.clearRect(0, 0, 1, 1), i.fillRect(0, 0, 1, 1);
|
|
52
|
-
let [n, a, o, s] = i.getImageData(0, 0, 1, 1).data;
|
|
53
|
-
return s === 0 ? {
|
|
66
|
+
let n = a();
|
|
67
|
+
if (!n || typeof CSS < "u" && typeof CSS.supports == "function" && !CSS.supports("color", e) || !o(n, e)) return null;
|
|
68
|
+
n.clearRect(0, 0, 1, 1), n.fillRect(0, 0, 1, 1);
|
|
69
|
+
let [i, s, c, l] = n.getImageData(0, 0, 1, 1).data;
|
|
70
|
+
return l === 0 ? {
|
|
54
71
|
r: 0,
|
|
55
72
|
g: 0,
|
|
56
73
|
b: 0,
|
|
57
74
|
a: 0
|
|
58
75
|
} : {
|
|
59
|
-
r:
|
|
60
|
-
g:
|
|
61
|
-
b:
|
|
62
|
-
a:
|
|
76
|
+
r: i,
|
|
77
|
+
g: s,
|
|
78
|
+
b: c,
|
|
79
|
+
a: l / 255
|
|
63
80
|
};
|
|
64
81
|
}
|
|
65
|
-
function
|
|
66
|
-
return r(e) ??
|
|
82
|
+
function c(e) {
|
|
83
|
+
return r(e) ?? s(e);
|
|
67
84
|
}
|
|
68
|
-
function
|
|
69
|
-
let n =
|
|
85
|
+
function l(e, t) {
|
|
86
|
+
let n = c(e), r = c(t);
|
|
70
87
|
return n && r ? [n, r] : null;
|
|
71
88
|
}
|
|
72
|
-
var
|
|
89
|
+
var u = (e) => {
|
|
73
90
|
let t = e / 255;
|
|
74
91
|
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
75
|
-
},
|
|
92
|
+
}, d = (e) => {
|
|
76
93
|
let t = e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
77
94
|
return n(Math.round(t * 255), 0, 255);
|
|
78
95
|
};
|
|
79
|
-
function
|
|
80
|
-
let r =
|
|
96
|
+
function f({ r: e, g: t, b: n }) {
|
|
97
|
+
let r = u(e), i = u(t), a = u(n), o = Math.cbrt(.4122214708 * r + .5363325363 * i + .0514459929 * a), s = Math.cbrt(.2119034982 * r + .6806995451 * i + .1073969566 * a), c = Math.cbrt(.0883024619 * r + .2817188376 * i + .6299787005 * a);
|
|
81
98
|
return {
|
|
82
|
-
L: .2104542553 * o + .793617785 * s - .0040720468 *
|
|
83
|
-
a: 1.9779984951 * o - 2.428592205 * s + .4505937099 *
|
|
84
|
-
b: .0259040371 * o + .7827717662 * s - .808675766 *
|
|
99
|
+
L: .2104542553 * o + .793617785 * s - .0040720468 * c,
|
|
100
|
+
a: 1.9779984951 * o - 2.428592205 * s + .4505937099 * c,
|
|
101
|
+
b: .0259040371 * o + .7827717662 * s - .808675766 * c
|
|
85
102
|
};
|
|
86
103
|
}
|
|
87
|
-
function
|
|
88
|
-
let [n, r, i] =
|
|
104
|
+
function p(e, t = 1) {
|
|
105
|
+
let [n, r, i] = h(e);
|
|
89
106
|
return {
|
|
90
|
-
r:
|
|
91
|
-
g:
|
|
92
|
-
b:
|
|
107
|
+
r: d(n),
|
|
108
|
+
g: d(r),
|
|
109
|
+
b: d(i),
|
|
93
110
|
a: t
|
|
94
111
|
};
|
|
95
112
|
}
|
|
96
|
-
function
|
|
97
|
-
let i =
|
|
98
|
-
return
|
|
113
|
+
function m(e, t, r) {
|
|
114
|
+
let i = f(e), a = f(t), o = n(r, 0, 1);
|
|
115
|
+
return p({
|
|
99
116
|
L: i.L + (a.L - i.L) * o,
|
|
100
117
|
a: i.a + (a.a - i.a) * o,
|
|
101
118
|
b: i.b + (a.b - i.b) * o
|
|
102
119
|
}, e.a + (t.a - e.a) * o);
|
|
103
120
|
}
|
|
104
|
-
function
|
|
121
|
+
function h({ L: e, a: t, b: n }) {
|
|
105
122
|
let r = (e + .3963377774 * t + .2158037573 * n) ** 3, i = (e - .1055613458 * t - .0638541728 * n) ** 3, a = (e - .0894841775 * t - 1.291485548 * n) ** 3;
|
|
106
123
|
return [
|
|
107
124
|
4.0767416621 * r - 3.3077115913 * i + .2309699292 * a,
|
|
@@ -109,45 +126,45 @@ function p({ L: e, a: t, b: n }) {
|
|
|
109
126
|
-.0041960863 * r - .7034186147 * i + 1.707614701 * a
|
|
110
127
|
];
|
|
111
128
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
114
|
-
if (
|
|
129
|
+
var g = (e) => h(e).every((e) => e >= -1e-4 && e <= 1.0001);
|
|
130
|
+
function _(e, t = 1) {
|
|
131
|
+
if (g(e)) return p(e, t);
|
|
115
132
|
let n = 0, r = 1;
|
|
116
133
|
for (let t = 0; t < 12; t++) {
|
|
117
134
|
let t = (n + r) / 2;
|
|
118
|
-
|
|
135
|
+
g({
|
|
119
136
|
L: e.L,
|
|
120
137
|
a: e.a * t,
|
|
121
138
|
b: e.b * t
|
|
122
139
|
}) ? n = t : r = t;
|
|
123
140
|
}
|
|
124
|
-
return
|
|
141
|
+
return p({
|
|
125
142
|
L: e.L,
|
|
126
143
|
a: e.a * n,
|
|
127
144
|
b: e.b * n
|
|
128
145
|
}, t);
|
|
129
146
|
}
|
|
130
|
-
function
|
|
131
|
-
let i =
|
|
132
|
-
return
|
|
147
|
+
function v(e, t, r = 1) {
|
|
148
|
+
let i = f(e);
|
|
149
|
+
return _({
|
|
133
150
|
L: n(t, 0, 1),
|
|
134
151
|
a: i.a * r,
|
|
135
152
|
b: i.b * r
|
|
136
153
|
}, e.a);
|
|
137
154
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
155
|
+
function y(e) {
|
|
156
|
+
return f(e).L;
|
|
140
157
|
}
|
|
141
|
-
function
|
|
142
|
-
let t =
|
|
143
|
-
return
|
|
158
|
+
function b(e) {
|
|
159
|
+
let t = f(e);
|
|
160
|
+
return p({
|
|
144
161
|
L: n(1.08 - t.L, .12, .62),
|
|
145
162
|
a: t.a,
|
|
146
163
|
b: t.b
|
|
147
164
|
}, e.a);
|
|
148
165
|
}
|
|
149
|
-
function
|
|
166
|
+
function x({ r: e, g: t, b: r, a: i }, a = 1) {
|
|
150
167
|
let o = n(i * a, 0, 1);
|
|
151
168
|
return `rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(r)}, ${Math.round(o * 1e3) / 1e3})`;
|
|
152
169
|
}
|
|
153
|
-
export {
|
|
170
|
+
export { x as cssRgba, p as fromOklab, _ as fromOklabInGamut, y as lightness, m as mixOklab, r as parseColor, c as readColor, l as readColorPair, s as resolveColor, b as toInk, f as toOklab, v as withLightness };
|