react-color-pikr
Version:
A modern, customizable React color picker component library with 8-digit HEX alpha support
42 lines (41 loc) • 1.31 kB
TypeScript
import type { RGBColor, HSVColor, HSLColor } from "../types";
/**
* Convert hex color to RGB (supports both 6-digit #RRGGBB and 8-digit #RRGGBBAA formats)
*/
export declare function hexToRgb(hex: string): RGBColor | null;
/**
* Convert RGB color to hex (6-digit format)
*/
export declare function rgbToHex(r: number, g: number, b: number): string;
/**
* Convert RGB color with alpha to hex (8-digit format #RRGGBBAA)
*/
export declare function rgbToHexAlpha(r: number, g: number, b: number, a: number): string;
/**
* Convert RGB to HSV
*/
export declare function rgbToHsv(r: number, g: number, b: number): HSVColor;
/**
* Convert HSV to RGB
*/
export declare function hsvToRgb(h: number, s: number, v: number): RGBColor;
/**
* Convert RGB to HSL
*/
export declare function rgbToHsl(r: number, g: number, b: number): HSLColor;
/**
* Convert HSL to RGB
*/
export declare function hslToRgb(h: number, s: number, l: number): RGBColor;
/**
* Parse color string to RGB
*/
export declare function parseColorString(color: string): RGBColor | null;
/**
* Convert RGB color to CSS string
*/
export declare function rgbToCssString(color: RGBColor): string;
/**
* Get contrasting text color (black or white) for a given background color
*/
export declare function getContrastColor(color: RGBColor): string;