@thi.ng/color 5.8.16 → 5.8.18
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/defcolor.js +9 -1
- package/int/int.js +3 -1
- package/package.json +15 -15
package/defcolor.js
CHANGED
|
@@ -106,7 +106,15 @@ const defColor = (spec) => {
|
|
|
106
106
|
const res = new $Color(...args);
|
|
107
107
|
return mode !== spec.mode ? convert(res, src, spec.mode, mode) : res.set(src);
|
|
108
108
|
};
|
|
109
|
-
const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(
|
|
109
|
+
const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(
|
|
110
|
+
...__ensureArgs([src, ...args])
|
|
111
|
+
) : fromColor(
|
|
112
|
+
intArgb32Srgb([], src),
|
|
113
|
+
"srgb",
|
|
114
|
+
args
|
|
115
|
+
) : illegalArgs(
|
|
116
|
+
`can't create a ${spec.mode} color from: ${src}`
|
|
117
|
+
);
|
|
110
118
|
factory.class = $Color;
|
|
111
119
|
factory.range = [min, max];
|
|
112
120
|
factory.random = (rnd, buf, idx, stride) => new $Color(buf, idx, stride).randomize(rnd);
|
package/int/int.js
CHANGED
|
@@ -137,7 +137,9 @@ class ABGR extends Int32 {
|
|
|
137
137
|
}
|
|
138
138
|
declareIndex(ABGR.prototype, "value", 0);
|
|
139
139
|
const __defInt = (ctor, fromSrgb) => {
|
|
140
|
-
const factory = (src, ...args) => src == null ? new ctor() : isNumber(src) ? args.length && args.every(isNumber) ? new ctor([srgbIntArgb32([src, ...args])]) : new ctor([src], ...args) : isString(src) ? factory(parseCss(src)) : isArrayLike(src) ? isString(src.mode) ? new ctor([fromSrgb(srgb(src))], ...args) : new ctor(src, ...args) : implementsFunction(src, "deref") ? new ctor([fromSrgb(srgb(src))], ...args) : illegalArgs(
|
|
140
|
+
const factory = (src, ...args) => src == null ? new ctor() : isNumber(src) ? args.length && args.every(isNumber) ? new ctor([srgbIntArgb32([src, ...args])]) : new ctor([src], ...args) : isString(src) ? factory(parseCss(src)) : isArrayLike(src) ? isString(src.mode) ? new ctor([fromSrgb(srgb(src))], ...args) : new ctor(src, ...args) : implementsFunction(src, "deref") ? new ctor([fromSrgb(srgb(src))], ...args) : illegalArgs(
|
|
141
|
+
`can't create a ARGB32 color from: ${src}`
|
|
142
|
+
);
|
|
141
143
|
factory.class = ctor;
|
|
142
144
|
factory.range = [[0], [4294967295]];
|
|
143
145
|
factory.random = (rnd = SYSTEM, buf, idx, stride) => new ctor(buf, idx, stride).set([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/color",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.18",
|
|
4
4
|
"description": "Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@thi.ng/api": "^8.12.
|
|
48
|
-
"@thi.ng/arrays": "^2.14.
|
|
49
|
-
"@thi.ng/binary": "^3.6.
|
|
50
|
-
"@thi.ng/checks": "^3.8.
|
|
51
|
-
"@thi.ng/compare": "^2.5.
|
|
52
|
-
"@thi.ng/compose": "^3.0.
|
|
53
|
-
"@thi.ng/defmulti": "^3.0.
|
|
54
|
-
"@thi.ng/errors": "^2.6.
|
|
55
|
-
"@thi.ng/math": "^5.15.
|
|
56
|
-
"@thi.ng/random": "^4.1.
|
|
57
|
-
"@thi.ng/strings": "^3.
|
|
58
|
-
"@thi.ng/transducers": "^9.6.
|
|
59
|
-
"@thi.ng/vectors": "^8.6.
|
|
47
|
+
"@thi.ng/api": "^8.12.17",
|
|
48
|
+
"@thi.ng/arrays": "^2.14.13",
|
|
49
|
+
"@thi.ng/binary": "^3.6.6",
|
|
50
|
+
"@thi.ng/checks": "^3.8.7",
|
|
51
|
+
"@thi.ng/compare": "^2.5.5",
|
|
52
|
+
"@thi.ng/compose": "^3.0.54",
|
|
53
|
+
"@thi.ng/defmulti": "^3.0.94",
|
|
54
|
+
"@thi.ng/errors": "^2.6.6",
|
|
55
|
+
"@thi.ng/math": "^5.15.6",
|
|
56
|
+
"@thi.ng/random": "^4.1.42",
|
|
57
|
+
"@thi.ng/strings": "^3.11.0",
|
|
58
|
+
"@thi.ng/transducers": "^9.6.30",
|
|
59
|
+
"@thi.ng/vectors": "^8.6.25"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"esbuild": "^0.27.2",
|
|
@@ -447,5 +447,5 @@
|
|
|
447
447
|
"vectors"
|
|
448
448
|
]
|
|
449
449
|
},
|
|
450
|
-
"gitHead": "
|
|
450
|
+
"gitHead": "d46ec975b426bb2ceb137cab734395c97436d59b\n"
|
|
451
451
|
}
|