@magic-color/core
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -22,2 +22,6 @@ /** | ||
/** | ||
* [0-100, -128-127, -128-127] | ||
*/ | ||
type LabColor = [number, number, number]; | ||
/** | ||
* 0-1 | ||
@@ -32,9 +36,15 @@ */ | ||
hsl: HslColor; | ||
lab: LabColor; | ||
} | ||
type ColorType = keyof Colors; | ||
type ColorValue = Colors[keyof Colors]; | ||
interface UnoColors { | ||
[key: string]: UnoColors & { | ||
DEFAULT?: string; | ||
} | string; | ||
} | ||
declare function isHex(color: string): boolean; | ||
declare function parseHex(color: HexColor): { | ||
value: string; | ||
values: string; | ||
alpha: number; | ||
@@ -45,2 +55,3 @@ }; | ||
declare function hexToHsb(color: HexColor): HsbColor; | ||
declare function hexToLab(color: HexColor): LabColor; | ||
declare function toHex(c: number): string; | ||
@@ -50,3 +61,3 @@ | ||
declare function parseHsl(color: string): { | ||
value: HslColor; | ||
values: HslColor; | ||
alpha: number; | ||
@@ -57,6 +68,7 @@ }; | ||
declare function hslToHsb(color: HslColor): HsbColor; | ||
declare function hslToLab(color: HslColor): LabColor; | ||
declare function isHsb(color: string): boolean; | ||
declare function parseHsb(color: string): { | ||
value: HsbColor; | ||
values: HsbColor; | ||
alpha: number; | ||
@@ -67,6 +79,7 @@ }; | ||
declare function hsbToHsl(color: HsbColor): HslColor; | ||
declare function hsbToLab(color: HsbColor): LabColor; | ||
declare function isRgb(color: string): boolean; | ||
declare function parseRgb(color: string): { | ||
value: RgbColor; | ||
values: RgbColor; | ||
alpha: number; | ||
@@ -77,11 +90,548 @@ }; | ||
declare function rgbToHsb(color: RgbColor): HsbColor; | ||
declare function rgbToLab(color: RgbColor): LabColor; | ||
declare const KeywordColors: Record<string, HexColor>; | ||
declare const UnoColors: Record<string, HexColor>; | ||
declare function isKeyword(color: string): color is keyof typeof KeywordColors; | ||
declare function isKeyword(color: string): boolean; | ||
declare function parseKeyword(color: string): { | ||
value: string; | ||
values: string; | ||
alpha: number; | ||
} | undefined; | ||
declare function isLab(color: string): boolean; | ||
declare function parseLab(color: string): { | ||
values: LabColor; | ||
alpha: number; | ||
}; | ||
declare function labToRgb(color: LabColor): RgbColor; | ||
declare function labToHex(color: LabColor): HexColor; | ||
declare function labToHsl(color: LabColor): HslColor; | ||
declare function labToHsb(color: LabColor): HsbColor; | ||
export { type ColorType, type ColorValue, type Colors, type HexColor, type HsbColor, type HslColor, type KeywordColor, KeywordColors, type Opacity, type RgbColor, UnoColors, hexToHsb, hexToHsl, hexToRgb, hsbToHex, hsbToHsl, hsbToRgb, hslToHex, hslToHsb, hslToRgb, isHex, isHsb, isHsl, isKeyword, isRgb, parseHex, parseHsb, parseHsl, parseKeyword, parseRgb, rgbToHex, rgbToHsb, rgbToHsl, toHex }; | ||
declare const unoColors: { | ||
inherit: string; | ||
current: string; | ||
transparent: string; | ||
black: string; | ||
white: string; | ||
rose: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
pink: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
fuchsia: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
purple: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
violet: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
indigo: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
blue: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
sky: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
cyan: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
teal: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
emerald: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
green: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
lime: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
yellow: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
amber: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
orange: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
red: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
gray: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
slate: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
zinc: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
neutral: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
stone: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
light: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
dark: { | ||
50: string; | ||
100: string; | ||
200: string; | ||
300: string; | ||
400: string; | ||
500: string; | ||
600: string; | ||
700: string; | ||
800: string; | ||
900: string; | ||
950: string; | ||
}; | ||
readonly lightblue: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly lightBlue: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly warmgray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly warmGray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly truegray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly trueGray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly coolgray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly coolGray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly bluegray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
readonly blueGray: string | (UnoColors & { | ||
DEFAULT?: string | undefined; | ||
}); | ||
}; | ||
/** | ||
* Magicolor includes colors basiclly from chroma.js, really from colorbrewer2.org. | ||
* | ||
* @Credit to [@gka](https://github.com/gka/chroma.js) | ||
* | ||
* @see https://github.com/gka/chroma.js | ||
*/ | ||
declare const colorbrewer: Record<string, string[]>; | ||
/** | ||
* X11 color names | ||
* | ||
* @see http://www.w3.org/TR/css3-color/#svg-color | ||
*/ | ||
declare const w3cx11: { | ||
aliceblue: string; | ||
antiquewhite: string; | ||
aqua: string; | ||
aquamarine: string; | ||
azure: string; | ||
beige: string; | ||
bisque: string; | ||
black: string; | ||
blanchedalmond: string; | ||
blue: string; | ||
blueviolet: string; | ||
brown: string; | ||
burlywood: string; | ||
cadetblue: string; | ||
chartreuse: string; | ||
chocolate: string; | ||
coral: string; | ||
cornflower: string; | ||
cornflowerblue: string; | ||
cornsilk: string; | ||
crimson: string; | ||
cyan: string; | ||
darkblue: string; | ||
darkcyan: string; | ||
darkgoldenrod: string; | ||
darkgray: string; | ||
darkgreen: string; | ||
darkgrey: string; | ||
darkkhaki: string; | ||
darkmagenta: string; | ||
darkolivegreen: string; | ||
darkorange: string; | ||
darkorchid: string; | ||
darkred: string; | ||
darksalmon: string; | ||
darkseagreen: string; | ||
darkslateblue: string; | ||
darkslategray: string; | ||
darkslategrey: string; | ||
darkturquoise: string; | ||
darkviolet: string; | ||
deeppink: string; | ||
deepskyblue: string; | ||
dimgray: string; | ||
dimgrey: string; | ||
dodgerblue: string; | ||
firebrick: string; | ||
floralwhite: string; | ||
forestgreen: string; | ||
fuchsia: string; | ||
gainsboro: string; | ||
ghostwhite: string; | ||
gold: string; | ||
goldenrod: string; | ||
gray: string; | ||
green: string; | ||
greenyellow: string; | ||
grey: string; | ||
honeydew: string; | ||
hotpink: string; | ||
indianred: string; | ||
indigo: string; | ||
ivory: string; | ||
khaki: string; | ||
laserlemon: string; | ||
lavender: string; | ||
lavenderblush: string; | ||
lawngreen: string; | ||
lemonchiffon: string; | ||
lightblue: string; | ||
lightcoral: string; | ||
lightcyan: string; | ||
lightgoldenrod: string; | ||
lightgoldenrodyellow: string; | ||
lightgray: string; | ||
lightgreen: string; | ||
lightgrey: string; | ||
lightpink: string; | ||
lightsalmon: string; | ||
lightseagreen: string; | ||
lightskyblue: string; | ||
lightslategray: string; | ||
lightslategrey: string; | ||
lightsteelblue: string; | ||
lightyellow: string; | ||
lime: string; | ||
limegreen: string; | ||
linen: string; | ||
magenta: string; | ||
maroon: string; | ||
maroon2: string; | ||
maroon3: string; | ||
mediumaquamarine: string; | ||
mediumblue: string; | ||
mediumorchid: string; | ||
mediumpurple: string; | ||
mediumseagreen: string; | ||
mediumslateblue: string; | ||
mediumspringgreen: string; | ||
mediumturquoise: string; | ||
mediumvioletred: string; | ||
midnightblue: string; | ||
mintcream: string; | ||
mistyrose: string; | ||
moccasin: string; | ||
navajowhite: string; | ||
navy: string; | ||
oldlace: string; | ||
olive: string; | ||
olivedrab: string; | ||
orange: string; | ||
orangered: string; | ||
orchid: string; | ||
palegoldenrod: string; | ||
palegreen: string; | ||
paleturquoise: string; | ||
palevioletred: string; | ||
papayawhip: string; | ||
peachpuff: string; | ||
peru: string; | ||
pink: string; | ||
plum: string; | ||
powderblue: string; | ||
purple: string; | ||
purple2: string; | ||
purple3: string; | ||
rebeccapurple: string; | ||
red: string; | ||
rosybrown: string; | ||
royalblue: string; | ||
saddlebrown: string; | ||
salmon: string; | ||
sandybrown: string; | ||
seagreen: string; | ||
seashell: string; | ||
sienna: string; | ||
silver: string; | ||
skyblue: string; | ||
slateblue: string; | ||
slategray: string; | ||
slategrey: string; | ||
snow: string; | ||
springgreen: string; | ||
steelblue: string; | ||
tan: string; | ||
teal: string; | ||
thistle: string; | ||
tomato: string; | ||
turquoise: string; | ||
violet: string; | ||
wheat: string; | ||
white: string; | ||
whitesmoke: string; | ||
yellow: string; | ||
yellowgreen: string; | ||
}; | ||
declare function isObject(v: unknown): boolean; | ||
declare function isArray(v: unknown): boolean; | ||
declare function isFunction(v: unknown): boolean; | ||
declare function isString(v: unknown): boolean; | ||
declare function isNumber(v: unknown): boolean; | ||
export { type ColorType, type ColorValue, type Colors, type HexColor, type HsbColor, type HslColor, type KeywordColor, type LabColor, type Opacity, type RgbColor, type UnoColors, colorbrewer, hexToHsb, hexToHsl, hexToLab, hexToRgb, hsbToHex, hsbToHsl, hsbToLab, hsbToRgb, hslToHex, hslToHsb, hslToLab, hslToRgb, isArray, isFunction, isHex, isHsb, isHsl, isKeyword, isLab, isNumber, isObject, isRgb, isString, labToHex, labToHsb, labToHsl, labToRgb, parseHex, parseHsb, parseHsl, parseKeyword, parseLab, parseRgb, rgbToHex, rgbToHsb, rgbToHsl, rgbToLab, toHex, unoColors, w3cx11 }; |
{ | ||
"name": "@magic-color/core", | ||
"type": "module", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Magic color core library", | ||
@@ -6,0 +6,0 @@ "author": "Chris <hizyyv@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56803
1532
1
1