/* @ts-self-types="./helpers.d.ts" */ import { Color, ColorChannel, ColorSpace } from "./types.js"; /** * Parses a color string into a {@link Color} object. * * Supported formats: * - **Hex**: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa` * - **RGB**: `rgb(r g b)`, `rgb(r, g, b)`, `rgb(r g b / a)`, `rgba(r, g, b, a)` * - **HSL**: `hsl(h, s%, l%)`, `hsla(h, s%, l%, a)` * - **HSB**: `hsb(h, s%, b%)`, `hsba(h, s%, b%, a)` * * @throws if the string does not match any supported format. * * @example * ```ts * const color = parseColor("#3264C8"); * color.toString("hsl"); // "hsl(220 60% 49.02%)" * ``` */ export declare function parseColor(value: string): Color; /** * Accepts either a color string or an existing {@link Color} and always returns a `Color`. * Useful for normalizing props that accept both forms. */ export declare function normalizeColor(v: string | Color): Color; /** * Returns the ordered channel triple for a given color space. * * - `"rgb"` → `["red", "green", "blue"]` * - `"hsl"` → `["hue", "saturation", "lightness"]` * - `"hsb"` → `["hue", "saturation", "brightness"]` */ export declare function getColorChannels(colorSpace: ColorSpace): [ColorChannel, ColorChannel, ColorChannel]; /** * Normalizes a hue angle to the range `[0, 360]`. * Exactly `360` is kept as-is so that a full-circle endpoint stays distinct from `0`. */ export declare function normalizeHue(hue: number): number; /** * Converts any {@link Color} to OKLCH `[L, C, H]` — a perceptually uniform space * where L is perceived lightness (0–1), C is chroma (≥ 0), and H is a hue angle (0–360). * * Full pipeline: sRGB bytes → linear sRGB (gamma-expand) → CIE XYZ D65 → OKLab → OKLCH. * * @see https://www.w3.org/TR/css-color-4/#color-conversion-code */ export declare function colorToOKLCH(color: Color): [l: number, c: number, h: number];