UNPKG

allc

Version:

A small typescript package for color conversion.

126 lines 7.38 kB
/** * Calculates the 3D Euclidean distance between two HSV colors. * * This function first calculates the 3D position of the HSV parameters * **in the HSV cone**, and then it calculates the Euclidean distance. * This is different and more accurate than the Euclidean distance * of just the HSV components. * * @param h1 The hue component of the first HSV color, unbounded, in radians. * @param s1 The saturation component of the first HSV color, typically in the range [0, 1]. * @param v1 The value component of the first HSV color, typically in the range [0, 1]. * @param h2 The hue component of the second HSV color, unbounded, in radians. * @param s2 The saturation component of the second HSV color, typically in the range [0, 1]. * @param v2 The value component of the second HSV color, typically in the range [0, 1]. * * @returns The color distance. */ export declare const distance3DHSV: (h1: number, s1: number, v1: number, h2: number, s2: number, v2: number) => number; /** * Calculates the 3D Euclidean distance between two HSL colors. * * This function first calculates the 3D position of the HSL parameters * **in the HSL bicone**, and then it calculates the Euclidean distance. * This is different and more accurate than the Euclidean distance * of just the HSL components. * * @param h1 The hue component of the first HSL color, unbounded, in radians. * @param s1 The saturation component of the first HSL color, typically in the range [0, 1]. * @param l1 The lightness component of the first HSL color, typically in the range [0, 1]. * @param h2 The hue component of the second HSL color, unbounded, in radians. * @param s2 The saturation component of the second HSL color, typically in the range [0, 1]. * @param l2 The lightness component of the second HSL color, typically in the range [0, 1]. * * @returns The color distance. */ export declare const distance3DHSL: (h1: number, s1: number, l1: number, h2: number, s2: number, l2: number) => number; /** * Calculates the 3D Euclidean distance between two HSI colors. * * This function first calculates the 3D position of the HSI parameters, * and then it calculates the Euclidean distance. * This is different and more accurate than the Euclidean distance * of just the HSI components. * * @param h1 The hue component of the first HSI color, unbounded, in radians. * @param s1 The saturation component of the first HSI color, typically in the range [0, 1]. * @param i1 The intensity component of the first HSI color, typically in the range [0, 1]. * @param h2 The hue component of the second HSI color, unbounded, in radians. * @param s2 The saturation component of the second HSI color, typically in the range [0, 1]. * @param i2 The intensity component of the second HSI color, typically in the range [0, 1]. * * @returns The color distance. */ export declare const distance3DHSI: (h1: number, s1: number, i1: number, h2: number, s2: number, i2: number) => number; /** * Calculates the CMC l:c (1984) color difference "ΔE*" between two CIELCH colors. * * @param l1 The luminance component of the first CIELCH color, range [0, 1]. * @param c1 The chroma component of the first CIELCH color, unbounded, non-negative. * @param h1 The hue component of the first CIELCH color, unbounded, in radians. * @param l2 The luminance component of the second CIELCH color, range [0, 1]. * @param c2 The chroma component of the second CIELCH color, unbounded, non-negative. * @param h2 The hue component of the second CIELCH color, unbounded, in radians. * @param l An optional lightness weight, defaults to 2. * @param c An optional chroma weight, defaults to 1. * * @returns The color difference. * @see https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_(1984) */ export declare const distanceCMClc: (l1: number, c1: number, h1: number, l2: number, c2: number, h2: number, l?: number, c?: number) => number; export declare const CIE94_GRAPHICS_KL = 1; export declare const CIE94_GRAPHICS_KC = 1; export declare const CIE94_GRAPHICS_KH = 1; export declare const CIE94_GRAPHICS_K1 = 0.045; export declare const CIE94_GRAPHICS_K2 = 0.015; export declare const CIE94_TEXTILE_KL = 2; export declare const CIE94_TEXTILE_KC = 1; export declare const CIE94_TEXTILE_KH = 1; export declare const CIE94_TEXTILE_K1 = 0.048; export declare const CIE94_TEXTILE_K2 = 0.015; /** * Calculates the CIE94 color difference "ΔE*" between two CIELAB colors. * Below, there is a table for the application-dependent parameters. * * | Parameter | Graphics (default) | Textile | * |-----------|-----------------------------------------------|---------------------------------------------| * | `kl` | {@link CIE94_GRAPHICS_KL `CIE94_GRAPHICS_KL`} | {@link CIE94_TEXTILE_KL `CIE94_TEXTILE_KL`} | * | `kc` | {@link CIE94_GRAPHICS_KC `CIE94_GRAPHICS_KC`} | {@link CIE94_TEXTILE_KC `CIE94_TEXTILE_KC`} | * | `kh` | {@link CIE94_GRAPHICS_KH `CIE94_GRAPHICS_KH`} | {@link CIE94_TEXTILE_KH `CIE94_TEXTILE_KH`} | * | `K1` | {@link CIE94_GRAPHICS_K1 `CIE94_GRAPHICS_K1`} | {@link CIE94_TEXTILE_K1 `CIE94_TEXTILE_K1`} | * | `K2` | {@link CIE94_GRAPHICS_K2 `CIE94_GRAPHICS_K2`} | {@link CIE94_TEXTILE_K2 `CIE94_TEXTILE_K2`} | * * @param l1 The luminance component of the first CIELAB color, range [0, 1]. * @param a1 The a component of the first CIELAB color, unbounded. * @param b1 The b component of the first CIELAB color, unbounded. * @param l2 The luminance component of the second CIELAB color, range [0, 1]. * @param a2 The a component of the second CIELAB color, unbounded. * @param b2 The b component of the second CIELAB color, unbounded. * @param kl An optional, application-dependent luminance weight. * @param kc An optional, application-dependent chroma weight. * @param kh An optional, application-dependent hue weight. * @param K1 An optional, application-dependent value. * @param K2 An optional, application-dependent value. * * @returns The color difference. * @see https://en.wikipedia.org/wiki/Color_difference#CIE94 */ export declare const distanceCIE94: (l1: number, a1: number, b1: number, l2: number, a2: number, b2: number, kl?: number, kc?: number, kh?: number, K1?: number, K2?: number) => number; /** * Calculates the CIEDE2000 color difference "ΔE*" between two CIELAB colors. * * @param l1 The luminance component of the first CIELAB color, range [0, 1]. * @param a1 The a component of the first CIELAB color, unbounded. * @param b1 The b component of the first CIELAB color, unbounded. * @param l2 The luminance component of the second CIELAB color, range [0, 1]. * @param a2 The a component of the second CIELAB color, unbounded. * @param b2 The b component of the second CIELAB color, unbounded. * @param kl An optional, application-dependent luminance weight, defaults to 1. * @param kc An optional, application-dependent chroma weight, defaults to 1. * @param kh An optional, application-dependent hue weight, defaults to 1. * * @returns The color difference. * @see https://en.wikipedia.org/wiki/Color_difference#CIEDE2000 */ export declare const distanceCIEDE2000: (l1: number, a1: number, b1: number, l2: number, a2: number, b2: number, kl?: number, kc?: number, kh?: number) => number; //# sourceMappingURL=distances.d.ts.map