color-bits 0.1.0 → 1.0.0
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 +82 -2
- package/benchmarks/index.ts +35 -0
- package/build/bit.d.ts +3 -0
- package/{src/bit.ts → build/bit.js} +15 -13
- package/build/bit.js.map +1 -0
- package/build/convert.d.ts +23 -0
- package/build/convert.js +347 -0
- package/build/convert.js.map +1 -0
- package/build/core.d.ts +27 -0
- package/build/core.js +75 -0
- package/build/core.js.map +1 -0
- package/build/format.d.ts +24 -0
- package/build/format.js +133 -0
- package/build/format.js.map +1 -0
- package/build/functions.d.ts +33 -0
- package/build/functions.js +95 -0
- package/build/functions.js.map +1 -0
- package/{src/index.ts → build/index.d.ts} +1 -1
- package/build/index.js +21 -0
- package/build/index.js.map +1 -0
- package/build/parse.d.ts +17 -0
- package/build/parse.js +392 -0
- package/build/parse.js.map +1 -0
- package/build/string.d.ts +5 -0
- package/build/string.js +38 -0
- package/build/string.js.map +1 -0
- package/build/transform.d.ts +19 -0
- package/build/transform.js +40 -0
- package/build/transform.js.map +1 -0
- package/build/transformString.d.ts +3 -0
- package/build/transformString.js +35 -0
- package/build/transformString.js.map +1 -0
- package/package.json +24 -1
- package/tsconfig.json +4 -2
- package/src/color.test.ts +0 -66
- package/src/convert.ts +0 -392
- package/src/core.ts +0 -58
- package/src/functions.ts +0 -27
- package/src/parse.ts +0 -392
- package/src/transform.ts +0 -58
- package/src/transformString.ts +0 -7
package/build/parse.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.parse = parse;
|
|
27
|
+
exports.parseHex = parseHex;
|
|
28
|
+
exports.parseColor = parseColor;
|
|
29
|
+
const core_1 = require("./core");
|
|
30
|
+
const convert = __importStar(require("./convert"));
|
|
31
|
+
const HASH = '#'.charCodeAt(0);
|
|
32
|
+
const PERCENT = '%'.charCodeAt(0);
|
|
33
|
+
const G = 'g'.charCodeAt(0);
|
|
34
|
+
const N = 'n'.charCodeAt(0);
|
|
35
|
+
const D = 'd'.charCodeAt(0);
|
|
36
|
+
const E = 'e'.charCodeAt(0);
|
|
37
|
+
/**
|
|
38
|
+
* Approximative CSS colorspace string pattern, e.g. rgb(), color()
|
|
39
|
+
*/
|
|
40
|
+
const PATTERN = (() => {
|
|
41
|
+
const NAME = '(\\w+)';
|
|
42
|
+
const SEPARATOR = '[\\s,\\/]';
|
|
43
|
+
const VALUE = '([^\\s,\\/]+)';
|
|
44
|
+
const SEPARATOR_THEN_VALUE = `(?:${SEPARATOR}+${VALUE})`;
|
|
45
|
+
return new RegExp(`${NAME}\\(
|
|
46
|
+
${SEPARATOR}*
|
|
47
|
+
${VALUE}
|
|
48
|
+
${SEPARATOR_THEN_VALUE}
|
|
49
|
+
${SEPARATOR_THEN_VALUE}
|
|
50
|
+
${SEPARATOR_THEN_VALUE}?
|
|
51
|
+
${SEPARATOR_THEN_VALUE}?
|
|
52
|
+
${SEPARATOR}*
|
|
53
|
+
\\)`.replace(/\s/g, ''));
|
|
54
|
+
})();
|
|
55
|
+
/**
|
|
56
|
+
* Parse CSS color
|
|
57
|
+
* @param color CSS color string: #xxx, #xxxxxx, #xxxxxxxx, rgb(), rgba(), hsl(), hsla(), color()
|
|
58
|
+
*/
|
|
59
|
+
function parse(color) {
|
|
60
|
+
if (color.charCodeAt(0) === HASH) {
|
|
61
|
+
return parseHex(color);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return parseColor(color);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse hexadecimal CSS color
|
|
69
|
+
* @param color Hex color string: #xxx, #xxxxxx, #xxxxxxxx
|
|
70
|
+
*/
|
|
71
|
+
function parseHex(color) {
|
|
72
|
+
let r = 0x00;
|
|
73
|
+
let g = 0x00;
|
|
74
|
+
let b = 0x00;
|
|
75
|
+
let a = 0xff;
|
|
76
|
+
switch (color.length) {
|
|
77
|
+
// #59f
|
|
78
|
+
case 4: {
|
|
79
|
+
r = (hexValue(color.charCodeAt(1)) << 4) + hexValue(color.charCodeAt(1));
|
|
80
|
+
g = (hexValue(color.charCodeAt(2)) << 4) + hexValue(color.charCodeAt(2));
|
|
81
|
+
b = (hexValue(color.charCodeAt(3)) << 4) + hexValue(color.charCodeAt(3));
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
// #5599ff
|
|
85
|
+
case 7: {
|
|
86
|
+
r = (hexValue(color.charCodeAt(1)) << 4) + hexValue(color.charCodeAt(2));
|
|
87
|
+
g = (hexValue(color.charCodeAt(3)) << 4) + hexValue(color.charCodeAt(4));
|
|
88
|
+
b = (hexValue(color.charCodeAt(5)) << 4) + hexValue(color.charCodeAt(6));
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
// #5599ff88
|
|
92
|
+
case 9: {
|
|
93
|
+
r = (hexValue(color.charCodeAt(1)) << 4) + hexValue(color.charCodeAt(2));
|
|
94
|
+
g = (hexValue(color.charCodeAt(3)) << 4) + hexValue(color.charCodeAt(4));
|
|
95
|
+
b = (hexValue(color.charCodeAt(5)) << 4) + hexValue(color.charCodeAt(6));
|
|
96
|
+
a = (hexValue(color.charCodeAt(7)) << 4) + hexValue(color.charCodeAt(8));
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return (0, core_1.newColor)(r, g, b, a);
|
|
104
|
+
}
|
|
105
|
+
// https://lemire.me/blog/2019/04/17/parsing-short-hexadecimal-strings-efficiently/
|
|
106
|
+
function hexValue(c) {
|
|
107
|
+
return (c & 0xF) + 9 * (c >> 6);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Parse CSS color
|
|
111
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
|
112
|
+
* @param color CSS color string: rgb(), rgba(), hsl(), hsla(), color()
|
|
113
|
+
*/
|
|
114
|
+
function parseColor(color) {
|
|
115
|
+
const match = PATTERN.exec(color);
|
|
116
|
+
if (match === null) {
|
|
117
|
+
throw new Error(`Color.parse(): invalid CSS color: "${color}"`);
|
|
118
|
+
}
|
|
119
|
+
const format = match[1];
|
|
120
|
+
const p1 = match[2];
|
|
121
|
+
const p2 = match[3];
|
|
122
|
+
const p3 = match[4];
|
|
123
|
+
const p4 = match[5];
|
|
124
|
+
const p5 = match[6];
|
|
125
|
+
switch (format) {
|
|
126
|
+
case 'rgb':
|
|
127
|
+
case 'rgba': {
|
|
128
|
+
const r = parseColorChannel(p1);
|
|
129
|
+
const g = parseColorChannel(p2);
|
|
130
|
+
const b = parseColorChannel(p3);
|
|
131
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
132
|
+
return (0, core_1.newColor)(r, g, b, a);
|
|
133
|
+
}
|
|
134
|
+
case 'hsl':
|
|
135
|
+
case 'hsla': {
|
|
136
|
+
const h = parseAngle(p1);
|
|
137
|
+
const s = parsePercentage(p2);
|
|
138
|
+
const l = parsePercentage(p3);
|
|
139
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
140
|
+
// https://stackoverflow.com/a/9493060/3112706
|
|
141
|
+
let r, g, b;
|
|
142
|
+
if (s === 0) {
|
|
143
|
+
r = g = b = Math.round(l * 255); // achromatic
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
147
|
+
const p = 2 * l - q;
|
|
148
|
+
r = Math.round(hueToRGB(p, q, h + 1 / 3) * 255);
|
|
149
|
+
g = Math.round(hueToRGB(p, q, h) * 255);
|
|
150
|
+
b = Math.round(hueToRGB(p, q, h - 1 / 3) * 255);
|
|
151
|
+
}
|
|
152
|
+
return (0, core_1.newColor)(r, g, b, a);
|
|
153
|
+
}
|
|
154
|
+
case 'hwb': {
|
|
155
|
+
const h = parseAngle(p1);
|
|
156
|
+
const w = parsePercentage(p2);
|
|
157
|
+
const bl = parsePercentage(p3);
|
|
158
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
159
|
+
/* https://drafts.csswg.org/css-color/#hwb-to-rgb */
|
|
160
|
+
const s = 1.0;
|
|
161
|
+
const l = 0.5;
|
|
162
|
+
// Same as HSL to RGB
|
|
163
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
164
|
+
const p = 2 * l - q;
|
|
165
|
+
let r = Math.round(hueToRGB(p, q, h + 1 / 3) * 255);
|
|
166
|
+
let g = Math.round(hueToRGB(p, q, h) * 255);
|
|
167
|
+
let b = Math.round(hueToRGB(p, q, h - 1 / 3) * 255);
|
|
168
|
+
// Then HWB
|
|
169
|
+
r = hwbApply(r, w, bl);
|
|
170
|
+
g = hwbApply(g, w, bl);
|
|
171
|
+
b = hwbApply(b, w, bl);
|
|
172
|
+
return (0, core_1.newColor)(r, g, b, a);
|
|
173
|
+
}
|
|
174
|
+
case 'lab': {
|
|
175
|
+
const l = parsePercentageFor(p1, 100);
|
|
176
|
+
const aa = parsePercentageFor(p2, 125);
|
|
177
|
+
const b = parsePercentageFor(p3, 125);
|
|
178
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
179
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.labToXyzd50(l, aa, b)));
|
|
180
|
+
}
|
|
181
|
+
case 'lch': {
|
|
182
|
+
const l = parsePercentageFor(p1, 100);
|
|
183
|
+
const c = parsePercentageFor(p2, 150);
|
|
184
|
+
const h = parseAngle(p3) * 360;
|
|
185
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
186
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.labToXyzd50(...convert.lchToLab(l, c, h))));
|
|
187
|
+
}
|
|
188
|
+
case 'oklab': {
|
|
189
|
+
const l = parsePercentageFor(p1, 1);
|
|
190
|
+
const aa = parsePercentageFor(p2, 0.4);
|
|
191
|
+
const b = parsePercentageFor(p3, 0.4);
|
|
192
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
193
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.xyzd65ToD50(...convert.oklabToXyzd65(l, aa, b))));
|
|
194
|
+
}
|
|
195
|
+
case 'oklch': {
|
|
196
|
+
const l = parsePercentageOrValue(p1);
|
|
197
|
+
const c = parsePercentageOrValue(p2);
|
|
198
|
+
const h = parsePercentageOrValue(p3);
|
|
199
|
+
const a = p4 ? parseAlphaChannel(p4) : 255;
|
|
200
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.oklchToXyzd50(l, c, h)));
|
|
201
|
+
}
|
|
202
|
+
case 'color': {
|
|
203
|
+
// https://drafts.csswg.org/css-color-4/#color-function
|
|
204
|
+
const colorspace = p1;
|
|
205
|
+
const c1 = parsePercentageOrValue(p2);
|
|
206
|
+
const c2 = parsePercentageOrValue(p3);
|
|
207
|
+
const c3 = parsePercentageOrValue(p4);
|
|
208
|
+
const a = p5 ? parseAlphaChannel(p5) : 255;
|
|
209
|
+
switch (colorspace) {
|
|
210
|
+
// RGB color spaces
|
|
211
|
+
case 'srgb': {
|
|
212
|
+
return newColorFromArray(a, [c1, c2, c3]);
|
|
213
|
+
}
|
|
214
|
+
case 'srgb-linear': {
|
|
215
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.srgbLinearToXyzd50(c1, c2, c3)));
|
|
216
|
+
}
|
|
217
|
+
case 'display-p3': {
|
|
218
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.displayP3ToXyzd50(c1, c2, c3)));
|
|
219
|
+
}
|
|
220
|
+
case 'a98-rgb': {
|
|
221
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.adobeRGBToXyzd50(c1, c2, c3)));
|
|
222
|
+
}
|
|
223
|
+
case 'prophoto-rgb': {
|
|
224
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.proPhotoToXyzd50(c1, c2, c3)));
|
|
225
|
+
}
|
|
226
|
+
case 'rec2020': {
|
|
227
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.rec2020ToXyzd50(c1, c2, c3)));
|
|
228
|
+
}
|
|
229
|
+
// XYZ color spaces
|
|
230
|
+
case 'xyz':
|
|
231
|
+
case 'xyz-d65': {
|
|
232
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(...convert.xyzd65ToD50(c1, c2, c3)));
|
|
233
|
+
}
|
|
234
|
+
case 'xyz-d50': {
|
|
235
|
+
return newColorFromArray(a, convert.xyzd50ToSrgb(c1, c2, c3));
|
|
236
|
+
}
|
|
237
|
+
default:
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
default:
|
|
241
|
+
}
|
|
242
|
+
throw new Error(`Color.parse(): invalid CSS color: "${color}"`);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Accepts: "50%", "128"
|
|
246
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#values
|
|
247
|
+
* @returns a value in the 0 to 255 range
|
|
248
|
+
*/
|
|
249
|
+
function parseColorChannel(channel) {
|
|
250
|
+
if (channel.charCodeAt(channel.length - 1) === PERCENT) {
|
|
251
|
+
return Math.round((parseFloat(channel) / 100) * 255);
|
|
252
|
+
}
|
|
253
|
+
return Math.round(parseFloat(channel));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Accepts: "50%", ".5", "0.5"
|
|
257
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/alpha-value
|
|
258
|
+
* @returns a value in the [0, 255] range
|
|
259
|
+
*/
|
|
260
|
+
function parseAlphaChannel(channel) {
|
|
261
|
+
return Math.round(parseAlphaValue(channel) * 255);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Accepts: "50%", ".5", "0.5"
|
|
265
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/alpha-value
|
|
266
|
+
* @returns a value in the [0, 1] range
|
|
267
|
+
*/
|
|
268
|
+
function parseAlphaValue(channel) {
|
|
269
|
+
if (channel.charCodeAt(0) === N) {
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
if (channel.charCodeAt(channel.length - 1) === PERCENT) {
|
|
273
|
+
return parseFloat(channel) / 100;
|
|
274
|
+
}
|
|
275
|
+
return parseFloat(channel);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Accepts: "360", "360deg", "400grad", "6.28rad", "1turn", "none"
|
|
279
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/angle
|
|
280
|
+
* @returns a value in the 0.0 to 1.0 range
|
|
281
|
+
*/
|
|
282
|
+
function parseAngle(angle) {
|
|
283
|
+
let factor = 1;
|
|
284
|
+
switch (angle.charCodeAt(angle.length - 1)) {
|
|
285
|
+
case E: {
|
|
286
|
+
// 'none'
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
case D: {
|
|
290
|
+
// 'rad', 'grad'
|
|
291
|
+
if (angle.charCodeAt(Math.max(0, angle.length - 4)) === G) {
|
|
292
|
+
// 'grad'
|
|
293
|
+
factor = 400;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// 'rad'
|
|
297
|
+
factor = 2 * Math.PI; // TAU
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case N: {
|
|
302
|
+
// 'turn'
|
|
303
|
+
factor = 1;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
// case G: // 'deg', but no need to check as it's also the default
|
|
307
|
+
default: {
|
|
308
|
+
factor = 360;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return parseFloat(angle) / factor;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Accepts: "100%", "none"
|
|
315
|
+
* @returns a value in the 0.0 to 1.0 range
|
|
316
|
+
*/
|
|
317
|
+
function parsePercentage(value) {
|
|
318
|
+
if (value.charCodeAt(0) === N) {
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
return parseFloat(value) / 100;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Accepts: "1.0", "100%", "none"
|
|
325
|
+
* @returns a value in the 0.0 to 1.0 range
|
|
326
|
+
*/
|
|
327
|
+
function parsePercentageOrValue(value) {
|
|
328
|
+
if (value.charCodeAt(0) === N) {
|
|
329
|
+
return 0;
|
|
330
|
+
}
|
|
331
|
+
if (value.charCodeAt(value.length - 1) === PERCENT) {
|
|
332
|
+
return parseFloat(value) / 100;
|
|
333
|
+
}
|
|
334
|
+
return parseFloat(value);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Accepts: "100", "100%", "none"
|
|
338
|
+
* @returns a value in the -@range to @range range
|
|
339
|
+
*/
|
|
340
|
+
function parsePercentageFor(value, range) {
|
|
341
|
+
if (value.charCodeAt(0) === N) {
|
|
342
|
+
return 0;
|
|
343
|
+
}
|
|
344
|
+
if (value.charCodeAt(value.length - 1) === PERCENT) {
|
|
345
|
+
return parseFloat(value) / 100 * range;
|
|
346
|
+
}
|
|
347
|
+
return parseFloat(value);
|
|
348
|
+
}
|
|
349
|
+
// HSL functions
|
|
350
|
+
function hueToRGB(p, q, t) {
|
|
351
|
+
if (t < 0) {
|
|
352
|
+
t += 1;
|
|
353
|
+
}
|
|
354
|
+
;
|
|
355
|
+
if (t > 1) {
|
|
356
|
+
t -= 1;
|
|
357
|
+
}
|
|
358
|
+
;
|
|
359
|
+
if (t < 1 / 6) {
|
|
360
|
+
return p + (q - p) * 6 * t;
|
|
361
|
+
}
|
|
362
|
+
;
|
|
363
|
+
if (t < 1 / 2) {
|
|
364
|
+
return q;
|
|
365
|
+
}
|
|
366
|
+
;
|
|
367
|
+
if (t < 2 / 3) {
|
|
368
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
369
|
+
}
|
|
370
|
+
;
|
|
371
|
+
{
|
|
372
|
+
return p;
|
|
373
|
+
}
|
|
374
|
+
;
|
|
375
|
+
}
|
|
376
|
+
// HWB functions
|
|
377
|
+
function hwbApply(channel, w, b) {
|
|
378
|
+
let result = channel / 255;
|
|
379
|
+
result *= 1 - w - b;
|
|
380
|
+
result += w;
|
|
381
|
+
return Math.round(result * 255);
|
|
382
|
+
}
|
|
383
|
+
function clamp(value) {
|
|
384
|
+
return Math.max(0, Math.min(255, value));
|
|
385
|
+
}
|
|
386
|
+
function newColorFromArray(a, rgb) {
|
|
387
|
+
const r = clamp(Math.round(rgb[0] * 255));
|
|
388
|
+
const g = clamp(Math.round(rgb[1] * 255));
|
|
389
|
+
const b = clamp(Math.round(rgb[2] * 255));
|
|
390
|
+
return (0, core_1.newColor)(r, g, b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
1
|
+
export declare function alpha(color: string, value: number): string;
|
|
2
|
+
export declare function blend(background: string, overlay: string, opacity: number, gamma: number): string;
|
|
3
|
+
export declare function darken(color: string, value: number): string;
|
|
4
|
+
export declare function lighten(color: string, value: number): string;
|
|
5
|
+
export declare function getLuminance(color: string): number;
|
package/build/string.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.alpha = alpha;
|
|
27
|
+
exports.blend = blend;
|
|
28
|
+
exports.darken = darken;
|
|
29
|
+
exports.lighten = lighten;
|
|
30
|
+
exports.getLuminance = getLuminance;
|
|
31
|
+
const Color = __importStar(require("./"));
|
|
32
|
+
const { format, parse, alpha: alphaBase, blend: blendBase, darken: darkenBase, lighten: lightenBase, getLuminance: getLuminanceBase, } = Color;
|
|
33
|
+
function alpha(color, value) { return format(alphaBase(parse(color), value)); }
|
|
34
|
+
function blend(background, overlay, opacity, gamma) { return format(blendBase(parse(background), parse(overlay), opacity, gamma)); }
|
|
35
|
+
function darken(color, value) { return format(darkenBase(parse(color), value)); }
|
|
36
|
+
function lighten(color, value) { return format(lightenBase(parse(color), value)); }
|
|
37
|
+
function getLuminance(color) { return getLuminanceBase(parse(color)); }
|
|
38
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,sBAAqG;AACrG,sBAA0K;AAC1K,wBAAuG;AACvG,0BAAyG;AACzG,oCAAqF;AAhBrF,0CAA2B;AAE3B,MAAM,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,GAC/B,GAAG,KAAK,CAAA;AAET,SAAgB,KAAK,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AACrG,SAAgB,KAAK,CAAC,UAAkB,EAAE,OAAe,EAAE,OAAe,EAAE,KAAa,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AAC1K,SAAgB,MAAM,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AACvG,SAAgB,OAAO,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AACzG,SAAgB,YAAY,CAAC,KAAa,IAAI,OAAO,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Color } from './core';
|
|
2
|
+
/**
|
|
3
|
+
* Modifies color alpha channel.
|
|
4
|
+
* @param color - Color
|
|
5
|
+
* @param value - Value in the range [0, 1]
|
|
6
|
+
*/
|
|
7
|
+
export declare function alpha(color: Color, value: number): Color;
|
|
8
|
+
/**
|
|
9
|
+
* Darkens a color.
|
|
10
|
+
* @param color - Color
|
|
11
|
+
* @param coefficient - Multiplier in the range [0, 1]
|
|
12
|
+
*/
|
|
13
|
+
export declare function darken(color: Color, coefficient: number): Color;
|
|
14
|
+
/**
|
|
15
|
+
* Lighten a color.
|
|
16
|
+
* @param color - Color
|
|
17
|
+
* @param coefficient - Multiplier in the range [0, 1]
|
|
18
|
+
*/
|
|
19
|
+
export declare function lighten(color: Color, coefficient: number): Color;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alpha = alpha;
|
|
4
|
+
exports.darken = darken;
|
|
5
|
+
exports.lighten = lighten;
|
|
6
|
+
const core_1 = require("./core");
|
|
7
|
+
/**
|
|
8
|
+
* Modifies color alpha channel.
|
|
9
|
+
* @param color - Color
|
|
10
|
+
* @param value - Value in the range [0, 1]
|
|
11
|
+
*/
|
|
12
|
+
function alpha(color, value) {
|
|
13
|
+
return (0, core_1.setAlpha)(color, Math.round(value * 255));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Darkens a color.
|
|
17
|
+
* @param color - Color
|
|
18
|
+
* @param coefficient - Multiplier in the range [0, 1]
|
|
19
|
+
*/
|
|
20
|
+
function darken(color, coefficient) {
|
|
21
|
+
const r = (0, core_1.getRed)(color);
|
|
22
|
+
const g = (0, core_1.getGreen)(color);
|
|
23
|
+
const b = (0, core_1.getBlue)(color);
|
|
24
|
+
const a = (0, core_1.getAlpha)(color);
|
|
25
|
+
const factor = 1 - coefficient;
|
|
26
|
+
return (0, core_1.newColor)(r * factor, g * factor, b * factor, a);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Lighten a color.
|
|
30
|
+
* @param color - Color
|
|
31
|
+
* @param coefficient - Multiplier in the range [0, 1]
|
|
32
|
+
*/
|
|
33
|
+
function lighten(color, coefficient) {
|
|
34
|
+
const r = (0, core_1.getRed)(color);
|
|
35
|
+
const g = (0, core_1.getGreen)(color);
|
|
36
|
+
const b = (0, core_1.getBlue)(color);
|
|
37
|
+
const a = (0, core_1.getAlpha)(color);
|
|
38
|
+
return (0, core_1.newColor)(r + (255 - r) * coefficient, g + (255 - g) * coefficient, b + (255 - b) * coefficient, a);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;AAeA,sBAEC;AAOD,wBAcC;AAOD,0BAYC;AAzDD,iCAQgB;AAEhB;;;;GAIG;AACH,SAAgB,KAAK,CAAC,KAAY,EAAE,KAAa;IAC/C,OAAO,IAAA,eAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAA;AACjD,CAAC;AAED;;;;GAIG;AACH,SAAgB,MAAM,CAAC,KAAY,EAAE,WAAmB;IACtD,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,cAAO,EAAC,KAAK,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAE1B,MAAM,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC;IAE/B,OAAO,IAAA,eAAQ,EACb,CAAC,GAAG,MAAM,EACV,CAAC,GAAG,MAAM,EACV,CAAC,GAAG,MAAM,EACV,CAAC,CACF,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,KAAY,EAAE,WAAmB;IACvD,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,cAAO,EAAC,KAAK,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,IAAA,eAAQ,EACb,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.alpha = alpha;
|
|
27
|
+
exports.darken = darken;
|
|
28
|
+
exports.lighten = lighten;
|
|
29
|
+
const core_1 = require("./core");
|
|
30
|
+
const parse_1 = require("./parse");
|
|
31
|
+
const Transform = __importStar(require("./transform"));
|
|
32
|
+
function alpha(color, value) { return (0, core_1.from)(Transform.alpha((0, parse_1.parse)(color), value)); }
|
|
33
|
+
function darken(color, value) { return (0, core_1.from)(Transform.darken((0, parse_1.parse)(color), value)); }
|
|
34
|
+
function lighten(color, value) { return (0, core_1.from)(Transform.lighten((0, parse_1.parse)(color), value)); }
|
|
35
|
+
//# sourceMappingURL=transformString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformString.js","sourceRoot":"","sources":["../src/transformString.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,sBAAyG;AACzG,wBAA2G;AAC3G,0BAA6G;AAN7G,iCAA6B;AAC7B,mCAA+B;AAC/B,uDAAwC;AAExC,SAAgB,KAAK,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,KAAK,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AACzG,SAAgB,MAAM,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,MAAM,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AAC3G,SAAgB,OAAO,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-bits",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"exports": {
|
|
6
7
|
".": "./build/index.js",
|
|
7
8
|
"./*": "./build/*"
|
|
@@ -10,20 +11,42 @@
|
|
|
10
11
|
"author": "",
|
|
11
12
|
"license": "ISC",
|
|
12
13
|
"description": "",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"ignore": [
|
|
16
|
+
"!build/",
|
|
17
|
+
"docs/",
|
|
18
|
+
"src/",
|
|
19
|
+
"test/"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
13
22
|
"devDependencies": {
|
|
14
23
|
"@babel/preset-env": "^7.25.4",
|
|
15
24
|
"@babel/preset-typescript": "^7.24.7",
|
|
16
25
|
"@jest/globals": "^29.7.0",
|
|
17
26
|
"@types/chai": "^4.3.19",
|
|
18
27
|
"@types/jest": "^29.5.12",
|
|
28
|
+
"benny": "^3.7.1",
|
|
19
29
|
"chai": "^5.1.1",
|
|
30
|
+
"chroma-js": "^3.0.0",
|
|
31
|
+
"color": "^4.2.3",
|
|
32
|
+
"colord": "^2.9.3",
|
|
20
33
|
"jest": "^29.7.0",
|
|
34
|
+
"npmignore": "^0.3.1",
|
|
35
|
+
"tinycolor2": "^1.6.0",
|
|
21
36
|
"ts-jest": "^29.2.5",
|
|
37
|
+
"tsdoc-markdown": "^0.6.0",
|
|
38
|
+
"tsx": "^4.19.0",
|
|
39
|
+
"typedoc": "^0.26.6",
|
|
40
|
+
"typedoc-plugin-markdown": "^4.2.6",
|
|
22
41
|
"typescript": "^5.5.4"
|
|
23
42
|
},
|
|
24
43
|
"scripts": {
|
|
25
44
|
"build": "tsc",
|
|
26
45
|
"start": "tsc --watch",
|
|
46
|
+
"docs": "pnpm run docs:core && pnpm run docs:string",
|
|
47
|
+
"docs:core": "typedoc --readme none --plugin typedoc-plugin-markdown --out ./docs ./src/index.ts",
|
|
48
|
+
"docs:string": "typedoc --readme none --plugin typedoc-plugin-markdown --out ./docs/string ./src/string.ts",
|
|
49
|
+
"benchmark": "tsx ./benchmarks/index.ts",
|
|
27
50
|
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --watch"
|
|
28
51
|
}
|
|
29
52
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"module": "
|
|
3
|
+
"module": "NodeNext",
|
|
4
|
+
"moduleResolution": "NodeNext",
|
|
4
5
|
"lib": ["ES2017"],
|
|
5
6
|
"strict": true,
|
|
6
7
|
"noImplicitAny": true,
|
|
7
8
|
"esModuleInterop": true,
|
|
8
9
|
"preserveConstEnums": true,
|
|
9
10
|
"outDir": "./build",
|
|
10
|
-
"sourceMap": true
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"declaration": true
|
|
11
13
|
},
|
|
12
14
|
"include": ["src/**/*"],
|
|
13
15
|
"exclude": ["**/*.test.ts"]
|