/** * @fileoverview Hex → OKLCH color converter. * @module packages/ui/lib/color * @package ui * * Minimal sRGB-hex to OKLCH conversion using the OKLab color space * (Björn Ottosson, 2020). Used by CustomThemeInjector to let developers * pass any CSS color as `primary` and have it injected as the three * rebrand-surface variables --primary-h / --primary-c / --primary-l. * * Scope: * - Parses "#RGB", "#RRGGBB", "#RGBA", "#RRGGBBAA" (alpha discarded). * - Non-hex strings (oklch(…), rgb(…), hsl(…), named colors) are * assumed already in a CSS-parseable form → return null to signal * "use as-is" to the caller. * * Non-goals: * - Gamut clamping (sRGB hex is in-gamut by definition). * - Parsing rgb()/hsl()/oklch() strings (let CSS do it). * * Reference: https://bottosson.github.io/posts/oklab/ */ /** Decomposed OKLCH triplet. Hue is in [0, 360), chroma ≥ 0, lightness in [0, 1]. */ export interface OklchTriplet { l: number; c: number; h: number; } /** * Convert a hex color string to an OKLCH triplet. * * @param hex - "#RGB", "#RRGGBB", "#RGBA", or "#RRGGBBAA" (alpha discarded) * @returns OKLCH triplet, or `null` if the input is not a parseable hex string */ export declare function hexToOklch(hex: string): OklchTriplet | null; /** * Detect whether a string is a hex color (the only format this module converts). * Other CSS color formats pass through to the browser's parser. */ export declare function isHex(input: string): boolean;