@thi.ng/color
Version:
Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets
118 lines • 3.43 kB
TypeScript
import { type ReadonlyVec } from "@thi.ng/vectors/api";
import type { ColorDistance } from "./api.js";
/**
* Higher order function. Returns {@link ColorDistance} function for given color
* channel ID.
*
* @param id -
*/
export declare const distChannel: (id: number) => ColorDistance;
/**
* Computes distance between two HSV colors, i.e. the eucledian distance between
* points in a cyclinder.
*
* @param a -
* @param b -
*/
export declare const distHsv: ColorDistance;
/**
* Similar to {@link distHsv}, but computes distance between two LCH colors
* (with different channel order), i.e. the eucledian distance between points in
* a cyclinder (using Law of Cosines).
*
* @remarks
* References:
*
* - https://math.stackexchange.com/a/3612602
* - https://en.wikipedia.org/wiki/Law_of_cosines
*
* @param a
* @param b
*/
export declare const distLch: ColorDistance;
/**
* Computes difference in saturation between two HSV colors.
*
* @param a -
* @param b -
*/
export declare const distHsvSat: ColorDistance;
/**
* Computes difference in brightness between two HSV or two HSL colors.
*
* @param a -
* @param b -
*/
export declare const distHsvLuma: ColorDistance;
/**
* Computes eucledian distance between two colors. Only the first 3 color
* channels will be considered.
*
* @param a -
* @param b -
*/
export declare const distEucledian3: ColorDistance;
export declare const distEucledian4: ColorDistance;
/**
* Computes difference in luminance between two RGB colors.
*
* @param a -
* @param b -
*/
export declare const distRgbLuma: ColorDistance;
export declare const distSrgbLuma: ColorDistance;
/**
* Computes red difference between two RGB colors.
*
* @param a -
* @param b -
*/
export declare const distRgbRed: ColorDistance;
/**
* Computes green difference between two RGB colors.
*
* @param a -
* @param b -
*/
export declare const distRgbGreen: ColorDistance;
/**
* Computes blue difference between two RGB colors.
*
* @param a -
* @param b -
*/
export declare const distRgbBlue: ColorDistance;
/**
* Higher order function to compute the CIEDE2000 color difference between 2
* colors in CIELAB space. Takes a vector of LCH weight coefficients to adjust
* importance of luminance, chroma and hue differences. By default all are 1.
* Returns a {@link ColorDistance} function which converts (if needed) input
* colors to {@link LabD50} and then computes the metric.
*
* @remarks
* References:
*
* - https://en.wikipedia.org/wiki/Color_difference#CIEDE2000
* - http://www2.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf
*
* @param a - Lab color
* @param b - Lab color
*/
export declare const distCIEDE2000: (weights?: ReadonlyVec) => ColorDistance;
/**
* Higher order function to compute the CMC l:c (1984) difference measure
* between 2 colors in the CIELAB (D65) space. Takes lightness and chroma weight
* coefficients to adjust ratio of L:C. By default both are 1. Returns a
* {@link ColorDistance} function which converts (if needed) input colors to
* {@link LabD65} and then computes the metric.
*
* @remarks
* Important: This formular is only a quasimetric & violates symmetry, i.e.
* `distCMC(a, b) !== distCMC(b, a)`
*
* References:
*
* - https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_(1984)
*/
export declare const distCMC: (kl?: number, kc?: number) => ColorDistance;
//# sourceMappingURL=distance.d.ts.map