export type RGB = readonly [number, number, number]; export type RGBA = readonly [number, number, number, number]; export type HSL = readonly [number, number, number]; export type HSLA = readonly [number, number, number, number]; export type HSV = readonly [number, number, number]; export type HexColor = `#${string}`; export type RGBColor = `rgb${'a' | ''}(${string})`; export type HSLColor = `hsl${'a' | ''}(${string})`; export declare const commonColors: `#${string}`[]; export declare function rgbToRgbColor([r, g, b, a]: RGB | RGBA): RGBColor; export declare function rgbToHslColor([r, g, b, a]: RGB | RGBA): HSLColor; export declare function rgbToHexColor(rgba: RGB | RGBA): HexColor; export declare function randomColor(): RGB; export declare function randomColor(type: 'rgba'): RGBColor; export declare function randomColor(type: 'hsla'): HSLColor; export declare function randomColor(type: 'hex'): HexColor; export declare function parseHexColor(str: HexColor): RGBA; /** * Note: ignore alpha */ export declare function luminance([r, g, b]: RGB | RGBA): number; /** * Note: ignore alpha */ export declare function contrast(rgb1: RGB | RGBA, rgb2: RGB | RGBA): number; /** * Note: ignore alpha * * @see * https://stackoverflow.com/questions/8022885/rgb-to-hsv-color-in-javascript */ export declare function rgbToHsl(rgb: RGB | RGBA): HSL; export declare function hslToRgb([h, s, l]: HSL | HSLA): RGB; export declare function rgbToHsv(rgb: RGB | RGBA): HSV; export declare function hsvToRgb([h, s, v]: HSV): RGB; export declare function hslToHsv([h, s, l]: HSL | HSLA): HSV; export declare function hsvToHsl([h, s, v]: HSV): HSL; //# sourceMappingURL=color.d.ts.map