saturon 0.2.2 → 0.3.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/LICENSE +1 -1
- package/README.md +5 -4
- package/dist/Color.d.ts +58 -46
- package/dist/Color.js +144 -221
- package/dist/converters.d.ts +39 -145
- package/dist/converters.js +12 -432
- package/dist/engine.d.ts +148 -0
- package/dist/engine.js +1900 -0
- package/dist/index.umd.js +1800 -1312
- package/dist/index.umd.min.js +143 -1
- package/dist/math.d.ts +3 -12
- package/dist/math.js +12 -21
- package/dist/tests/Color.test.d.ts +17 -0
- package/dist/tests/Color.test.js +1062 -0
- package/dist/tests/wpt.test.d.ts +1 -0
- package/dist/tests/wpt.test.js +2129 -0
- package/dist/types.d.ts +66 -76
- package/dist/utils.d.ts +10 -141
- package/dist/utils.js +111 -1059
- package/package.json +10 -11
package/dist/converters.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HSL_to_RGB, HWB_to_RGB, LAB_to_LCH, LAB_to_XYZD50, LCH_to_LAB, OKLAB_to_OKLCH, OKLAB_to_XYZD65, OKLCH_to_OKLAB, RGB_to_HSL, RGB_to_HWB, RGB_to_XYZD65, XYZD50_to_LAB, XYZD65_to_OKLAB, XYZD65_to_RGB } from "./math.js";
|
|
2
|
-
import type { ColorConverter, ColorFunction, FormattingOptions } from "./types.js";
|
|
3
2
|
/**
|
|
4
3
|
* A collection of `<named-color>`s and their RGB values.
|
|
5
4
|
*
|
|
@@ -331,6 +330,11 @@ export declare const colorModels: {
|
|
|
331
330
|
readonly value: readonly [0, 255];
|
|
332
331
|
readonly precision: 0;
|
|
333
332
|
};
|
|
333
|
+
readonly alpha: {
|
|
334
|
+
readonly index: 3;
|
|
335
|
+
readonly value: readonly [0, 1];
|
|
336
|
+
readonly precision: 3;
|
|
337
|
+
};
|
|
334
338
|
};
|
|
335
339
|
readonly bridge: "xyz-d65";
|
|
336
340
|
readonly toBridge: typeof RGB_to_XYZD65;
|
|
@@ -342,7 +346,7 @@ export declare const colorModels: {
|
|
|
342
346
|
readonly components: {
|
|
343
347
|
readonly h: {
|
|
344
348
|
readonly index: 0;
|
|
345
|
-
readonly value: "
|
|
349
|
+
readonly value: "hue";
|
|
346
350
|
readonly precision: 0;
|
|
347
351
|
};
|
|
348
352
|
readonly s: {
|
|
@@ -355,6 +359,11 @@ export declare const colorModels: {
|
|
|
355
359
|
readonly value: "percentage";
|
|
356
360
|
readonly precision: 0;
|
|
357
361
|
};
|
|
362
|
+
readonly alpha: {
|
|
363
|
+
readonly index: 3;
|
|
364
|
+
readonly value: readonly [0, 1];
|
|
365
|
+
readonly precision: 3;
|
|
366
|
+
};
|
|
358
367
|
};
|
|
359
368
|
readonly bridge: "rgb";
|
|
360
369
|
readonly toBridge: typeof HSL_to_RGB;
|
|
@@ -364,7 +373,7 @@ export declare const colorModels: {
|
|
|
364
373
|
readonly components: {
|
|
365
374
|
readonly h: {
|
|
366
375
|
readonly index: 0;
|
|
367
|
-
readonly value: "
|
|
376
|
+
readonly value: "hue";
|
|
368
377
|
readonly precision: 0;
|
|
369
378
|
};
|
|
370
379
|
readonly w: {
|
|
@@ -377,6 +386,11 @@ export declare const colorModels: {
|
|
|
377
386
|
readonly value: "percentage";
|
|
378
387
|
readonly precision: 0;
|
|
379
388
|
};
|
|
389
|
+
readonly alpha: {
|
|
390
|
+
readonly index: 3;
|
|
391
|
+
readonly value: readonly [0, 1];
|
|
392
|
+
readonly precision: 3;
|
|
393
|
+
};
|
|
380
394
|
};
|
|
381
395
|
readonly bridge: "rgb";
|
|
382
396
|
readonly toBridge: typeof HWB_to_RGB;
|
|
@@ -400,6 +414,11 @@ export declare const colorModels: {
|
|
|
400
414
|
readonly value: readonly [-125, 125];
|
|
401
415
|
readonly precision: 5;
|
|
402
416
|
};
|
|
417
|
+
readonly alpha: {
|
|
418
|
+
readonly index: 3;
|
|
419
|
+
readonly value: readonly [0, 1];
|
|
420
|
+
readonly precision: 3;
|
|
421
|
+
};
|
|
403
422
|
};
|
|
404
423
|
readonly bridge: "xyz-d50";
|
|
405
424
|
readonly toBridge: typeof LAB_to_XYZD50;
|
|
@@ -420,9 +439,14 @@ export declare const colorModels: {
|
|
|
420
439
|
};
|
|
421
440
|
readonly h: {
|
|
422
441
|
readonly index: 2;
|
|
423
|
-
readonly value: "
|
|
442
|
+
readonly value: "hue";
|
|
424
443
|
readonly precision: 5;
|
|
425
444
|
};
|
|
445
|
+
readonly alpha: {
|
|
446
|
+
readonly index: 3;
|
|
447
|
+
readonly value: readonly [0, 1];
|
|
448
|
+
readonly precision: 3;
|
|
449
|
+
};
|
|
426
450
|
};
|
|
427
451
|
readonly bridge: "lab";
|
|
428
452
|
readonly toBridge: typeof LCH_to_LAB;
|
|
@@ -446,6 +470,11 @@ export declare const colorModels: {
|
|
|
446
470
|
readonly value: readonly [-0.4, 0.4];
|
|
447
471
|
readonly precision: 5;
|
|
448
472
|
};
|
|
473
|
+
readonly alpha: {
|
|
474
|
+
readonly index: 3;
|
|
475
|
+
readonly value: readonly [0, 1];
|
|
476
|
+
readonly precision: 3;
|
|
477
|
+
};
|
|
449
478
|
};
|
|
450
479
|
readonly bridge: "xyz-d65";
|
|
451
480
|
readonly toBridge: typeof OKLAB_to_XYZD65;
|
|
@@ -466,152 +495,17 @@ export declare const colorModels: {
|
|
|
466
495
|
};
|
|
467
496
|
readonly h: {
|
|
468
497
|
readonly index: 2;
|
|
469
|
-
readonly value: "
|
|
498
|
+
readonly value: "hue";
|
|
470
499
|
readonly precision: 5;
|
|
471
500
|
};
|
|
501
|
+
readonly alpha: {
|
|
502
|
+
readonly index: 3;
|
|
503
|
+
readonly value: readonly [0, 1];
|
|
504
|
+
readonly precision: 3;
|
|
505
|
+
};
|
|
472
506
|
};
|
|
473
507
|
readonly bridge: "oklab";
|
|
474
508
|
readonly toBridge: typeof OKLCH_to_OKLAB;
|
|
475
509
|
readonly fromBridge: typeof OKLAB_to_OKLCH;
|
|
476
510
|
};
|
|
477
511
|
};
|
|
478
|
-
/**
|
|
479
|
-
* A collection of `<color-function>`s as `<color>` converters.
|
|
480
|
-
*
|
|
481
|
-
* @see {@link https://www.w3.org/TR/css-color-5/|CSS Color Module Level 5}
|
|
482
|
-
*/
|
|
483
|
-
export declare const colorFunctions: Record<ColorFunction, ColorConverter>;
|
|
484
|
-
/**
|
|
485
|
-
* A collection of `<color-base>`s as `<color>` converters.
|
|
486
|
-
*
|
|
487
|
-
* @see {@link https://www.w3.org/TR/css-color-5/|CSS Color Module Level 5}
|
|
488
|
-
*/
|
|
489
|
-
export declare const colorBases: {
|
|
490
|
-
"named-color": {
|
|
491
|
-
isValid: (str: string) => boolean;
|
|
492
|
-
bridge: string;
|
|
493
|
-
toBridge: (coords: number[]) => number[];
|
|
494
|
-
parse: (name: string) => number[];
|
|
495
|
-
fromBridge: (coords: number[]) => number[];
|
|
496
|
-
format: (rgb: number[]) => string | undefined;
|
|
497
|
-
};
|
|
498
|
-
"color-mix": {
|
|
499
|
-
isValid: (str: string) => boolean;
|
|
500
|
-
bridge: string;
|
|
501
|
-
toBridge: (coords: number[]) => number[];
|
|
502
|
-
parse: (str: string) => number[];
|
|
503
|
-
};
|
|
504
|
-
transparent: {
|
|
505
|
-
isValid: (str: string) => str is "transparent";
|
|
506
|
-
bridge: string;
|
|
507
|
-
toBridge: (coords: number[]) => number[];
|
|
508
|
-
parse: (str: string) => number[];
|
|
509
|
-
};
|
|
510
|
-
rgb: ColorConverter;
|
|
511
|
-
"xyz-d65": ColorConverter;
|
|
512
|
-
"xyz-d50": ColorConverter;
|
|
513
|
-
lab: ColorConverter;
|
|
514
|
-
oklab: ColorConverter;
|
|
515
|
-
srgb: ColorConverter;
|
|
516
|
-
"srgb-linear": ColorConverter;
|
|
517
|
-
"display-p3": ColorConverter;
|
|
518
|
-
rec2020: ColorConverter;
|
|
519
|
-
"a98-rgb": ColorConverter;
|
|
520
|
-
"prophoto-rgb": ColorConverter;
|
|
521
|
-
xyz: ColorConverter;
|
|
522
|
-
hsl: ColorConverter;
|
|
523
|
-
hwb: ColorConverter;
|
|
524
|
-
lch: ColorConverter;
|
|
525
|
-
oklch: ColorConverter;
|
|
526
|
-
"hex-color": {
|
|
527
|
-
isValid: (str: string) => boolean;
|
|
528
|
-
bridge: string;
|
|
529
|
-
toBridge: (coords: number[]) => number[];
|
|
530
|
-
parse: (str: string) => number[];
|
|
531
|
-
fromBridge: (coords: number[]) => number[];
|
|
532
|
-
format: ([r, g, b, a]: number[]) => string;
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
/**
|
|
536
|
-
* A collection of `<color>` converters.
|
|
537
|
-
*
|
|
538
|
-
* @see {@link https://www.w3.org/TR/css-color-5/|CSS Color Module Level 5}
|
|
539
|
-
*/
|
|
540
|
-
export declare const colorTypes: {
|
|
541
|
-
currentColor: {
|
|
542
|
-
isValid: (str: string) => str is "currentcolor";
|
|
543
|
-
bridge: string;
|
|
544
|
-
toBridge: (coords: number[]) => number[];
|
|
545
|
-
parse: (str: string) => number[];
|
|
546
|
-
};
|
|
547
|
-
"system-color": {
|
|
548
|
-
isValid: (str: string) => boolean;
|
|
549
|
-
bridge: string;
|
|
550
|
-
toBridge: (coords: number[]) => number[];
|
|
551
|
-
parse: (str: string) => number[];
|
|
552
|
-
};
|
|
553
|
-
"contrast-color": {
|
|
554
|
-
isValid: (str: string) => boolean;
|
|
555
|
-
bridge: string;
|
|
556
|
-
toBridge: (coords: number[]) => number[];
|
|
557
|
-
parse: (str: string) => number[];
|
|
558
|
-
};
|
|
559
|
-
"device-cmyk": {
|
|
560
|
-
isValid: (str: string) => boolean;
|
|
561
|
-
bridge: string;
|
|
562
|
-
toBridge: (coords: number[]) => number[];
|
|
563
|
-
parse: (str: string) => number[];
|
|
564
|
-
fromBridge: (coords: number[]) => number[];
|
|
565
|
-
format: ([red, green, blue, alpha]: number[], options?: FormattingOptions) => string;
|
|
566
|
-
};
|
|
567
|
-
"light-dark": {
|
|
568
|
-
isValid: (str: string) => boolean;
|
|
569
|
-
bridge: string;
|
|
570
|
-
toBridge: (coords: number[]) => number[];
|
|
571
|
-
parse: (str: string) => number[];
|
|
572
|
-
};
|
|
573
|
-
"named-color": {
|
|
574
|
-
isValid: (str: string) => boolean;
|
|
575
|
-
bridge: string;
|
|
576
|
-
toBridge: (coords: number[]) => number[];
|
|
577
|
-
parse: (name: string) => number[];
|
|
578
|
-
fromBridge: (coords: number[]) => number[];
|
|
579
|
-
format: (rgb: number[]) => string | undefined;
|
|
580
|
-
};
|
|
581
|
-
"color-mix": {
|
|
582
|
-
isValid: (str: string) => boolean;
|
|
583
|
-
bridge: string;
|
|
584
|
-
toBridge: (coords: number[]) => number[];
|
|
585
|
-
parse: (str: string) => number[];
|
|
586
|
-
};
|
|
587
|
-
transparent: {
|
|
588
|
-
isValid: (str: string) => str is "transparent";
|
|
589
|
-
bridge: string;
|
|
590
|
-
toBridge: (coords: number[]) => number[];
|
|
591
|
-
parse: (str: string) => number[];
|
|
592
|
-
};
|
|
593
|
-
rgb: ColorConverter;
|
|
594
|
-
"xyz-d65": ColorConverter;
|
|
595
|
-
"xyz-d50": ColorConverter;
|
|
596
|
-
lab: ColorConverter;
|
|
597
|
-
oklab: ColorConverter;
|
|
598
|
-
srgb: ColorConverter;
|
|
599
|
-
"srgb-linear": ColorConverter;
|
|
600
|
-
"display-p3": ColorConverter;
|
|
601
|
-
rec2020: ColorConverter;
|
|
602
|
-
"a98-rgb": ColorConverter;
|
|
603
|
-
"prophoto-rgb": ColorConverter;
|
|
604
|
-
xyz: ColorConverter;
|
|
605
|
-
hsl: ColorConverter;
|
|
606
|
-
hwb: ColorConverter;
|
|
607
|
-
lch: ColorConverter;
|
|
608
|
-
oklch: ColorConverter;
|
|
609
|
-
"hex-color": {
|
|
610
|
-
isValid: (str: string) => boolean;
|
|
611
|
-
bridge: string;
|
|
612
|
-
toBridge: (coords: number[]) => number[];
|
|
613
|
-
parse: (str: string) => number[];
|
|
614
|
-
fromBridge: (coords: number[]) => number[];
|
|
615
|
-
format: ([r, g, b, a]: number[]) => string;
|
|
616
|
-
};
|
|
617
|
-
};
|