UNPKG

react-color-strip

Version:

🎨 A minimal horizontal color picker strip component for React with draggable pointer support.

58 lines (57 loc) • 1.4 kB
import { ColorValue } from "../types"; /** * Convert HSL to RGB */ export declare function hslToRgb(h: number, s: number, l: number): { r: number; g: number; b: number; }; /** * Convert RGB to HSL */ export declare function rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number; }; /** * Convert RGB to Hex */ export declare function rgbToHex(r: number, g: number, b: number): string; /** * Convert Hex to RGB */ export declare function hexToRgb(hex: string): { r: number; g: number; b: number; } | null; /** * Parse color string and return RGB values */ export declare function parseColor(color: string): { r: number; g: number; b: number; } | null; /** * Create a ColorValue object from hue (0-360) */ export declare function createColorFromHue(hue: number): ColorValue; /** * Get hue from color string */ export declare function getHueFromColor(color: string): number; /** * Create a ColorValue object from any color format */ export declare function createColorValue(color: string): ColorValue; /** * Linearly interpolate between two colors * @param from Starting hex color (e.g. "#ffffff") * @param to Ending hex color (e.g. "#000000") * @param t Interpolation value between 0 and 1 * @returns Interpolated hex color */ export declare function mixColors(from: string, to: string, t: number): string;