[6a3a178] | 1 | export declare type RgbColor = {
|
---|
| 2 | r: number;
|
---|
| 3 | g: number;
|
---|
| 4 | b: number;
|
---|
| 5 | };
|
---|
| 6 | export declare type HslColor = {
|
---|
| 7 | h: number;
|
---|
| 8 | s: number;
|
---|
| 9 | l: number;
|
---|
| 10 | };
|
---|
| 11 | export declare type HsvColor = {
|
---|
| 12 | h: number;
|
---|
| 13 | s: number;
|
---|
| 14 | v: number;
|
---|
| 15 | };
|
---|
| 16 | export declare type HwbColor = {
|
---|
| 17 | h: number;
|
---|
| 18 | w: number;
|
---|
| 19 | b: number;
|
---|
| 20 | };
|
---|
| 21 | export interface XyzColor {
|
---|
| 22 | x: number;
|
---|
| 23 | y: number;
|
---|
| 24 | z: number;
|
---|
| 25 | }
|
---|
| 26 | export interface LabColor {
|
---|
| 27 | l: number;
|
---|
| 28 | a: number;
|
---|
| 29 | b: number;
|
---|
| 30 | }
|
---|
| 31 | export interface LchColor {
|
---|
| 32 | l: number;
|
---|
| 33 | c: number;
|
---|
| 34 | h: number;
|
---|
| 35 | }
|
---|
| 36 | export interface CmykColor {
|
---|
| 37 | c: number;
|
---|
| 38 | m: number;
|
---|
| 39 | y: number;
|
---|
| 40 | k: number;
|
---|
| 41 | }
|
---|
| 42 | declare type WithAlpha<O> = O & {
|
---|
| 43 | a: number;
|
---|
| 44 | };
|
---|
| 45 | export declare type RgbaColor = WithAlpha<RgbColor>;
|
---|
| 46 | export declare type HslaColor = WithAlpha<HslColor>;
|
---|
| 47 | export declare type HsvaColor = WithAlpha<HsvColor>;
|
---|
| 48 | export declare type HwbaColor = WithAlpha<HwbColor>;
|
---|
| 49 | export declare type XyzaColor = WithAlpha<XyzColor>;
|
---|
| 50 | export declare type LabaColor = LabColor & {
|
---|
| 51 | alpha: number;
|
---|
| 52 | };
|
---|
| 53 | export declare type LchaColor = WithAlpha<LchColor>;
|
---|
| 54 | export declare type CmykaColor = WithAlpha<CmykColor>;
|
---|
| 55 | export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
|
---|
| 56 | export declare type AnyColor = string | ObjectColor;
|
---|
| 57 | export declare type InputObject = Record<string, unknown>;
|
---|
| 58 | export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch" | "cmyk";
|
---|
| 59 | export declare type Input = string | InputObject;
|
---|
| 60 | export declare type ParseResult = [RgbaColor, Format];
|
---|
| 61 | export declare type ParseFunction<I extends Input> = (input: I) => RgbaColor | null;
|
---|
| 62 | export declare type Parser<I extends Input> = [ParseFunction<I>, Format];
|
---|
| 63 | export declare type Parsers = {
|
---|
| 64 | string: Array<Parser<string>>;
|
---|
| 65 | object: Array<Parser<InputObject>>;
|
---|
| 66 | };
|
---|
| 67 | export {};
|
---|