dev-classes 1.4.35 → 1.4.36
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/classes/Color/Color.d.ts +1 -1
- package/dist/index.js +9 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,15 +6,6 @@ const h = class h {
|
|
|
6
6
|
const [t, s, n] = this.hexToRgb(e), o = this.rgbaToHsla(t, s, n, 1);
|
|
7
7
|
return o.l >= this.MIN_LIGHTNESS && o.s >= this.MIN_SATURATION;
|
|
8
8
|
}
|
|
9
|
-
static brightColor(e = 1.3) {
|
|
10
|
-
let t = 0, s;
|
|
11
|
-
do {
|
|
12
|
-
const [n, o, i] = h.generateRGB();
|
|
13
|
-
if (s = `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`, s = h.increaseSaturation(s, e), t++, t > 100)
|
|
14
|
-
break;
|
|
15
|
-
} while (!h.isBrightAndVivid(s));
|
|
16
|
-
return s;
|
|
17
|
-
}
|
|
18
9
|
};
|
|
19
10
|
/*Проверить свои методы и возможно исключить т.к. функционал возможно повторяется */
|
|
20
11
|
c(h, "componentToHex", (e) => {
|
|
@@ -190,7 +181,15 @@ c(h, "mixColors", (e, t, s) => {
|
|
|
190
181
|
[e[t], e[s]] = [e[s], e[t]];
|
|
191
182
|
}
|
|
192
183
|
return `#${e[0].toString(16).padStart(2, "0")}${e[1].toString(16).padStart(2, "0")}${e[2].toString(16).padStart(2, "0")}`;
|
|
193
|
-
}), c(h, "generateRGB", () => Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128))), c(h, "
|
|
184
|
+
}), c(h, "generateRGB", () => Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128))), c(h, "brightColor", (e = 1.3) => {
|
|
185
|
+
let t = 0, s;
|
|
186
|
+
do {
|
|
187
|
+
const [n, o, i] = h.generateRGB();
|
|
188
|
+
if (s = `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`, s = h.increaseSaturation(s, e), t++, t > 100)
|
|
189
|
+
break;
|
|
190
|
+
} while (!h.isBrightAndVivid(s));
|
|
191
|
+
return s;
|
|
192
|
+
}), c(h, "hslToHex", (e, t, s) => {
|
|
194
193
|
const n = h.hslaToRgba(e, t, s, 1), [o, i, a] = n.slice(0, 3);
|
|
195
194
|
return h.rgbToHex(o, i, a);
|
|
196
195
|
}), c(h, "generatePleasantColor", (e = {}) => {
|