@getcoherent/core 0.6.38 → 0.6.40
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/index.js +5 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10215,11 +10215,7 @@ function hslToRgb(h, s, l) {
|
|
|
10215
10215
|
;
|
|
10216
10216
|
[r1, g1, b1] = [c, 0, x];
|
|
10217
10217
|
}
|
|
10218
|
-
return [
|
|
10219
|
-
Math.round((r1 + m) * 255),
|
|
10220
|
-
Math.round((g1 + m) * 255),
|
|
10221
|
-
Math.round((b1 + m) * 255)
|
|
10222
|
-
];
|
|
10218
|
+
return [Math.round((r1 + m) * 255), Math.round((g1 + m) * 255), Math.round((b1 + m) * 255)];
|
|
10223
10219
|
}
|
|
10224
10220
|
function componentToHex(c) {
|
|
10225
10221
|
const clamped = Math.max(0, Math.min(255, Math.round(c)));
|
|
@@ -10244,25 +10240,13 @@ function colorToHex(value) {
|
|
|
10244
10240
|
return `#${trimmed.toUpperCase()}`;
|
|
10245
10241
|
}
|
|
10246
10242
|
const lower = trimmed.toLowerCase();
|
|
10247
|
-
const rgbMatch = lower.match(
|
|
10248
|
-
/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/
|
|
10249
|
-
);
|
|
10243
|
+
const rgbMatch = lower.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/);
|
|
10250
10244
|
if (rgbMatch) {
|
|
10251
|
-
return rgbToHex(
|
|
10252
|
-
parseInt(rgbMatch[1], 10),
|
|
10253
|
-
parseInt(rgbMatch[2], 10),
|
|
10254
|
-
parseInt(rgbMatch[3], 10)
|
|
10255
|
-
);
|
|
10245
|
+
return rgbToHex(parseInt(rgbMatch[1], 10), parseInt(rgbMatch[2], 10), parseInt(rgbMatch[3], 10));
|
|
10256
10246
|
}
|
|
10257
|
-
const hslMatch = lower.match(
|
|
10258
|
-
/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*[\d.]+\s*)?\)$/
|
|
10259
|
-
);
|
|
10247
|
+
const hslMatch = lower.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*[\d.]+\s*)?\)$/);
|
|
10260
10248
|
if (hslMatch) {
|
|
10261
|
-
const [r, g, b] = hslToRgb(
|
|
10262
|
-
parseFloat(hslMatch[1]),
|
|
10263
|
-
parseFloat(hslMatch[2]) / 100,
|
|
10264
|
-
parseFloat(hslMatch[3]) / 100
|
|
10265
|
-
);
|
|
10249
|
+
const [r, g, b] = hslToRgb(parseFloat(hslMatch[1]), parseFloat(hslMatch[2]) / 100, parseFloat(hslMatch[3]) / 100);
|
|
10266
10250
|
return rgbToHex(r, g, b);
|
|
10267
10251
|
}
|
|
10268
10252
|
if (CSS_NAMED_COLORS[lower]) {
|