/** * Fits a shade scale to an existing color ladder. * * A scale is two things: the WCAG contrast `range` a family spans from its lightest shade * to its darkest, and a cubic-bezier `curve` placing each shade inside that range. Given a * ladder of colors from some other design system, both can be recovered exactly - the range * from the two endpoints, the curve by least-squares over the shades between them. */ /** Control points of a cubic bezier whose outer points are pinned at 0 and 1. */ export type Curve = [number, number, number, number]; export interface FittedScale { /** Contrast against white at the lightest and darkest rungs. */ range: [number, number]; /** The eased placement, or null when the ladder is already evenly spread. */ curve: Curve | null; /** RMS error between the fitted curve and the ladder, in normalized range units. */ rms: number; /** Per-rung contrast the fitted scale would produce, against the ladder's own. */ rungs: Array<{ index: number; actual: number; fitted: number; }>; } /** Reads the curve the way CSS reads a timing function: solve x for t, return y. */ export declare const ease: (x: number, curve: Curve) => number; /** * Fit a scale to a ladder of luminances, ordered lightest to darkest. * * @param luminances - One luminance per rung, at least 3, lightest first. * @returns The range, the fitted curve, and how closely it reproduces the ladder. */ export declare function fitScale(luminances: number[]): FittedScale;