/** * @typedef {Object} Hsl * @property {number} h hue 0..360 * @property {number} s saturation 0..100 * @property {number} l lightness 0..100 */ /** * Convert a hex color string to HSL. * Accepts #rgb, #rgba, #rrggbb, #rrggbbaa (alpha ignored). * @param {string} hex * @returns {Hsl} */ export function hexToHsl(hex: string): Hsl; /** * Format an Hsl object as a css hsl() string. * @param {Hsl} hsl * @returns {string} */ export function hslToCss({ h, s, l }: Hsl): string; /** * Invert an Hsl color for dark-mode derivation. Lightness is flipped * (l -> 100 - l) then lifted by `lift` (default 20) so a light surface (e.g. * white, l=100) does not collapse to pure black (0%) — it lands at ~20% (a * dark gray). A smaller lift yields a darker result (surfaces), a larger lift * yields a lighter result (text). Result clamped to [0, 100]. * Hue and saturation kept. * @param {Hsl} hsl * @param {number} [lift=20] * @returns {Hsl} */ export function invert(hsl: Hsl, lift?: number): Hsl; /** * Invert a hex color and return a css hsl() string. * @param {string} hex * @param {number} [lift=20] * @returns {string} */ export function invertHex(hex: string, lift?: number): string; export type Hsl = { /** * hue 0..360 */ h: number; /** * saturation 0..100 */ s: number; /** * lightness 0..100 */ l: number; };