color-2-name 1.2.0 → 1.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/.eslintrc.json +12 -0
- package/.gitignore +1 -0
- package/babel.config.json +6 -0
- package/jest.config.json +21 -0
- package/lib/@types/color-utils.d.ts +2 -3
- package/lib/@types/common.d.ts +52 -20
- package/lib/@types/hex-utils.d.ts +8 -1
- package/lib/@types/hsl-utils.d.ts +1 -0
- package/lib/@types/index.d.ts +14 -13
- package/lib/@types/rgb-utils.d.ts +2 -1
- package/lib/@types/types.d.ts +1 -1
- package/lib/browser/color-2-name.js +1 -1
- package/lib/browser/color-2-name.js.map +4 -4
- package/lib/cjs/_virtual/_tslib.cjs +35 -0
- package/lib/cjs/_virtual/_tslib.cjs.map +1 -0
- package/lib/cjs/color-utils.cjs +29 -0
- package/lib/cjs/color-utils.cjs.map +1 -0
- package/lib/cjs/{@types/color-utils.d.ts → color-utils.d.ts} +2 -3
- package/lib/cjs/common.cjs +200 -0
- package/lib/cjs/common.cjs.map +1 -0
- package/lib/cjs/common.d.ts +93 -0
- package/lib/cjs/data/colorSet.cjs +148 -0
- package/lib/cjs/data/colorSet.cjs.map +1 -0
- package/lib/cjs/hex-utils.cjs +105 -0
- package/lib/cjs/hex-utils.cjs.map +1 -0
- package/lib/cjs/{@types/hex-utils.d.ts → hex-utils.d.ts} +8 -1
- package/lib/cjs/hsl-utils.cjs +139 -0
- package/lib/cjs/hsl-utils.cjs.map +1 -0
- package/lib/cjs/{@types/hsl-utils.d.ts → hsl-utils.d.ts} +1 -0
- package/lib/cjs/index.cjs +164 -0
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/{@types/index.d.ts → index.d.ts} +14 -13
- package/lib/cjs/rgb-utils.cjs +58 -0
- package/lib/cjs/rgb-utils.cjs.map +1 -0
- package/lib/cjs/{@types/rgb-utils.d.ts → rgb-utils.d.ts} +2 -1
- package/lib/cjs/{@types/types.d.ts → types.d.ts} +1 -1
- package/lib/esm/_virtual/_tslib.mjs +35 -0
- package/lib/esm/_virtual/_tslib.mjs.map +1 -0
- package/lib/esm/color-utils.d.ts +12 -0
- package/lib/esm/color-utils.mjs +27 -0
- package/lib/esm/color-utils.mjs.map +1 -0
- package/lib/esm/common.d.ts +93 -0
- package/lib/esm/common.mjs +184 -0
- package/lib/esm/common.mjs.map +1 -0
- package/lib/esm/data/colorSet.d.ts +2 -0
- package/lib/esm/data/colorSet.mjs +146 -0
- package/lib/esm/data/colorSet.mjs.map +1 -0
- package/lib/esm/hex-utils.d.ts +47 -0
- package/lib/esm/hex-utils.mjs +98 -0
- package/lib/esm/hex-utils.mjs.map +1 -0
- package/lib/esm/hsl-utils.d.ts +33 -0
- package/lib/esm/hsl-utils.mjs +133 -0
- package/lib/esm/hsl-utils.mjs.map +1 -0
- package/lib/esm/index.d.ts +87 -0
- package/lib/esm/index.mjs +155 -0
- package/lib/esm/index.mjs.map +1 -0
- package/lib/esm/rgb-utils.d.ts +26 -0
- package/lib/esm/rgb-utils.mjs +53 -0
- package/lib/esm/rgb-utils.mjs.map +1 -0
- package/lib/esm/types.d.ts +37 -0
- package/lib/umd/color-2-name.js +812 -0
- package/lib/umd/color-2-name.min.js +1 -0
- package/lib/umd/color-utils.d.ts +12 -0
- package/lib/umd/common.d.ts +93 -0
- package/lib/umd/data/colorSet.d.ts +2 -0
- package/lib/umd/hex-utils.d.ts +47 -0
- package/lib/umd/hsl-utils.d.ts +33 -0
- package/lib/umd/index.d.ts +87 -0
- package/lib/umd/rgb-utils.d.ts +26 -0
- package/lib/umd/types.d.ts +37 -0
- package/package.json +30 -32
- package/readme.md +24 -36
- package/tests/colors_hex.test.ts +80 -0
- package/tests/colors_hsl.test.ts +57 -0
- package/tests/colors_rgb.test.ts +44 -0
- package/tests/{index.test.ts → core.test.ts} +27 -40
- package/tsconfig.json +3 -3
- package/.eslintrc.js +0 -11
- package/lib/cjs/@types/common.d.ts +0 -61
- package/lib/cjs/color-utils.js +0 -75
- package/lib/cjs/color-utils.js.map +0 -1
- package/lib/cjs/common.js +0 -134
- package/lib/cjs/common.js.map +0 -1
- package/lib/cjs/data/colorSet.js +0 -859
- package/lib/cjs/data/colorSet.js.map +0 -1
- package/lib/cjs/hex-utils.js +0 -59
- package/lib/cjs/hex-utils.js.map +0 -1
- package/lib/cjs/hsl-utils.js +0 -60
- package/lib/cjs/hsl-utils.js.map +0 -1
- package/lib/cjs/index.js +0 -129
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/rgb-utils.js +0 -45
- package/lib/cjs/rgb-utils.js.map +0 -1
- package/lib/cjs/types.js +0 -6
- package/lib/cjs/types.js.map +0 -1
- package/lib/esm/color-utils.js +0 -28
- package/lib/esm/common.js +0 -80
- package/lib/esm/data/colorSet.js +0 -848
- package/lib/esm/hex-utils.js +0 -32
- package/lib/esm/hsl-utils.js +0 -37
- package/lib/esm/index.js +0 -58
- package/lib/esm/rgb-utils.js +0 -24
- package/lib/esm/types.js +0 -1
- package/lib/umd/isoToLanguage.js +0 -1
- package/lib/umd/isoToLanguage.js.map +0 -1
- package/tests/benchmark.ts +0 -36
- package/tests/colors.test.ts +0 -204
- /package/lib/cjs/{@types/data → data}/colorSet.d.ts +0 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"node": true,
|
|
5
|
+
"commonjs": true,
|
|
6
|
+
"es2021": true
|
|
7
|
+
},
|
|
8
|
+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
9
|
+
"parser": "@typescript-eslint/parser",
|
|
10
|
+
"plugins": ["@typescript-eslint"],
|
|
11
|
+
"root": true
|
|
12
|
+
}
|
package/.gitignore
CHANGED
package/jest.config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testRegex": "(/tests/.*(test|spec))\\.tsx?$",
|
|
3
|
+
"globals": {
|
|
4
|
+
"ts-jest": {}
|
|
5
|
+
},
|
|
6
|
+
"transformIgnorePatterns": ["/node_modules/"],
|
|
7
|
+
"coverageThreshold": {
|
|
8
|
+
"global": {
|
|
9
|
+
"branches": 10,
|
|
10
|
+
"functions": 10,
|
|
11
|
+
"lines": 10,
|
|
12
|
+
"statements": 10
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"coverageReporters": ["text", "lcov"],
|
|
16
|
+
"coverageDirectory": "./tests/coverage",
|
|
17
|
+
"collectCoverageFrom": [
|
|
18
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
|
19
|
+
"!**/tests/**"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -5,9 +5,8 @@ import { RGBCOLORDEF } from "./types";
|
|
|
5
5
|
* @param {string} searchedColor -the name of the color to search for
|
|
6
6
|
* @param {Array} set - the colorSet to search in
|
|
7
7
|
*/
|
|
8
|
-
declare function getColor(searchedColor: string, set?: RGBCOLORDEF[] | undefined): {
|
|
9
|
-
hex:
|
|
8
|
+
export declare function getColor(searchedColor: string, set?: RGBCOLORDEF[] | undefined): {
|
|
9
|
+
hex: string;
|
|
10
10
|
rgb: string;
|
|
11
11
|
hsl: string;
|
|
12
12
|
};
|
|
13
|
-
export default getColor;
|
package/lib/@types/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RGBCOLORDEF
|
|
1
|
+
import { RGBCOLORDEF } from "./types";
|
|
2
2
|
/** The maximum distance possible between colors */
|
|
3
3
|
export declare const MAXDISTANCE = 441.6729559300637;
|
|
4
4
|
/** A regex to match hex colors */
|
|
@@ -7,16 +7,18 @@ export declare const hexRegex: RegExp;
|
|
|
7
7
|
export declare const rgbRegex: RegExp;
|
|
8
8
|
/** A regex to match hsl colors */
|
|
9
9
|
export declare const hslRegex: RegExp;
|
|
10
|
-
/** A regex to match strings that are only
|
|
10
|
+
/** A regex to match strings that are only valid numbers with and without decimals and the number can be negative and without the 0 in the beginning */
|
|
11
11
|
export declare const isNumeric: RegExp;
|
|
12
|
+
/** Remove comments from string */
|
|
13
|
+
export declare const stripComments: RegExp;
|
|
12
14
|
/**
|
|
13
|
-
* This set is used
|
|
15
|
+
* This set is used to detect if the color is bright or dark
|
|
14
16
|
*
|
|
15
17
|
* @note the set has been corrected to get pure RGB values (eg. pure red, pure green) in the "bright" area
|
|
16
18
|
*/
|
|
17
19
|
export declare const BLACKANDWHITE: RGBCOLORDEF[];
|
|
18
20
|
/**
|
|
19
|
-
* This set is used
|
|
21
|
+
* This set is used to detect the nearest rgb color
|
|
20
22
|
*/
|
|
21
23
|
export declare const RGBSET: RGBCOLORDEF[];
|
|
22
24
|
/**
|
|
@@ -26,36 +28,66 @@ export declare const RGBSET: RGBCOLORDEF[];
|
|
|
26
28
|
*
|
|
27
29
|
* @param {string} rawValues - the value inside the rgb(.*) css color definition
|
|
28
30
|
*
|
|
29
|
-
* @return {Array} the array of rgb values
|
|
31
|
+
* @return {Array} the array of rgb values found inside the passed string
|
|
30
32
|
*/
|
|
31
33
|
export declare function splitValues(rawValues: string): string[];
|
|
32
34
|
/**
|
|
33
35
|
* If the value is an angle in degrees, convert it to the 0-360 range
|
|
34
36
|
*
|
|
35
|
-
* @param {string}
|
|
36
|
-
* @param {number} multiplier - the number that represent the maximum - default is 100
|
|
37
|
+
* @param {string} angle - the degrees to convert into a number
|
|
37
38
|
*
|
|
38
39
|
* @return {number} the converted value
|
|
39
40
|
*/
|
|
40
|
-
export declare function
|
|
41
|
+
export declare function normalizeDegrees(angle: string): number;
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
+
* Returns a value that is limited between a minimum and maximum value.
|
|
43
44
|
*
|
|
44
|
-
* @param {
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {number} value - The value to be limited.
|
|
46
|
+
* @param {number} min - The minimum allowed value (default is 0).
|
|
47
|
+
* @param {number} max - The maximum allowed value (default is 0).
|
|
48
|
+
* @return {number} The limited value.
|
|
49
|
+
*/
|
|
50
|
+
export declare function limitValue(value: number, min?: number, max?: number): number;
|
|
51
|
+
/**
|
|
52
|
+
* Calculates the value based on a given string and multiplier.
|
|
46
53
|
*
|
|
47
|
-
* @
|
|
54
|
+
* @param {string} valueString - The string representing the value to be calculated.
|
|
55
|
+
* @param {number} multiplier - The multiplier to be applied to the calculated value.
|
|
56
|
+
* @return {number} The calculated value.
|
|
57
|
+
*/
|
|
58
|
+
export declare function calculateValue(valueString: string, multiplier: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Removes comments from the input string and extracts the content between the first opening parenthesis
|
|
61
|
+
* and the last closing parenthesis.
|
|
48
62
|
*
|
|
49
|
-
* @
|
|
63
|
+
* @param {string} string - The input string.
|
|
64
|
+
* @return {string} The content between the first opening parenthesis and the last closing parenthesis.
|
|
50
65
|
*/
|
|
51
|
-
export declare function
|
|
66
|
+
export declare function cleanDefinition(string: string): string;
|
|
52
67
|
/**
|
|
53
|
-
*
|
|
54
|
-
* If the color string matches one of these formats, the function returns an object with the type of color and the value of the color.
|
|
55
|
-
* If the color string does not match any of the formats, the function throws an error.
|
|
68
|
+
* Normalizes a percentage value by dividing it by 100 and multiplying it by a given multiplier.
|
|
56
69
|
*
|
|
57
|
-
* @param {string}
|
|
70
|
+
* @param {string} value - The percentage value to be normalized.
|
|
71
|
+
* @param {number} multiplier - The number to multiply the normalized percentage by.
|
|
72
|
+
* @return {number} The normalized percentage value.
|
|
73
|
+
*/
|
|
74
|
+
export declare function normalizePercentage(value: string, multiplier: number): number;
|
|
75
|
+
/**
|
|
76
|
+
* Calculates the color value fallbacks for a given value.
|
|
58
77
|
*
|
|
59
|
-
* @
|
|
78
|
+
* @param {string} value - The color value to calculate fallbacks for.
|
|
79
|
+
* @param {string} [err] - An optional error message to display.
|
|
80
|
+
* @return {number} - The calculated color value fallbacks.
|
|
60
81
|
*/
|
|
61
|
-
export declare function
|
|
82
|
+
export declare function colorValueFallbacks(value: string, err?: string): number;
|
|
83
|
+
/**
|
|
84
|
+
* Takes a string with a css value that could be a number or percentage or an angle in degrees and returns the corresponding 8bit value
|
|
85
|
+
*
|
|
86
|
+
* @param {string} value - a valid value for the css color definition (like 255, "100%", "324deg", etc.) *
|
|
87
|
+
* @param multiplier - the number that represent the maximum - default is 255 decimal - 100 hex
|
|
88
|
+
*
|
|
89
|
+
* @example convertToInt8('100%'); // 255
|
|
90
|
+
*
|
|
91
|
+
* @return {string} the corresponding value in 8-bit format
|
|
92
|
+
*/
|
|
93
|
+
export declare function convertToInt8(value: string, multiplier?: number): number;
|
|
@@ -6,6 +6,13 @@ import { COLORSTRING, HEX, RGBVALUE } from "./types";
|
|
|
6
6
|
* @return {string[]} 6 digit hex
|
|
7
7
|
*/
|
|
8
8
|
export declare function shortHexToLongHex(value: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a given string represents a hexadecimal number.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} num - The string to be checked.
|
|
13
|
+
* @return {boolean} Returns true if the string is a valid hexadecimal number, false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isHex(num: string): boolean;
|
|
9
16
|
/**
|
|
10
17
|
* Get the hex value of the color and convert it to an Object of R G And B values (still in hex format)
|
|
11
18
|
*
|
|
@@ -17,7 +24,7 @@ export declare function parseHex(value: COLORSTRING): string[];
|
|
|
17
24
|
/**
|
|
18
25
|
* Converts a Hex color to rgb
|
|
19
26
|
*
|
|
20
|
-
* @param {string} hex
|
|
27
|
+
* @param {string} hex a tuple of hex values
|
|
21
28
|
*
|
|
22
29
|
* @return {string} the rgb color values for the given hex color
|
|
23
30
|
*/
|
package/lib/@types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { COLORDEF, COLORSTRING, HEX, RGBCOLORDEF } from "./types";
|
|
1
|
+
import type { COLORDEF, COLORSTRING, HEX, RGBCOLORDEF, RGBVALUE } from "./types";
|
|
2
|
+
import { getColor } from "./color-utils";
|
|
2
3
|
/**
|
|
3
|
-
* Given a color string it returns the closest corresponding name of the color.
|
|
4
|
+
* Given a color string, it returns the closest corresponding name of the color.
|
|
4
5
|
* Uses the Euclidean distance formula to calculate the distance between colors in the RGB color space.
|
|
5
6
|
*
|
|
6
7
|
* @param {string} color - the color string you want to find the closest color name
|
|
@@ -38,16 +39,6 @@ declare function isLight(color: string): boolean;
|
|
|
38
39
|
* @example isDark('#333'); // true
|
|
39
40
|
*/
|
|
40
41
|
declare function isDark(color: string): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Given a color returns if the color is light or dark (by dark is meant more mathematically closer to black)
|
|
43
|
-
*
|
|
44
|
-
* @param {string} color - The color to check
|
|
45
|
-
*
|
|
46
|
-
* @returns {string} light when the color is close to white, dark otherwise
|
|
47
|
-
*
|
|
48
|
-
* @example isLightOrDark('#fff'); // 'light'
|
|
49
|
-
*/
|
|
50
|
-
declare function isLightOrDark(color: string): string;
|
|
51
42
|
/**
|
|
52
43
|
* Given a color returns if the color is closer to "red", "green" or "blue".
|
|
53
44
|
*
|
|
@@ -83,4 +74,14 @@ declare function distance(rgb1: [number, number, number], rgb2: [number, number,
|
|
|
83
74
|
* @example rgbToHex("rgba(100% 0 0 / .5)"); // #FF0000
|
|
84
75
|
*/
|
|
85
76
|
declare function rgbToHex(rgbString: string): HEX | Error;
|
|
86
|
-
|
|
77
|
+
/**
|
|
78
|
+
* This function takes a string representing a color (color) and uses regular expressions to check if it matches any of the following formats: hex, hex+alpha, RGB, RGBA, HSL, or HSLA.
|
|
79
|
+
* If the color string matches one of these formats, the function returns an object with the type of color and the value of the color.
|
|
80
|
+
* If the color string does not match any of the formats, the function throws an error.
|
|
81
|
+
*
|
|
82
|
+
* @param {string} colorString - the color string to test and convert to rgb values
|
|
83
|
+
*
|
|
84
|
+
* @return {Object|Error} the object with rgb values of that color
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseColor(colorString: string): RGBVALUE;
|
|
87
|
+
export { closest, rgbToHex, distance, isLight, isDark, closestRGB, getColor };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RGBVALUE } from "./types";
|
|
2
|
+
export declare function fallbackRGB(rgb: string[], err?: string): string[];
|
|
2
3
|
/**
|
|
3
4
|
* Get the values of the rgb string
|
|
4
5
|
*
|
|
@@ -22,4 +23,4 @@ export declare function getRgbValues(rgb: string[]): RGBVALUE;
|
|
|
22
23
|
*
|
|
23
24
|
* @return {string} a string representation of the rgb values
|
|
24
25
|
*/
|
|
25
|
-
export declare function
|
|
26
|
+
export declare function RGB(rgb: RGBVALUE): string;
|
package/lib/@types/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var v=Object.defineProperty;var S=(e,r)=>{for(var n in r)v(e,n,{get:r[n],enumerable:!0})};var M={};S(M,{closest:()=>h,closestRGB:()=>ee,distance:()=>V,getColor:()=>L,isDark:()=>Z,isLight:()=>Y,parseColor:()=>A,rgbToHex:()=>re});var N=[[255,255,255,"white"],[0,0,0,"black"],[255,0,0,"red"],[0,128,0,"green"],[0,0,255,"blue"],[255,165,0,"orange"],[128,128,128,"grey"],[255,255,0,"yellow"],[255,0,255,"magenta"],[154,205,50,"yellowgreen"],[192,192,192,"silver"],[0,255,0,"lime"],[128,0,128,"purple"],[255,99,71,"tomato"],[64,224,208,"turquoise"],[255,127,80,"coral"],[0,255,255,"cyan"],[255,250,240,"floralwhite"],[255,192,203,"pink"],[34,139,34,"forestgreen"],[245,245,220,"beige"],[255,0,255,"fuchsia"],[220,220,220,"gainsboro"],[248,248,255,"ghostwhite"],[255,215,0,"gold"],[218,165,32,"goldenrod"],[173,255,47,"greenyellow"],[238,130,238,"violet"],[245,222,179,"wheat"],[245,245,245,"whitesmoke"],[139,0,0,"darkred"],[240,248,255,"aliceblue"],[205,92,92,"indianred"],[75,0,130,"indigo"],[250,235,215,"antiquewhite"],[0,255,255,"aqua"],[127,255,212,"aquamarine"],[240,255,255,"azure"],[255,228,196,"bisque"],[255,235,205,"blanchedalmond"],[138,43,226,"blueviolet"],[165,42,42,"brown"],[222,184,135,"burlywood"],[95,158,160,"cadetblue"],[127,255,0,"chartreuse"],[210,105,30,"chocolate"],[100,149,237,"cornflowerblue"],[255,248,220,"cornsilk"],[220,20,60,"crimson"],[0,0,139,"darkblue"],[0,139,139,"darkcyan"],[184,134,11,"darkgoldenrod"],[169,169,169,"darkgrey"],[0,100,0,"darkgreen"],[189,183,107,"darkkhaki"],[139,0,139,"darkmagenta"],[85,107,47,"darkolivegreen"],[255,140,0,"darkorange"],[153,50,204,"darkorchid"],[233,150,122,"darksalmon"],[143,188,143,"darkseagreen"],[72,61,139,"darkslateblue"],[47,79,79,"darkslategrey"],[0,206,209,"darkturquoise"],[148,0,211,"darkviolet"],[255,20,147,"deeppink"],[0,191,255,"deepskyblue"],[105,105,105,"dimgrey"],[30,144,255,"dodgerblue"],[178,34,34,"firebrick"],[240,255,240,"honeydew"],[255,105,180,"hotpink"],[255,255,240,"ivory"],[240,230,140,"khaki"],[230,230,250,"lavender"],[255,240,245,"lavenderblush"],[124,252,0,"lawngreen"],[255,250,205,"lemonchiffon"],[173,216,230,"lightblue"],[240,128,128,"lightcoral"],[224,255,255,"lightcyan"],[250,250,210,"lightgoldenrodyellow"],[144,238,144,"lightgreen"],[211,211,211,"lightgrey"],[255,182,193,"lightpink"],[255,160,122,"lightsalmon"],[32,178,170,"lightseagreen"],[135,206,250,"lightskyblue"],[119,136,153,"lightslategrey"],[176,196,222,"lightsteelblue"],[255,255,224,"lightyellow"],[50,205,50,"limegreen"],[250,240,230,"linen"],[128,0,0,"maroon"],[102,205,170,"mediumaquamarine"],[0,0,205,"mediumblue"],[186,85,211,"mediumorchid"],[147,112,219,"mediumpurple"],[60,179,113,"mediumseagreen"],[123,104,238,"mediumslateblue"],[0,250,154,"mediumspringgreen"],[72,209,204,"mediumturquoise"],[199,21,133,"mediumvioletred"],[25,25,112,"midnightblue"],[245,255,250,"mintcream"],[255,228,225,"mistyrose"],[255,228,181,"moccasin"],[255,222,173,"navajowhite"],[0,0,128,"navy"],[253,245,230,"oldlace"],[128,128,0,"olive"],[107,142,35,"olivedrab"],[255,69,0,"orangered"],[218,112,214,"orchid"],[238,232,170,"palegoldenrod"],[152,251,152,"palegreen"],[175,238,238,"paleturquoise"],[219,112,147,"palevioletred"],[255,239,213,"papayawhip"],[255,218,185,"peachpuff"],[205,133,63,"peru"],[221,160,221,"plum"],[176,224,230,"powderblue"],[102,51,153,"rebeccapurple"],[188,143,143,"rosybrown"],[65,105,225,"royalblue"],[139,69,19,"saddlebrown"],[250,128,114,"salmon"],[244,164,96,"sandybrown"],[46,139,87,"seagreen"],[255,245,238,"seashell"],[160,82,45,"sienna"],[135,206,235,"skyblue"],[106,90,205,"slateblue"],[112,128,144,"slategrey"],[255,250,250,"snow"],[0,255,127,"springgreen"],[70,130,180,"steelblue"],[210,180,140,"tan"],[0,128,128,"teal"],[216,191,216,"thistle"]],f=N;var G=/^#([\da-f]{3,8})/i,x=/^rgba?\(([^)]+)\)/i,B=/^hsla?\(([^)]+)\)/i,U=/^-?\d*\.?\d+$/i,q=/(\/\*[^*]*\*\/)|(\/\/[^*]*)/g,R=[[255,255,255,"white"],[1,1,1,"black"]],C=[[255,0,0,"red"],[0,255,0,"green"],[0,0,255,"blue"]];function m(e){return e.split(e.includes(",")?",":" ").map(r=>r.trim())}function E(e){let r=parseFloat(e)||0;for(e.indexOf("deg")>-1?r=parseFloat(e.substring(0,e.length-3)):e.indexOf("rad")>-1?r=Math.round(parseFloat(e.substring(0,e.length-3))*(180/Math.PI)):e.indexOf("turn")>-1&&(r=Math.round(parseFloat(e.substring(0,e.length-4))*360));r<0;)r+=360;return r>=360&&(r%=360),r}function c(e,r=0,n=0){return Math.min(Math.max(Math.round(e),r),n)}function W(e,r){let n=/calc\(([^)]+)\)/,t=e.match(n);return t&&(e=t[1]),u(e,r)}function d(e){let r=e.replace(q,""),n=r.indexOf("("),t=r.lastIndexOf(")");return r.slice(n+1,t).trim()}function P(e,r){return parseFloat(e)/100*r}function g(e,r){return e==="infinity"?(console.warn(r||`Positive infinity value has been set to 255: ${e}`),255):(e==="currentColor"&&console.warn(r||`The "currentColor" value has been set to 0: ${e}`),e==="transparent"&&console.warn(r||`The "transparent" value has been set to 0: ${e}`),e==="NaN"&&console.warn(r||`"NaN" value has been set to 0: ${e}`),e==="-infinity"&&console.warn(r||`"Negative" infinity value has been set to 0: ${e}`),e==="none"&&console.warn(r||`The none keyword is invalid in legacy color syntax: ${e}`),0)}function u(e,r=255){return e=e?e?.trim():"0",U.test(e)?c(parseFloat(e)||0,0,r):e.endsWith("%")?P(e,r)||0:e.endsWith("deg")||e.endsWith("rad")||e.endsWith("turn")?E(e):e.startsWith("calc")?c(W(e,r),0,r):g(e,`Invalid value: ${e}`)}function w(e,r="Invalid RGB color"){return console.warn(r),[e[0]??0,e[1]??0,e[2]]}function O(e){let r=d(e),n=m(r);return n.length!==3&&n.length!==4?w(n,`Too few values to define rgb: ${e} -> ${r}`):[n[0],n[1],n[2]]}function k(e){return{r:c(Math.round(u(e[0])),0,255)||0,g:c(Math.round(u(e[1])),0,255)||0,b:c(Math.round(u(e[2])),0,255)||0}}function T(e){return`rgb(${e.r},${e.g},${e.b})`}function X(e){return Array.from(e).map(r=>(r+r).toUpperCase())}function z(e){return!!e.match(/^[0-9a-f]+$/i)}function H(e){let r=e.substring(1),n=[];return r&&(r.length===3||r.length===4?n=X(r):(r.length===6||r.length===8)&&(n=(r.match(/../g)||[]).map(t=>t))),n.length?(n?.forEach((t,o)=>{z(t)?n[o]=t.toUpperCase():console.warn(`Invalid Hex value: ${t}`)}),n):(console.warn(`Invalid Hex: ${e}`),w(n))}function $(e){return{r:parseInt(e[0],16),g:parseInt(e[1],16),b:parseInt(e[2],16)}}function y(e){return e.toString(16).padStart(2,"0")}function p(e){return`#${y(e?.r)}${y(e?.g)}${y(e?.b)}`}function j(e,r="Invalid HSL color"){return console.warn(r),[e[0]??0,e[1]??0,e[2]]}function D(e){let r=d(e),n=m(r);return n.length!==3&&n.length!==4&&(n=j(n)),[n[0],n[1],n[2]]}var K=e=>`Invalid angle: ${e} - The none keyword is invalid in legacy color syntax `;function _(e){return{h:g(e[0],K(e[0]))||Math.round(E(e[0]))||0,s:g(e[1])||u(e[1],100)||0,l:g(e[2])||u(e[2],100)||0}}function J(e,r,n){return n<60?[e,r,0]:n<120?[r,e,0]:n<180?[0,e,r]:n<240?[0,r,e]:n<300?[r,0,e]:[e,0,r]}function F(e){let r=_(e),n=r.s/100,t=r.l/100,o=(1-Math.abs(2*t-1))*n,s=o*(1-Math.abs(r.h/60%2-1)),i=t-o/2,[a,l,b]=J(o,s,r.h);return a=Math.round((a+i)*255),l=Math.round((l+i)*255),b=Math.round((b+i)*255),{r:a,g:l,b}}function I({r:e,g:r,b:n}){e/=255,r/=255,n/=255;let t=Math.min(e,r,n),o=Math.max(e,r,n),s=o-t,i=0,a=0,l=0;return s===0?i=0:o===e?i=(r-n)/s%6:o===r?i=(n-e)/s+2:i=(e-r)/s+4,i=Math.round(i*60),i<0&&(i+=360),l=(o+t)/2,a=s===0?0:s/(1-Math.abs(2*l-1)),a=+(a*100).toFixed(1),l=+(l*100).toFixed(1),Q({h:i,s:a,l})}function Q(e){return`hsl(${e.h},${e.s}%,${e.l}%)`}function L(e,r=f){let n=r.find(t=>t[3]===e);if(typeof n<"u"){let[t,o,s]=n;return{hex:p({r:t,g:o,b:s}),rgb:T({r:t,g:o,b:s}),hsl:I({r:t,g:o,b:s})}}throw new Error(`Error: invalid color ${e} or empty colorSet`)}function h(e,r=f,n){let t=Number.MAX_SAFE_INTEGER,o={name:"error",color:"#F00"};if(r.length<1)return o;let s=Object.values(A(e));for(let i of r){let a=V(s,i,!0);if(a<t&&(t=a,o.name=i[3],o.color=`rgb(${String(i[0])},${String(i[1])},${String(i[2])})`),a===0)break}return n?.info?{...L(o.name,r),...o,gap:Math.sqrt(t)}:o}function Y(e){return h(e,R).name==="white"}function Z(e){return h(e,R).name==="black"}function ee(e){return h(e,C).name}function V(e,r,n=!1){let[t,o,s]=[r[0]-e[0],r[1]-e[1],r[2]-e[2]],i=t*t+o*o+s*s;return n?i:Math.sqrt(i)}function re(e){if(x.test(e)){let r=O(e),n=k(r);return p(n)}throw new Error(`Invalid color: ${e}`)}function A(e){let r=[{regex:G,parser:H,converter:$},{regex:x,parser:O,converter:k},{regex:B,parser:D,converter:F}];for(let{regex:n,parser:t,converter:o}of r)if(n.test(e)){let s=t(e);return o(s)}throw new Error(`Invalid color: ${e}`)}})();
|
|
2
2
|
//# sourceMappingURL=color-2-name.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/data/colorSet.ts", "../../src/
|
|
4
|
-
"sourcesContent": ["const colorSet = [\n [255, 255, 255, \"white\"],\n [0, 0, 0, \"black\"],\n [255, 0, 0, \"red\"],\n [0, 128, 0, \"green\"],\n [0, 0, 255, \"blue\"],\n [255, 165, 0, \"orange\"],\n [128, 128, 128, \"grey\"],\n [255, 255, 0, \"yellow\"],\n [255, 0, 255, \"magenta\"],\n [154, 205, 50, \"yellowgreen\"],\n [192, 192, 192, \"silver\"],\n [0, 255, 0, \"lime\"],\n [128, 0, 128, \"purple\"],\n [255, 99, 71, \"tomato\"],\n [64, 224, 208, \"turquoise\"],\n [255, 127, 80, \"coral\"],\n [0, 255, 255, \"cyan\"],\n [255, 250, 240, \"floralwhite\"],\n [255, 192, 203, \"pink\"],\n [34, 139, 34, \"forestgreen\"],\n [245, 245, 220, \"beige\"],\n [255, 0, 255, \"fuchsia\"],\n [220, 220, 220, \"gainsboro\"],\n [248, 248, 255, \"ghostwhite\"],\n [255, 215, 0, \"gold\"],\n [218, 165, 32, \"goldenrod\"],\n [173, 255, 47, \"greenyellow\"],\n [238, 130, 238, \"violet\"],\n [245, 222, 179, \"wheat\"],\n [245, 245, 245, \"whitesmoke\"],\n [139, 0, 0, \"darkred\"],\n [240, 248, 255, \"aliceblue\"],\n [205, 92, 92, \"indianred\"],\n [75, 0, 130, \"indigo\"],\n [250, 235, 215, \"antiquewhite\"],\n [0, 255, 255, \"aqua\"],\n [127, 255, 212, \"aquamarine\"],\n [240, 255, 255, \"azure\"],\n [255, 228, 196, \"bisque\"],\n [255, 235, 205, \"blanchedalmond\"],\n [138, 43, 226, \"blueviolet\"],\n [165, 42, 42, \"brown\"],\n [222, 184, 135, \"burlywood\"],\n [95, 158, 160, \"cadetblue\"],\n [127, 255, 0, \"chartreuse\"],\n [210, 105, 30, \"chocolate\"],\n [100, 149, 237, \"cornflowerblue\"],\n [255, 248, 220, \"cornsilk\"],\n [220, 20, 60, \"crimson\"],\n [0, 0, 139, \"darkblue\"],\n [0, 139, 139, \"darkcyan\"],\n [184, 134, 11, \"darkgoldenrod\"],\n [169, 169, 169, \"darkgrey\"],\n [0, 100, 0, \"darkgreen\"],\n [189, 183, 107, \"darkkhaki\"],\n [139, 0, 139, \"darkmagenta\"],\n [85, 107, 47, \"darkolivegreen\"],\n [255, 140, 0, \"darkorange\"],\n [153, 50, 204, \"darkorchid\"],\n [233, 150, 122, \"darksalmon\"],\n [143, 188, 143, \"darkseagreen\"],\n [72, 61, 139, \"darkslateblue\"],\n [47, 79, 79, \"darkslategrey\"],\n [0, 206, 209, \"darkturquoise\"],\n [148, 0, 211, \"darkviolet\"],\n [255, 20, 147, \"deeppink\"],\n [0, 191, 255, \"deepskyblue\"],\n [105, 105, 105, \"dimgrey\"],\n [30, 144, 255, \"dodgerblue\"],\n [178, 34, 34, \"firebrick\"],\n [240, 255, 240, \"honeydew\"],\n [255, 105, 180, \"hotpink\"],\n [255, 255, 240, \"ivory\"],\n [240, 230, 140, \"khaki\"],\n [230, 230, 250, \"lavender\"],\n [255, 240, 245, \"lavenderblush\"],\n [124, 252, 0, \"lawngreen\"],\n [255, 250, 205, \"lemonchiffon\"],\n [173, 216, 230, \"lightblue\"],\n [240, 128, 128, \"lightcoral\"],\n [224, 255, 255, \"lightcyan\"],\n [250, 250, 210, \"lightgoldenrodyellow\"],\n [144, 238, 144, \"lightgreen\"],\n [211, 211, 211, \"lightgrey\"],\n [255, 182, 193, \"lightpink\"],\n [255, 160, 122, \"lightsalmon\"],\n [32, 178, 170, \"lightseagreen\"],\n [135, 206, 250, \"lightskyblue\"],\n [119, 136, 153, \"lightslategrey\"],\n [176, 196, 222, \"lightsteelblue\"],\n [255, 255, 224, \"lightyellow\"],\n [50, 205, 50, \"limegreen\"],\n [250, 240, 230, \"linen\"],\n [128, 0, 0, \"maroon\"],\n [102, 205, 170, \"mediumaquamarine\"],\n [0, 0, 205, \"mediumblue\"],\n [186, 85, 211, \"mediumorchid\"],\n [147, 112, 219, \"mediumpurple\"],\n [60, 179, 113, \"mediumseagreen\"],\n [123, 104, 238, \"mediumslateblue\"],\n [0, 250, 154, \"mediumspringgreen\"],\n [72, 209, 204, \"mediumturquoise\"],\n [199, 21, 133, \"mediumvioletred\"],\n [25, 25, 112, \"midnightblue\"],\n [245, 255, 250, \"mintcream\"],\n [255, 228, 225, \"mistyrose\"],\n [255, 228, 181, \"moccasin\"],\n [255, 222, 173, \"navajowhite\"],\n [0, 0, 128, \"navy\"],\n [253, 245, 230, \"oldlace\"],\n [128, 128, 0, \"olive\"],\n [107, 142, 35, \"olivedrab\"],\n [255, 69, 0, \"orangered\"],\n [218, 112, 214, \"orchid\"],\n [238, 232, 170, \"palegoldenrod\"],\n [152, 251, 152, \"palegreen\"],\n [175, 238, 238, \"paleturquoise\"],\n [219, 112, 147, \"palevioletred\"],\n [255, 239, 213, \"papayawhip\"],\n [255, 218, 185, \"peachpuff\"],\n [205, 133, 63, \"peru\"],\n [221, 160, 221, \"plum\"],\n [176, 224, 230, \"powderblue\"],\n [102, 51, 153, \"rebeccapurple\"],\n [188, 143, 143, \"rosybrown\"],\n [65, 105, 225, \"royalblue\"],\n [139, 69, 19, \"saddlebrown\"],\n [250, 128, 114, \"salmon\"],\n [244, 164, 96, \"sandybrown\"],\n [46, 139, 87, \"seagreen\"],\n [255, 245, 238, \"seashell\"],\n [160, 82, 45, \"sienna\"],\n [135, 206, 235, \"skyblue\"],\n [106, 90, 205, \"slateblue\"],\n [112, 128, 144, \"slategrey\"],\n [255, 250, 250, \"snow\"],\n [0, 255, 127, \"springgreen\"],\n [70, 130, 180, \"steelblue\"],\n [210, 180, 140, \"tan\"],\n [0, 128, 128, \"teal\"],\n [216, 191, 216, \"thistle\"],\n];\n\nexport default colorSet;\n", "import {COLORSTRING, HEX, RGBVALUE} from \"./types\";\n\n/**\n * It returns an object with the hex values of the 3 digit hex color\n *\n * @param {string} value 3 digit hex\n * @return {string[]} 6 digit hex\n */\nexport function shortHexToLongHex(value: string): string[] {\n // split the string in to an array of digits then return an array that contains that digit doubled for each item\n return Array.from(value).map((v: string) => (v + v).toUpperCase());\n}\n\n/**\n * Get the hex value of the color and convert it to an Object of R G And B values (still in hex format)\n *\n * @param value the string that contains the color in hex format\n *\n * @return {string[]} an array of 6 digit hex values in a triplet of R G and B (HEX format)\n */\nexport function parseHex(value: COLORSTRING): string[] {\n // remove # at the beginning of the hex color\n const hexColor: string = Array.from(value)[0] === \"#\" ? value.substring(1) : value;\n\n /**\n * then if the number of digits is greater than 2 (so it's something like 123 or abc456)\n * breakdown the string into an object that contains the r g and b values in hex\n */\n if (hexColor.length > 2) {\n if (hexColor.length < 6) {\n // >=6 is the long notation\n return shortHexToLongHex(hexColor);\n } else {\n const hex = hexColor.match(/../g);\n return hex != null ? [hex[0].toUpperCase(), hex[1].toUpperCase(), hex[2].toUpperCase()] : [];\n }\n }\n\n return [];\n}\n\n/**\n * Converts a Hex color to rgb\n *\n * @param {string} hex without the \"#\"\n *\n * @return {string} the rgb color values for the given hex color\n */\nexport function hexToRgb(hex: string[]): RGBVALUE {\n // Extract the RGB values from the hex string\n if (hex.length >= 2) {\n return {\n r: parseInt(hex[0], 16),\n g: parseInt(hex[1], 16),\n b: parseInt(hex[2], 16),\n };\n }\n throw new Error(`Invalid Hex color: ${hex.join(\", \")}`);\n}\n\n/**\n * Convert a INT8 value to HEX\n *\n * @param {number} int8 - the integer value to convert\n *\n * @return {string} the hex string\n */\nexport function toHex(int8: number): string {\n return int8.toString(16).padStart(2, \"0\");\n}\n\n/**\n * Convert rgb values to hex color\n *\n * @param {Object} rgb an object with the rgb values\n *\n * @return {string} the hex string\n */\nexport function valuesToHex(rgb: RGBVALUE): HEX {\n // Extract the RGB values from the hex string\n if (typeof rgb?.r === \"number\" && typeof rgb?.g === \"number\" && typeof rgb?.b === \"number\") {\n return `#${toHex(rgb?.r)}${toHex(rgb?.g)}${toHex(rgb?.b)}`;\n }\n return \"#errorr\";\n}\n", "import { convertToInt8, rgbRegex, splitValues } from \"./common\";\nimport { RGBVALUE } from \"./types\";\n\n/**\n * Get the values of the rgb string\n *\n * @param rgbAsString - the rgb color as string split into values\n *\n * @return {Array} the values of the rgb string as Array of strings that represent the rgb color\n */\nexport function parseRgb(rgbAsString: string): string[] {\n const rgbvalue = rgbAsString.match(rgbRegex);\n if (rgbvalue != null) {\n const rgb: string[] = splitValues(rgbvalue[1]);\n\n if (rgb.length >= 2) {\n return [rgb[0], rgb[1], rgb[2]];\n }\n }\n throw new Error(`Can't parse rgb color: ${rgbAsString}`);\n}\n\n/**\n * This function takes an array of strings and returns and object with the rgb values converted into INT8 (0-255)\n *\n * @param {Array} rgb - rgb color as Array of strings\n *\n * @return {Object} an object that contains the r, g and b values as INT8\n */\nexport function getRgbValues(rgb: string[]): RGBVALUE {\n if (rgb.length >= 2) {\n return {\n r: convertToInt8(rgb[0]),\n g: convertToInt8(rgb[1]),\n b: convertToInt8(rgb[2]),\n };\n }\n throw new Error(`Invalid rgb color: ${rgb.join(\", \")}`);\n}\n\n/**\n * returns a string representation of the rgb values\n *\n * @param {Object} rgb the rgb color object\n *\n * @return {string} a string representation of the rgb values\n */\nexport function valuesToRgb(rgb: RGBVALUE): string {\n return `rgb(${rgb.r},${rgb.g},${rgb.b})`;\n}\n", "import { hslRegex, normalizeDegree, splitValues } from \"./common\";\nimport { HSLVALUE, RGBVALUE } from \"./types\";\n\n/**\n * Get the values of the hsl string\n *\n * @param {string} hslAsString - the valid hsl color string\n * @return {string[]} the values of the hsl string\n */\nexport function parseHsl(hslAsString: string): string[] {\n const hslvalue = hslAsString.match(hslRegex);\n if (hslvalue != null) {\n const hsl: string[] = splitValues(hslvalue[1]);\n\n if (hsl.length >= 2) {\n return [hsl[0], hsl[1], hsl[2]];\n }\n }\n throw new Error(`Can't parse hsl color: ${hslAsString}`);\n}\n\n/**\n * This function takes an array of strings and returns and object with the hsl values converted into INT8 (0-255)\n *\n * @param {string[]} hsl - the hsl values to parse from string to int8 values\n *\n */\nexport function getHslValues(hsl: string[]): HSLVALUE {\n if (hsl.length >= 2) {\n return {\n h: normalizeDegree(hsl[0]),\n s: parseInt(hsl[1], 10),\n l: parseInt(hsl[2], 10),\n };\n }\n throw new Error(`Invalid hsl color: ${hsl.join(\", \")}`);\n}\n\n/**\n * Given the HSL color it convert the color into RGB\n *\n * @param {string[]} hslColor the HSL value to parse\n * @return {Object} rgb value\n */\nexport function hslToRgb(hslColor: string[]): RGBVALUE {\n if (hslColor === null || hslColor.length < 2) {\n throw new Error(`Invalid hsl color: ${hslColor.join(\", \")}`);\n }\n\n const hsl = getHslValues(hslColor);\n\n // Must be fractions of 1\n hsl.s /= 100;\n hsl.l /= 100;\n\n const c = (1 - Math.abs(2 * hsl.l - 1)) * hsl.s;\n const x = c * (1 - Math.abs(((hsl.h / 60) % 2) - 1));\n const m = hsl.l - c / 2;\n let r = 0;\n let g = 0;\n let b = 0;\n\n if (hsl.h >= 0 && hsl.h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (hsl.h >= 60 && hsl.h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (hsl.h >= 120 && hsl.h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (hsl.h >= 180 && hsl.h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (hsl.h >= 240 && hsl.h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (hsl.h >= 300 && hsl.h < 360) {\n r = c;\n g = 0;\n b = x;\n }\n r = Math.round((r + m) * 255);\n g = Math.round((g + m) * 255);\n b = Math.round((b + m) * 255);\n\n return { r, g, b };\n}\n\n/**\n * Given the RGB color it convert the color into HSL\n *\n * @param {number} r - red\n * @param {number} g - green\n * @param {number} b - blue\n *\n * @return {Object} hsl value\n */\nexport function valuesToHsl({ r, g, b }: RGBVALUE): string {\n // Make r, g, and b fractions of 1\n r /= 255;\n g /= 255;\n b /= 255;\n\n // Find greatest and smallest channel values\n const cmin = Math.min(r, g, b);\n const cmax = Math.max(r, g, b);\n const delta = cmax - cmin;\n let h = 0;\n let s = 0;\n let l = 0;\n\n // Calculate hue\n if (delta === 0) {\n // No difference\n h = 0;\n } else if (cmax === r) {\n // Red is max\n h = ((g - b) / delta) % 6;\n } else if (cmax === g) {\n // Green is max\n h = (b - r) / delta + 2;\n } else {\n h = (r - g) / delta + 4;\n } // Blue is max\n\n h = Math.round(h * 60);\n\n // Make negative hues positive behind 360\u00B0\n if (h < 0) {\n h += 360;\n }\n\n // Calculate lightness\n l = (cmax + cmin) / 2;\n\n // Calculate saturation\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n\n // Multiply l and s by 100\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n\n return `hsl(${h},${s}%,${l}%)`;\n}\n", "// Regular expressions to match different color formats\nimport { COLORSTRING, RGBCOLORDEF, RGBVALUE } from \"./types\";\nimport { hexToRgb, parseHex } from \"./hex-utils\";\nimport { getRgbValues, parseRgb } from \"./rgb-utils\";\nimport { hslToRgb, parseHsl } from \"./hsl-utils\";\n\n/** The maximum distance possible between colors */\nexport const MAXDISTANCE = 441.6729559300637;\n\n/** A regex to match hex colors */\nexport const hexRegex: RegExp = /^#([\\da-f]{6,}|[\\da-f]{3,})/i;\n/** A regex to match rgb colors */\nexport const rgbRegex: RegExp = /^rgba?\\(([^)]+)\\)/i;\n/** A regex to match hsl colors */\nexport const hslRegex: RegExp = /^hsla?\\(([^)]+)\\)/i;\n/** A regex to match strings that are only int numbers */\nexport const isNumeric: RegExp = /^[0-9]*$/;\n\n/**\n * This set is used in order to detect if the color is bright or dark\n *\n * @note the set has been corrected to get pure RGB values (eg. pure red, pure green) in the \"bright\" area\n */\nexport const BLACKANDWHITE: RGBCOLORDEF[] = [\n [255, 255, 255, \"white\"],\n [1, 1, 1, \"black\"],\n];\n\n/**\n * This set is used in order to detect the nearest rgb color\n */\nexport const RGBSET: RGBCOLORDEF[] = [\n [255, 0, 0, \"red\"],\n [0, 255, 0, \"green\"],\n [0, 0, 255, \"blue\"],\n];\n\n/**\n * split the content of rgb and hsl colors depending on the parsed value of the css property\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#syntax\n *\n * @param {string} rawValues - the value inside the rgb(.*) css color definition\n *\n * @return {Array} the array of rgb values finded inside the passed string\n */\nexport function splitValues(rawValues: string): string[] {\n if (rawValues.includes(\",\")) {\n return rawValues.split(/[,\\\\/]/).map((val) => val.trim());\n }\n\n return rawValues\n .split(/[ \\\\/]/)\n .map((val) => val.trim())\n .filter(Boolean);\n}\n\n/**\n * If the value is an angle in degrees, convert it to the 0-360 range\n *\n * @param {string} value - the degrees to convert into a number\n * @param {number} multiplier - the number that represent the maximum - default is 100\n *\n * @return {number} the converted value\n */\nexport function normalizeDegree(value: string, multiplier: number = 360): number {\n let angle = parseFloat(value);\n while (angle < 0) {\n angle += 360;\n }\n while (angle > 360) {\n angle -= 360;\n }\n return (angle / 360) * multiplier;\n}\n\n/**\n * Takes a string with a css value that could be a number or percentage or an angle in degrees and returns the corresponding 8bit value\n *\n * @param {string} value - a valid value for the css color definition (like 255, \"100%\", \"324deg\", etc)\n * @param {string} value - a valid value for the css color definition (like 255, \"100%\", \"324deg\", etc)\n *\n * @example convertToInt8('100%'); // 255\n *\n * @return {string} the corresponding value in 8 bit format\n */\nexport function convertToInt8(value: string, multiplier: number = 255): number {\n value = value.trim();\n if (isNumeric.test(value)) {\n // If the value is an int number return it as number\n return parseInt(value, 10);\n } else if (value.endsWith(\"%\")) {\n // If the value is a percentage, divide it by 100 to get a value from 0 to 1\n // and then multiply it by 255 to get a value from 0 to 255\n return (parseFloat(value) / 100) * multiplier;\n } else if (value.endsWith(\"deg\")) {\n return normalizeDegree(value, 255);\n } else {\n // If the value is not a percentage or an angle in degrees, it is invalid\n throw new Error(`Invalid value: ${value}`);\n }\n}\n\n/**\n * This function takes a string representing a color (color) and uses regular expressions to check if it matches any of the following formats: hex, hex+alpha, RGB, RGBA, HSL, or HSLA.\n * If the color string matches one of these formats, the function returns an object with the type of color and the value of the color.\n * If the color string does not match any of the formats, the function throws an error.\n *\n * @param {string} colorString - the color string to test and convert to rgb values\n *\n * @return {Object|Error} the object with rgb values of that color\n */\nexport function parseColor(colorString: string): RGBVALUE {\n // Check if the color string matches any of the regular expressions\n const colorParsers = [\n { regex: hexRegex, parser: parseHex, converter: hexToRgb },\n { regex: rgbRegex, parser: parseRgb, converter: getRgbValues },\n { regex: hslRegex, parser: parseHsl, converter: hslToRgb },\n ];\n for (const { regex, parser, converter } of colorParsers) {\n if (regex.test(colorString)) {\n const result = parser(colorString as COLORSTRING);\n if (result.length > 0) {\n return converter(result);\n }\n }\n }\n\n // If the color string does not match any of the regular expressions, return an error\n throw new Error(`Invalid color: ${colorString}`);\n}\n", "import colorSet from \"./data/colorSet\";\nimport { BLACKANDWHITE, parseColor, rgbRegex, RGBSET } from \"./common\";\nimport { valuesToHex } from \"./hex-utils\";\nimport { getRgbValues, parseRgb } from \"./rgb-utils\";\nimport { valuesToHsl } from \"./hsl-utils\";\nimport { COLORDEF, COLORSTRING, HEX, RGBCOLORDEF, RGBDEF, RGBVALUE } from \"./types\";\n\n/**\n * Given a color string it returns the closest corresponding name of the color.\n * Uses the Euclidean distance formula to calculate the distance between colors in the RGB color space.\n *\n * @param {string} color - the color string you want to find the closest color name\n * @param {Object} set - the color set that will be used to find the closest color\n * @param {Object} args - Set a non nullish value to return some additional information (like the distance between the colors, or the hex color value)\n * @param args.info - Set a non nullish value to return some additional information (like the distance between the colors, or the hex color value) about the closest color.\n *\n * @return {Object} the closest color name and rgb value\n *\n * @example // Returns the closest color name and rgb value given a css color string\n * closest('#f00'); // { name: 'red', color: 'rgb(255,0,0)' }\n *\n * closest('#f00', undefined, {info:true}); // { name: 'red', color: 'rgb(255,0,0)', hex: '#ff0000', hsl: 'hsl(0, 100%, 50%)', distance: 0 ) }\n */\nfunction closest(color: string | COLORSTRING, set: RGBCOLORDEF[] | undefined = colorSet as RGBCOLORDEF[], args?: { info?: boolean }): COLORDEF {\n let closestGap = Number.MAX_SAFE_INTEGER;\n const closestColor: COLORDEF = { name: \"error\", color: \"#F00\" };\n\n if (set.length < 1) {\n return closestColor;\n }\n\n const rgbColorValues = Object.values(parseColor(color));\n if (rgbColorValues.length > 2) {\n for (const tested of set) {\n const gap = distance(rgbColorValues as RGBDEF, tested, true);\n if (gap < closestGap) {\n closestGap = gap;\n closestColor.name = tested[3];\n closestColor.color = `rgb(${String(tested[0])},${String(tested[1])},${String(tested[2])})`;\n }\n\n // TODO: add a minimum acceptable value in order to speed up the calculation. for example #ff0001 should return red since is very very close to red\n if (gap === 0) {\n break;\n }\n }\n }\n\n if (args?.info) {\n const rgbValue = parseColor(closestColor.color);\n const hexValue = valuesToHex(rgbValue as RGBVALUE);\n const hslValue = valuesToHsl(rgbValue as RGBVALUE);\n return {\n ...closestColor,\n hex: hexValue,\n hsl: hslValue,\n gap: Math.sqrt(closestGap),\n };\n }\n\n return closestColor;\n}\n\n/**\n * Given a color returns if the color is light (by light is meant more mathematically closer to white)\n *\n * @param {string} color - The color to check\n *\n * @returns {boolean} true when the color is light, false otherwise\n *\n * @example isLight('#ddd'); // true\n */\nfunction isLight(color: string): boolean {\n return closest(color, BLACKANDWHITE).name === \"white\";\n}\n\n/**\n * Given a color returns if the color is dark (by dark is meant more mathematically closer to black)\n *\n * @param {string} color - The color to check\n *\n * @returns {boolean} true when the color is dark, false otherwise\n *\n * @example isDark('#333'); // true\n */\nfunction isDark(color: string): boolean {\n return closest(color, BLACKANDWHITE).name === \"black\";\n}\n\n/**\n * Given a color returns if the color is light or dark (by dark is meant more mathematically closer to black)\n *\n * @param {string} color - The color to check\n *\n * @returns {string} light when the color is close to white, dark otherwise\n *\n * @example isLightOrDark('#fff'); // 'light'\n */\nfunction isLightOrDark(color: string): string {\n return isLight(color) ? \"light\" : \"dark\";\n}\n\n/**\n * Given a color returns if the color is closer to \"red\", \"green\" or \"blue\".\n *\n * @param {string} color - The color to check\n *\n * @returns {string} light when the color is close to white, dark otherwise\n *\n * @example closestRGB('#f00'); // 'red'\n */\nfunction closestRGB(color: string): string {\n return closest(color, RGBSET).name;\n}\n\n/**\n * Compute the distance between the two RGB values\n * There are two modes:\n * fast = true -> the distance is calculated without using the Euclidean formula completely, it is reliable but its result is exponential\n * fast = false -> the distance is calculated with the Euclidean formula, its result is linear\n *\n * @param rgb1 - The RGB value of the first color to compare\n * @param rgb2 - The RGB value of the second color to compare\n * @param fast - If you want to calculate the distance without calculating the square root, the result will be exponential otherwise is linear\n *\n * @return {number} the distance between the two RGB values\n *\n * @example distance([10, 20, 30], [120, 120, 120]); // 173.78147196982766\n */\nfunction distance(rgb1: [number, number, number], rgb2: [number, number, number, string] | number[], fast: boolean = false): number {\n const [rDiff, gDiff, bDiff] = [rgb2[0] - rgb1[0], rgb2[1] - rgb1[1], rgb2[2] - rgb1[2]];\n const dist = rDiff * rDiff + gDiff * gDiff + bDiff * bDiff;\n return fast ? dist : Math.sqrt(dist);\n}\n\n/**\n * Given a color string it returns the hex representation\n *\n * @param rgbString - the rgb color string to convert to hex\n *\n * @return {string} the corresponding color hex\n *\n * @example rgbToHex(\"rgba(100% 0 0 / .5)\"); // #FF0000\n */\nfunction rgbToHex(rgbString: string): HEX | Error {\n // if is a rgb string\n if (rgbRegex.test(rgbString)) {\n const rgb = parseRgb(rgbString);\n if (rgb.length > 0) {\n const RgbValues = getRgbValues(rgb);\n return valuesToHex(RgbValues);\n }\n }\n throw new Error(`Invalid color: ${rgbString}`);\n}\n\nexport { closest, rgbToHex, distance, isLight, isDark, isLightOrDark, closestRGB };\n"],
|
|
5
|
-
"mappings": "mBAAA,IAAMA,EAAW,CACf,CAAC,IAAK,IAAK,IAAK,OAAO,EACvB,CAAC,EAAG,EAAG,EAAG,OAAO,EACjB,CAAC,IAAK,EAAG,EAAG,KAAK,EACjB,CAAC,EAAG,IAAK,EAAG,OAAO,EACnB,CAAC,EAAG,EAAG,IAAK,MAAM,EAClB,CAAC,IAAK,IAAK,EAAG,QAAQ,EACtB,CAAC,IAAK,IAAK,IAAK,MAAM,EACtB,CAAC,IAAK,IAAK,EAAG,QAAQ,EACtB,CAAC,IAAK,EAAG,IAAK,SAAS,EACvB,CAAC,IAAK,IAAK,GAAI,aAAa,EAC5B,CAAC,IAAK,IAAK,IAAK,QAAQ,EACxB,CAAC,EAAG,IAAK,EAAG,MAAM,EAClB,CAAC,IAAK,EAAG,IAAK,QAAQ,EACtB,CAAC,IAAK,GAAI,GAAI,QAAQ,EACtB,CAAC,GAAI,IAAK,IAAK,WAAW,EAC1B,CAAC,IAAK,IAAK,GAAI,OAAO,EACtB,CAAC,EAAG,IAAK,IAAK,MAAM,EACpB,CAAC,IAAK,IAAK,IAAK,aAAa,EAC7B,CAAC,IAAK,IAAK,IAAK,MAAM,EACtB,CAAC,GAAI,IAAK,GAAI,aAAa,EAC3B,CAAC,IAAK,IAAK,IAAK,OAAO,EACvB,CAAC,IAAK,EAAG,IAAK,SAAS,EACvB,CAAC,IAAK,IAAK,IAAK,WAAW,EAC3B,CAAC,IAAK,IAAK,IAAK,YAAY,EAC5B,CAAC,IAAK,IAAK,EAAG,MAAM,EACpB,CAAC,IAAK,IAAK,GAAI,WAAW,EAC1B,CAAC,IAAK,IAAK,GAAI,aAAa,EAC5B,CAAC,IAAK,IAAK,IAAK,QAAQ,EACxB,CAAC,I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,OAAOH,EAAOI,EAAO,KAAK,KAAKA,CAAI,CACrC,CAWA,SAASC,EAASC,EAAgC,CAEhD,GAAIC,EAAS,KAAKD,CAAS,EAAG,CAC5B,IAAME,EAAMC,EAASH,CAAS,EAC9B,GAAIE,EAAI,OAAS,EAAG,CAClB,IAAME,EAAYC,EAAaH,CAAG,EAClC,OAAOnB,EAAYqB,CAAS,CAC9B,CACF,CACA,MAAM,IAAI,MAAM,kBAAkBJ,CAAS,EAAE,CAC/C",
|
|
6
|
-
"names": ["colorSet", "colorSet_default", "
|
|
3
|
+
"sources": ["../../src/index.ts", "../../src/data/colorSet.ts", "../../src/common.ts", "../../src/rgb-utils.ts", "../../src/hex-utils.ts", "../../src/hsl-utils.ts", "../../src/color-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import colorSet from \"./data/colorSet\";\nimport { BLACKANDWHITE, hexRegex, hslRegex, rgbRegex, RGBSET } from \"./common\";\nimport { hexToRgb, parseHex, valuesToHex } from \"./hex-utils\";\nimport { getRgbValues, parseRgb } from \"./rgb-utils\";\nimport { hslToRgb, parseHsl } from \"./hsl-utils\";\nimport type { COLORDEF, COLORSTRING, HEX, RGBCOLORDEF, RGBDEF, RGBVALUE } from \"./types\";\nimport { getColor } from \"./color-utils\";\n\n/**\n * Given a color string, it returns the closest corresponding name of the color.\n * Uses the Euclidean distance formula to calculate the distance between colors in the RGB color space.\n *\n * @param {string} color - the color string you want to find the closest color name\n * @param {Object} set - the color set that will be used to find the closest color\n * @param {Object} args - Set a non nullish value to return some additional information (like the distance between the colors, or the hex color value)\n * @param args.info - Set a non nullish value to return some additional information (like the distance between the colors, or the hex color value) about the closest color.\n *\n * @return {Object} the closest color name and rgb value\n *\n * @example // Returns the closest color name and rgb value given a css color string\n * closest('#f00'); // { name: 'red', color: 'rgb(255,0,0)' }\n *\n * closest('#f00', undefined, {info:true}); // { name: 'red', color: 'rgb(255,0,0)', hex: '#ff0000', hsl: 'hsl(0, 100%, 50%)', distance: 0 ) }\n */\nfunction closest(color: string | COLORSTRING, set: RGBCOLORDEF[] | undefined = colorSet as RGBCOLORDEF[], args?: { info?: boolean }): COLORDEF {\n let closestGap = Number.MAX_SAFE_INTEGER;\n const closestColor: COLORDEF = { name: \"error\", color: \"#F00\" };\n\n if (set.length < 1) {\n return closestColor;\n }\n\n const rgbColorValues = Object.values(parseColor(color));\n // Find the closest color in the color set\n for (const tested of set) {\n const gap = distance(rgbColorValues as RGBDEF, tested, true);\n if (gap < closestGap) {\n closestGap = gap;\n closestColor.name = tested[3];\n closestColor.color = `rgb(${String(tested[0])},${String(tested[1])},${String(tested[2])})`;\n }\n\n // TODO: add a minimum acceptable value in order to speed up the calculation. for example #ff0001 should return red since is very very close to red\n if (gap === 0) {\n break;\n }\n }\n\n if (args?.info) {\n const colorValue = getColor(closestColor.name, set);\n return {\n ...colorValue,\n ...closestColor,\n gap: Math.sqrt(closestGap),\n };\n }\n\n return closestColor;\n}\n\n/**\n * Given a color returns if the color is light (by light is meant more mathematically closer to white)\n *\n * @param {string} color - The color to check\n *\n * @returns {boolean} true when the color is light, false otherwise\n *\n * @example isLight('#ddd'); // true\n */\nfunction isLight(color: string): boolean {\n return closest(color, BLACKANDWHITE).name === \"white\";\n}\n\n/**\n * Given a color returns if the color is dark (by dark is meant more mathematically closer to black)\n *\n * @param {string} color - The color to check\n *\n * @returns {boolean} true when the color is dark, false otherwise\n *\n * @example isDark('#333'); // true\n */\nfunction isDark(color: string): boolean {\n return closest(color, BLACKANDWHITE).name === \"black\";\n}\n\n/**\n * Given a color returns if the color is closer to \"red\", \"green\" or \"blue\".\n *\n * @param {string} color - The color to check\n *\n * @returns {string} light when the color is close to white, dark otherwise\n *\n * @example closestRGB('#f00'); // 'red'\n */\nfunction closestRGB(color: string): string {\n return closest(color, RGBSET).name;\n}\n\n/**\n * Compute the distance between the two RGB values\n * There are two modes:\n * fast = true -> the distance is calculated without using the Euclidean formula completely, it is reliable but its result is exponential\n * fast = false -> the distance is calculated with the Euclidean formula, its result is linear\n *\n * @param rgb1 - The RGB value of the first color to compare\n * @param rgb2 - The RGB value of the second color to compare\n * @param fast - If you want to calculate the distance without calculating the square root, the result will be exponential otherwise is linear\n *\n * @return {number} the distance between the two RGB values\n *\n * @example distance([10, 20, 30], [120, 120, 120]); // 173.78147196982766\n */\nfunction distance(rgb1: [number, number, number], rgb2: [number, number, number, string] | number[], fast: boolean = false): number {\n const [rDiff, gDiff, bDiff] = [rgb2[0] - rgb1[0], rgb2[1] - rgb1[1], rgb2[2] - rgb1[2]];\n const dist = rDiff * rDiff + gDiff * gDiff + bDiff * bDiff;\n return fast ? dist : Math.sqrt(dist);\n}\n\n/**\n * Given a color string it returns the hex representation\n *\n * @param rgbString - the rgb color string to convert to hex\n *\n * @return {string} the corresponding color hex\n *\n * @example rgbToHex(\"rgba(100% 0 0 / .5)\"); // #FF0000\n */\nfunction rgbToHex(rgbString: string): HEX | Error {\n // if is a rgb string\n if (rgbRegex.test(rgbString)) {\n const rgb = parseRgb(rgbString);\n const RgbValues = getRgbValues(rgb);\n return valuesToHex(RgbValues);\n }\n throw new Error(`Invalid color: ${rgbString}`);\n}\n\n/**\n * This function takes a string representing a color (color) and uses regular expressions to check if it matches any of the following formats: hex, hex+alpha, RGB, RGBA, HSL, or HSLA.\n * If the color string matches one of these formats, the function returns an object with the type of color and the value of the color.\n * If the color string does not match any of the formats, the function throws an error.\n *\n * @param {string} colorString - the color string to test and convert to rgb values\n *\n * @return {Object|Error} the object with rgb values of that color\n */\nexport function parseColor(colorString: string): RGBVALUE {\n // Check if the color string matches any of the regular expressions\n const colorParsers = [\n { regex: hexRegex, parser: parseHex, converter: hexToRgb },\n { regex: rgbRegex, parser: parseRgb, converter: getRgbValues },\n { regex: hslRegex, parser: parseHsl, converter: hslToRgb },\n ];\n for (const { regex, parser, converter } of colorParsers) {\n if (regex.test(colorString)) {\n const result = parser(colorString as COLORSTRING);\n return converter(result);\n }\n }\n\n // If the color string does not match any of the regular expressions, return an error\n throw new Error(`Invalid color: ${colorString}`);\n}\n\nexport { closest, rgbToHex, distance, isLight, isDark, closestRGB, getColor };\n", "const colorSet = [\n [255, 255, 255, \"white\"],\n [0, 0, 0, \"black\"],\n [255, 0, 0, \"red\"],\n [0, 128, 0, \"green\"],\n [0, 0, 255, \"blue\"],\n [255, 165, 0, \"orange\"],\n [128, 128, 128, \"grey\"],\n [255, 255, 0, \"yellow\"],\n [255, 0, 255, \"magenta\"],\n [154, 205, 50, \"yellowgreen\"],\n [192, 192, 192, \"silver\"],\n [0, 255, 0, \"lime\"],\n [128, 0, 128, \"purple\"],\n [255, 99, 71, \"tomato\"],\n [64, 224, 208, \"turquoise\"],\n [255, 127, 80, \"coral\"],\n [0, 255, 255, \"cyan\"],\n [255, 250, 240, \"floralwhite\"],\n [255, 192, 203, \"pink\"],\n [34, 139, 34, \"forestgreen\"],\n [245, 245, 220, \"beige\"],\n [255, 0, 255, \"fuchsia\"],\n [220, 220, 220, \"gainsboro\"],\n [248, 248, 255, \"ghostwhite\"],\n [255, 215, 0, \"gold\"],\n [218, 165, 32, \"goldenrod\"],\n [173, 255, 47, \"greenyellow\"],\n [238, 130, 238, \"violet\"],\n [245, 222, 179, \"wheat\"],\n [245, 245, 245, \"whitesmoke\"],\n [139, 0, 0, \"darkred\"],\n [240, 248, 255, \"aliceblue\"],\n [205, 92, 92, \"indianred\"],\n [75, 0, 130, \"indigo\"],\n [250, 235, 215, \"antiquewhite\"],\n [0, 255, 255, \"aqua\"],\n [127, 255, 212, \"aquamarine\"],\n [240, 255, 255, \"azure\"],\n [255, 228, 196, \"bisque\"],\n [255, 235, 205, \"blanchedalmond\"],\n [138, 43, 226, \"blueviolet\"],\n [165, 42, 42, \"brown\"],\n [222, 184, 135, \"burlywood\"],\n [95, 158, 160, \"cadetblue\"],\n [127, 255, 0, \"chartreuse\"],\n [210, 105, 30, \"chocolate\"],\n [100, 149, 237, \"cornflowerblue\"],\n [255, 248, 220, \"cornsilk\"],\n [220, 20, 60, \"crimson\"],\n [0, 0, 139, \"darkblue\"],\n [0, 139, 139, \"darkcyan\"],\n [184, 134, 11, \"darkgoldenrod\"],\n [169, 169, 169, \"darkgrey\"],\n [0, 100, 0, \"darkgreen\"],\n [189, 183, 107, \"darkkhaki\"],\n [139, 0, 139, \"darkmagenta\"],\n [85, 107, 47, \"darkolivegreen\"],\n [255, 140, 0, \"darkorange\"],\n [153, 50, 204, \"darkorchid\"],\n [233, 150, 122, \"darksalmon\"],\n [143, 188, 143, \"darkseagreen\"],\n [72, 61, 139, \"darkslateblue\"],\n [47, 79, 79, \"darkslategrey\"],\n [0, 206, 209, \"darkturquoise\"],\n [148, 0, 211, \"darkviolet\"],\n [255, 20, 147, \"deeppink\"],\n [0, 191, 255, \"deepskyblue\"],\n [105, 105, 105, \"dimgrey\"],\n [30, 144, 255, \"dodgerblue\"],\n [178, 34, 34, \"firebrick\"],\n [240, 255, 240, \"honeydew\"],\n [255, 105, 180, \"hotpink\"],\n [255, 255, 240, \"ivory\"],\n [240, 230, 140, \"khaki\"],\n [230, 230, 250, \"lavender\"],\n [255, 240, 245, \"lavenderblush\"],\n [124, 252, 0, \"lawngreen\"],\n [255, 250, 205, \"lemonchiffon\"],\n [173, 216, 230, \"lightblue\"],\n [240, 128, 128, \"lightcoral\"],\n [224, 255, 255, \"lightcyan\"],\n [250, 250, 210, \"lightgoldenrodyellow\"],\n [144, 238, 144, \"lightgreen\"],\n [211, 211, 211, \"lightgrey\"],\n [255, 182, 193, \"lightpink\"],\n [255, 160, 122, \"lightsalmon\"],\n [32, 178, 170, \"lightseagreen\"],\n [135, 206, 250, \"lightskyblue\"],\n [119, 136, 153, \"lightslategrey\"],\n [176, 196, 222, \"lightsteelblue\"],\n [255, 255, 224, \"lightyellow\"],\n [50, 205, 50, \"limegreen\"],\n [250, 240, 230, \"linen\"],\n [128, 0, 0, \"maroon\"],\n [102, 205, 170, \"mediumaquamarine\"],\n [0, 0, 205, \"mediumblue\"],\n [186, 85, 211, \"mediumorchid\"],\n [147, 112, 219, \"mediumpurple\"],\n [60, 179, 113, \"mediumseagreen\"],\n [123, 104, 238, \"mediumslateblue\"],\n [0, 250, 154, \"mediumspringgreen\"],\n [72, 209, 204, \"mediumturquoise\"],\n [199, 21, 133, \"mediumvioletred\"],\n [25, 25, 112, \"midnightblue\"],\n [245, 255, 250, \"mintcream\"],\n [255, 228, 225, \"mistyrose\"],\n [255, 228, 181, \"moccasin\"],\n [255, 222, 173, \"navajowhite\"],\n [0, 0, 128, \"navy\"],\n [253, 245, 230, \"oldlace\"],\n [128, 128, 0, \"olive\"],\n [107, 142, 35, \"olivedrab\"],\n [255, 69, 0, \"orangered\"],\n [218, 112, 214, \"orchid\"],\n [238, 232, 170, \"palegoldenrod\"],\n [152, 251, 152, \"palegreen\"],\n [175, 238, 238, \"paleturquoise\"],\n [219, 112, 147, \"palevioletred\"],\n [255, 239, 213, \"papayawhip\"],\n [255, 218, 185, \"peachpuff\"],\n [205, 133, 63, \"peru\"],\n [221, 160, 221, \"plum\"],\n [176, 224, 230, \"powderblue\"],\n [102, 51, 153, \"rebeccapurple\"],\n [188, 143, 143, \"rosybrown\"],\n [65, 105, 225, \"royalblue\"],\n [139, 69, 19, \"saddlebrown\"],\n [250, 128, 114, \"salmon\"],\n [244, 164, 96, \"sandybrown\"],\n [46, 139, 87, \"seagreen\"],\n [255, 245, 238, \"seashell\"],\n [160, 82, 45, \"sienna\"],\n [135, 206, 235, \"skyblue\"],\n [106, 90, 205, \"slateblue\"],\n [112, 128, 144, \"slategrey\"],\n [255, 250, 250, \"snow\"],\n [0, 255, 127, \"springgreen\"],\n [70, 130, 180, \"steelblue\"],\n [210, 180, 140, \"tan\"],\n [0, 128, 128, \"teal\"],\n [216, 191, 216, \"thistle\"],\n];\n\nexport default colorSet;\n", "// Regular expressions to match different color formats\nimport { RGBCOLORDEF } from \"./types\";\n\n/** The maximum distance possible between colors */\nexport const MAXDISTANCE = 441.6729559300637;\n\n/** A regex to match hex colors */\nexport const hexRegex: RegExp = /^#([\\da-f]{3,8})/i;\n/** A regex to match rgb colors */\nexport const rgbRegex: RegExp = /^rgba?\\(([^)]+)\\)/i;\n/** A regex to match hsl colors */\nexport const hslRegex: RegExp = /^hsla?\\(([^)]+)\\)/i;\n/** A regex to match strings that are only valid numbers with and without decimals and the number can be negative and without the 0 in the beginning */\nexport const isNumeric: RegExp = /^-?\\d*\\.?\\d+$/i;\n/** Remove comments from string */\nexport const stripComments: RegExp = /(\\/\\*[^*]*\\*\\/)|(\\/\\/[^*]*)/g;\n\n/**\n * This set is used to detect if the color is bright or dark\n *\n * @note the set has been corrected to get pure RGB values (eg. pure red, pure green) in the \"bright\" area\n */\nexport const BLACKANDWHITE: RGBCOLORDEF[] = [\n [255, 255, 255, \"white\"],\n [1, 1, 1, \"black\"],\n];\n\n/**\n * This set is used to detect the nearest rgb color\n */\nexport const RGBSET: RGBCOLORDEF[] = [\n [255, 0, 0, \"red\"],\n [0, 255, 0, \"green\"],\n [0, 0, 255, \"blue\"],\n];\n\n/**\n * split the content of rgb and hsl colors depending on the parsed value of the css property\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#syntax\n *\n * @param {string} rawValues - the value inside the rgb(.*) css color definition\n *\n * @return {Array} the array of rgb values found inside the passed string\n */\nexport function splitValues(rawValues: string): string[] {\n return rawValues.split(rawValues.includes(\",\") ? \",\" : \" \").map((s) => s.trim());\n}\n\n/**\n * If the value is an angle in degrees, convert it to the 0-360 range\n *\n * @param {string} angle - the degrees to convert into a number\n *\n * @return {number} the converted value\n */\nexport function normalizeDegrees(angle: string): number {\n // Strip label and convert to degrees (if necessary)\n let degAngle = parseFloat(angle) || 0;\n if (angle.indexOf(\"deg\") > -1) {\n degAngle = parseFloat(angle.substring(0, angle.length - 3));\n } else if (angle.indexOf(\"rad\") > -1) {\n degAngle = Math.round(parseFloat(angle.substring(0, angle.length - 3)) * (180 / Math.PI));\n } else if (angle.indexOf(\"turn\") > -1) {\n degAngle = Math.round(parseFloat(angle.substring(0, angle.length - 4)) * 360);\n }\n\n while (degAngle < 0) {\n degAngle += 360;\n }\n\n // Make sure it's a number between 0 and 360\n if (degAngle >= 360) degAngle %= 360;\n\n return degAngle;\n}\n\n/**\n * Returns a value that is limited between a minimum and maximum value.\n *\n * @param {number} value - The value to be limited.\n * @param {number} min - The minimum allowed value (default is 0).\n * @param {number} max - The maximum allowed value (default is 0).\n * @return {number} The limited value.\n */\nexport function limitValue(value: number, min: number = 0, max: number = 0): number {\n return Math.min(Math.max(Math.round(value), min), max);\n}\n\n/**\n * Calculates the value based on a given string and multiplier.\n *\n * @param {string} valueString - The string representing the value to be calculated.\n * @param {number} multiplier - The multiplier to be applied to the calculated value.\n * @return {number} The calculated value.\n */\nexport function calculateValue(valueString: string, multiplier: number): number {\n // Regular expression to match the calc() function and extract the numerical value\n const regex = /calc\\(([^)]+)\\)/;\n\n // Match the calc() function in the CSS string\n const match = valueString.match(regex);\n\n if (match) {\n // Extract the content inside the calc() function\n valueString = match[1];\n }\n\n // Return a default value or handle the case where calc() is not found\n return convertToInt8(valueString, multiplier);\n}\n\n/**\n * Removes comments from the input string and extracts the content between the first opening parenthesis\n * and the last closing parenthesis.\n *\n * @param {string} string - The input string.\n * @return {string} The content between the first opening parenthesis and the last closing parenthesis.\n */\nexport function cleanDefinition(string: string): string {\n // Remove comments from the string\n const cleanString = string.replace(stripComments, \"\");\n\n // Find the positions of the first opening and the last closing parentheses\n const firstParenthesisIndex = cleanString.indexOf(\"(\");\n const lastParenthesisIndex = cleanString.lastIndexOf(\")\");\n\n // Extract the content between the parentheses\n return cleanString.slice(firstParenthesisIndex + 1, lastParenthesisIndex).trim();\n}\n\n/**\n * Normalizes a percentage value by dividing it by 100 and multiplying it by a given multiplier.\n *\n * @param {string} value - The percentage value to be normalized.\n * @param {number} multiplier - The number to multiply the normalized percentage by.\n * @return {number} The normalized percentage value.\n */\nexport function normalizePercentage(value: string, multiplier: number): number {\n return (parseFloat(value) / 100) * multiplier;\n}\n\n/**\n * Calculates the color value fallbacks for a given value.\n *\n * @param {string} value - The color value to calculate fallbacks for.\n * @param {string} [err] - An optional error message to display.\n * @return {number} - The calculated color value fallbacks.\n */\nexport function colorValueFallbacks(value: string, err?: string): number {\n if (value === \"infinity\") {\n console.warn(err || `Positive infinity value has been set to 255: ${value}`);\n return 255;\n }\n\n if (value === \"currentColor\") console.warn(err || `The \"currentColor\" value has been set to 0: ${value}`);\n if (value === \"transparent\") console.warn(err || `The \"transparent\" value has been set to 0: ${value}`);\n if (value === \"NaN\") console.warn(err || `\"NaN\" value has been set to 0: ${value}`);\n if (value === \"-infinity\") console.warn(err || `\"Negative\" infinity value has been set to 0: ${value}`);\n if (value === \"none\") console.warn(err || `The none keyword is invalid in legacy color syntax: ${value}`);\n return 0;\n}\n\n/**\n * Takes a string with a css value that could be a number or percentage or an angle in degrees and returns the corresponding 8bit value\n *\n * @param {string} value - a valid value for the css color definition (like 255, \"100%\", \"324deg\", etc.) *\n * @param multiplier - the number that represent the maximum - default is 255 decimal - 100 hex\n *\n * @example convertToInt8('100%'); // 255\n *\n * @return {string} the corresponding value in 8-bit format\n */\nexport function convertToInt8(value: string, multiplier: number = 255): number {\n value = value ? value?.trim() : \"0\";\n if (isNumeric.test(value)) {\n // limit the min and the max value\n return limitValue(parseFloat(value) || 0, 0, multiplier);\n } else if (value.endsWith(\"%\")) {\n // If the value is a percentage, divide it by 100 to get a value from 0 to 1\n // and then multiply it by 255 to get a value from 0 to 255\n return normalizePercentage(value, multiplier) || 0;\n } else if (value.endsWith(\"deg\") || value.endsWith(\"rad\") || value.endsWith(\"turn\")) {\n return normalizeDegrees(value);\n } else if (value.startsWith(\"calc\")) {\n // get the value from the calc function\n return limitValue(calculateValue(value, multiplier), 0, multiplier);\n }\n\n // If the value is not a percentage or an angle in degrees, it is invalid\n return colorValueFallbacks(value, `Invalid value: ${value}`);\n}\n", "import { cleanDefinition, convertToInt8, limitValue, splitValues } from \"./common\";\nimport { RGBVALUE } from \"./types\";\n\nexport function fallbackRGB(rgb: string[], err: string = `Invalid RGB color`): string[] {\n console.warn(err);\n return [rgb[0] ?? 0, rgb[1] ?? 0, rgb[2]];\n}\n\n/**\n * Get the values of the rgb string\n *\n * @param rgbAsString - the rgb color as string split into values\n *\n * @return {Array} the values of the rgb string as Array of strings that represent the rgb color\n */\nexport function parseRgb(rgbAsString: string): string[] {\n const rgbvalue = cleanDefinition(rgbAsString);\n\n const rgb: string[] = splitValues(rgbvalue);\n\n if (rgb.length !== 3 && rgb.length !== 4) {\n return fallbackRGB(rgb, `Too few values to define rgb: ${rgbAsString} -> ${rgbvalue}`);\n } else {\n return [rgb[0], rgb[1], rgb[2]];\n }\n}\n\n/**\n * This function takes an array of strings and returns and object with the rgb values converted into INT8 (0-255)\n *\n * @param {Array} rgb - rgb color as Array of strings\n *\n * @return {Object} an object that contains the r, g and b values as INT8\n */\nexport function getRgbValues(rgb: string[]): RGBVALUE {\n // use the channel key as the new array key\n return {\n r: limitValue(Math.round(convertToInt8(rgb[0])), 0, 255) || 0,\n g: limitValue(Math.round(convertToInt8(rgb[1])), 0, 255) || 0,\n b: limitValue(Math.round(convertToInt8(rgb[2])), 0, 255) || 0,\n };\n}\n\n/**\n * returns a string representation of the rgb values\n *\n * @param {Object} rgb the rgb color object\n *\n * @return {string} a string representation of the rgb values\n */\nexport function RGB(rgb: RGBVALUE): string {\n return `rgb(${rgb.r},${rgb.g},${rgb.b})`;\n}\n", "import { COLORSTRING, HEX, RGBVALUE } from \"./types\";\nimport { fallbackRGB } from \"./rgb-utils\";\n\n/**\n * It returns an object with the hex values of the 3 digit hex color\n *\n * @param {string} value 3 digit hex\n * @return {string[]} 6 digit hex\n */\nexport function shortHexToLongHex(value: string): string[] {\n // split the string in to an array of digits then return an array that contains that digit doubled for each item\n return Array.from(value).map((v: string) => (v + v).toUpperCase());\n}\n\n/**\n * Checks if a given string represents a hexadecimal number.\n *\n * @param {string} num - The string to be checked.\n * @return {boolean} Returns true if the string is a valid hexadecimal number, false otherwise.\n */\nexport function isHex(num: string): boolean {\n return Boolean(num.match(/^[0-9a-f]+$/i));\n}\n\n/**\n * Get the hex value of the color and convert it to an Object of R G And B values (still in hex format)\n *\n * @param value the string that contains the color in hex format\n *\n * @return {string[]} an array of 6 digit hex values in a triplet of R G and B (HEX format)\n */\nexport function parseHex(value: COLORSTRING): string[] {\n // remove # at the beginning of the hex color\n const hexColor: string = value.substring(1);\n\n /**\n * then if the number of digits is greater than 2 (so it's something like 123 or abc456)\n * breakdown the string into an object that contains the r g and b values in hex\n */\n let hexArray: string[] = [];\n if (hexColor) {\n if (hexColor.length === 3 || hexColor.length === 4) {\n hexArray = shortHexToLongHex(hexColor);\n } else if (hexColor.length === 6 || hexColor.length === 8) {\n // match the hex value in groups of 2\n hexArray = (hexColor.match(/../g) || []).map((value: string) => value);\n }\n }\n\n if (hexArray.length) {\n hexArray?.forEach((value, index) => {\n if (isHex(value)) {\n hexArray[index] = value.toUpperCase();\n } else {\n console.warn(`Invalid Hex value: ${value}`);\n }\n });\n\n return hexArray;\n }\n\n console.warn(`Invalid Hex: ${value}`);\n return fallbackRGB(hexArray);\n}\n\n/**\n * Converts a Hex color to rgb\n *\n * @param {string} hex a tuple of hex values\n *\n * @return {string} the rgb color values for the given hex color\n */\nexport function hexToRgb(hex: string[]): RGBVALUE {\n // Extract the RGB values from the hex string\n return {\n r: parseInt(hex[0], 16),\n g: parseInt(hex[1], 16),\n b: parseInt(hex[2], 16),\n };\n}\n\n/**\n * Convert a INT8 value to HEX\n *\n * @param {number} int8 - the integer value to convert\n *\n * @return {string} the hex string\n */\nexport function toHex(int8: number): string {\n return int8.toString(16).padStart(2, \"0\");\n}\n\n/**\n * Convert rgb values to hex color\n *\n * @param {Object} rgb an object with the rgb values\n *\n * @return {string} the hex string\n */\nexport function valuesToHex(rgb: RGBVALUE): HEX {\n // Extract the RGB values from the hex string\n return `#${toHex(rgb?.r)}${toHex(rgb?.g)}${toHex(rgb?.b)}`;\n}\n", "import { cleanDefinition, colorValueFallbacks, convertToInt8, normalizeDegrees, splitValues } from \"./common\";\nimport { HSLVALUE, RGBVALUE } from \"./types\";\n\nexport function fallbackHSL(hsl: string[], err: string = `Invalid HSL color`): string[] {\n console.warn(err);\n return [hsl[0] ?? 0, hsl[1] ?? 0, hsl[2]];\n}\n\n/**\n * Get the values of the hsl string\n *\n * @param {string} hslAsString - the valid hsl color string\n * @return {string[]} the values of the hsl string\n */\nexport function parseHsl(hslAsString: string): string[] {\n const hslvalue = cleanDefinition(hslAsString);\n\n let hsl: string[] = splitValues(hslvalue);\n\n if (hsl.length !== 3 && hsl.length !== 4) {\n hsl = fallbackHSL(hsl);\n }\n return [hsl[0], hsl[1], hsl[2]];\n}\n\nconst angleError = (value: string): string => `Invalid angle: ${value} - The none keyword is invalid in legacy color syntax `;\n\n/**\n * This function takes an array of strings and returns and object with the hsl values converted into INT8 (0-255)\n *\n * @param {string[]} hsl - the hsl values to parse from string to int8 values\n *\n */\nexport function getHslValues(hsl: string[]): HSLVALUE {\n return {\n h: colorValueFallbacks(hsl[0], angleError(hsl[0])) || Math.round(normalizeDegrees(hsl[0])) || 0,\n s: colorValueFallbacks(hsl[1]) || convertToInt8(hsl[1], 100) || 0,\n l: colorValueFallbacks(hsl[2]) || convertToInt8(hsl[2], 100) || 0,\n };\n}\n\nfunction getHue(c: number, x: number, h: number): [number, number, number] {\n if (h < 60) return [c, x, 0];\n if (h < 120) return [x, c, 0];\n if (h < 180) return [0, c, x];\n if (h < 240) return [0, x, c];\n if (h < 300) return [x, 0, c];\n return [c, 0, x];\n}\n\n/**\n * Given the HSL color it convert the color into RGB\n *\n * @param {string[]} hslColor the HSL value to parse\n * @return {Object} rgb value\n */\nexport function hslToRgb(hslColor: string[]): RGBVALUE {\n const hsl = getHslValues(hslColor),\n s = hsl.s / 100,\n l = hsl.l / 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((hsl.h / 60) % 2) - 1));\n const m = l - c / 2;\n\n let [r, g, b] = getHue(c, x, hsl.h);\n\n r = Math.round((r + m) * 255);\n g = Math.round((g + m) * 255);\n b = Math.round((b + m) * 255);\n\n return { r, g, b };\n}\n\n/**\n * Given the RGB color it convert the color into HSL\n *\n * @param {number} r - red\n * @param {number} g - green\n * @param {number} b - blue\n *\n * @return {Object} hsl value\n */\nexport function valuesToHsl({ r, g, b }: RGBVALUE): string {\n // Make r, g, and b fractions of 1\n r /= 255;\n g /= 255;\n b /= 255;\n\n // Find greatest and smallest channel values\n const cmin = Math.min(r, g, b);\n const cmax = Math.max(r, g, b);\n const delta = cmax - cmin;\n let h = 0;\n let s = 0;\n let l = 0;\n\n // Calculate hue\n if (delta === 0) {\n // No difference\n h = 0;\n } else if (cmax === r) {\n // Red is max\n h = ((g - b) / delta) % 6;\n } else if (cmax === g) {\n // Green is max\n h = (b - r) / delta + 2;\n } else {\n h = (r - g) / delta + 4;\n } // Blue is max\n\n h = Math.round(h * 60);\n\n // Make negative hues positive behind 360\u00B0\n if (h < 0) {\n h += 360;\n }\n\n // Calculate lightness\n l = (cmax + cmin) / 2;\n\n // Calculate saturation\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n\n // Multiply l and s by 100\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n\n return HSL({ h, s, l });\n}\n\n/**\n * Converts an HSL color object to a string representation.\n *\n * @param {Object} hsl - Object containing the HSL color values.\n * @param {number} hsl.h - The hue value of the color.\n * @param {number} hsl.s - The saturation value of the color.\n * @param {number} hsl.l - The lightness value of the color.\n * @return {string} The HSL color as a string.\n */\nfunction HSL(hsl: { h: number; s: number; l: number }): string {\n return `hsl(${hsl.h},${hsl.s}%,${hsl.l}%)`;\n}\n", "import colorSet from \"./data/colorSet\";\nimport { RGBCOLORDEF } from \"./types\";\nimport { RGB } from \"./rgb-utils\";\nimport { valuesToHex } from \"./hex-utils\";\nimport { valuesToHsl } from \"./hsl-utils\";\n\n/**\n * This function was the opposite of the name of the repo and returns the color of the colorSet given the name\n *\n * @param {string} searchedColor -the name of the color to search for\n * @param {Array} set - the colorSet to search in\n */\nexport function getColor(searchedColor: string, set: RGBCOLORDEF[] | undefined = colorSet as RGBCOLORDEF[]) {\n const found: RGBCOLORDEF | undefined = set.find((color: RGBCOLORDEF) => color[3] === searchedColor);\n\n if (typeof found !== \"undefined\") {\n const [r, g, b] = found;\n return {\n hex: valuesToHex({ r, g, b }),\n rgb: RGB({ r, g, b }),\n hsl: valuesToHsl({ r, g, b }),\n };\n }\n\n throw new Error(`Error: invalid color ${searchedColor} or empty colorSet`);\n}\n"],
|
|
5
|
+
"mappings": "6GAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,eAAAC,GAAA,aAAAC,EAAA,aAAAC,EAAA,WAAAC,EAAA,YAAAC,EAAA,eAAAC,EAAA,aAAAC,KCAA,IAAMC,EAAW,CACf,CAAC,IAAK,IAAK,IAAK,OAAO,EACvB,CAAC,EAAG,EAAG,EAAG,OAAO,EACjB,CAAC,IAAK,EAAG,EAAG,KAAK,EACjB,CAAC,EAAG,IAAK,EAAG,OAAO,EACnB,CAAC,EAAG,EAAG,IAAK,MAAM,EAClB,CAAC,IAAK,IAAK,EAAG,QAAQ,EACtB,CAAC,IAAK,IAAK,IAAK,MAAM,EACtB,CAAC,IAAK,IAAK,EAAG,QAAQ,EACtB,CAAC,IAAK,EAAG,IAAK,SAAS,EACvB,CAAC,IAAK,IAAK,GAAI,aAAa,EAC5B,CAAC,IAAK,IAAK,IAAK,QAAQ,EACxB,CAAC,EAAG,IAAK,EAAG,MAAM,EAClB,CAAC,IAAK,EAAG,IAAK,QAAQ,EACtB,CAAC,IAAK,GAAI,GAAI,QAAQ,EACtB,CAAC,GAAI,IAAK,IAAK,WAAW,EAC1B,CAAC,IAAK,IAAK,GAAI,OAAO,EACtB,CAAC,EAAG,IAAK,IAAK,MAAM,EACpB,CAAC,IAAK,IAAK,IAAK,aAAa,EAC7B,CAAC,IAAK,IAAK,IAAK,MAAM,EACtB,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C,CAAS,CAC3D,EACA,OAAW,CAAE,MAAAC,EAAO,OAAAC,EAAQ,UAAAC,CAAU,IAAKT,EACzC,GAAIO,EAAM,KAAKR,CAAW,EAAG,CAC3B,IAAMW,EAASF,EAAOT,CAA0B,EAChD,OAAOU,EAAUC,CAAM,CACzB,CAIF,MAAM,IAAI,MAAM,kBAAkBX,CAAW,EAAE,CACjD",
|
|
6
|
+
"names": ["src_exports", "__export", "closest", "closestRGB", "distance", "getColor", "isDark", "isLight", "parseColor", "rgbToHex", "colorSet", "colorSet_default", "hexRegex", "rgbRegex", "hslRegex", "isNumeric", "stripComments", "BLACKANDWHITE", "RGBSET", "splitValues", "rawValues", "s", "normalizeDegrees", "angle", "degAngle", "limitValue", "value", "min", "max", "calculateValue", "valueString", "multiplier", "regex", "match", "convertToInt8", "cleanDefinition", "string", "cleanString", "firstParenthesisIndex", "lastParenthesisIndex", "normalizePercentage", "colorValueFallbacks", "err", "fallbackRGB", "rgb", "err", "parseRgb", "rgbAsString", "rgbvalue", "cleanDefinition", "splitValues", "getRgbValues", "limitValue", "convertToInt8", "RGB", "shortHexToLongHex", "value", "v", "isHex", "num", "parseHex", "hexColor", "hexArray", "index", "fallbackRGB", "hexToRgb", "hex", "toHex", "int8", "valuesToHex", "rgb", "fallbackHSL", "hsl", "err", "parseHsl", "hslAsString", "hslvalue", "cleanDefinition", "splitValues", "angleError", "value", "getHslValues", "colorValueFallbacks", "normalizeDegrees", "convertToInt8", "getHue", "c", "x", "h", "hslToRgb", "hslColor", "s", "l", "m", "r", "g", "valuesToHsl", "b", "cmin", "cmax", "delta", "HSL", "getColor", "searchedColor", "set", "colorSet_default", "found", "color", "r", "g", "b", "valuesToHex", "RGB", "valuesToHsl", "closest", "color", "set", "colorSet_default", "args", "closestGap", "closestColor", "rgbColorValues", "parseColor", "tested", "gap", "distance", "getColor", "isLight", "BLACKANDWHITE", "isDark", "closestRGB", "RGBSET", "rgb1", "rgb2", "fast", "rDiff", "gDiff", "bDiff", "dist", "rgbToHex", "rgbString", "rgbRegex", "rgb", "parseRgb", "RgbValues", "getRgbValues", "valuesToHex", "colorString", "colorParsers", "hexRegex", "parseHex", "hexToRgb", "hslRegex", "parseHsl", "hslToRgb", "regex", "parser", "converter", "result"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/******************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.__assign = function() {
|
|
21
|
+
exports.__assign = Object.assign || function __assign(t) {
|
|
22
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
+
s = arguments[i];
|
|
24
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
28
|
+
return exports.__assign.apply(this, arguments);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
32
|
+
var e = new Error(message);
|
|
33
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=_tslib.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_tslib.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|