/** * A single stop on a parsed CSS gradient. `offset` ∈ [0, 1]. */ export interface GradientStop { offset: number; color: [number, number, number, number]; } /** * Parse a `linear-gradient(...)` CSS expression into ordered stops. Tolerates * missing percentages (distributes linearly between known offsets, matching * the CSS standard) and leading direction tokens (`to right`, `90deg`, etc.) * which are simply skipped. * * Returns the default blue → orange two-stop on any parse failure so themes * that never set the gradient still produce sane output. */ export declare function parseCssGradient(src: string | null | undefined): GradientStop[]; /** * Piecewise-linear color sample at `t ∈ [0, 1]`. Returns RGBA in [0, 1]. * Clamps `t` to the gradient's first/last stop outside `[0, 1]`. */ export declare function sampleGradient(stops: GradientStop[], t: number): [number, number, number, number]; /** * Sign-aware normalization. Returns `t ∈ [0, 1]` where the 50% stop is * always the sign pivot: * - crosses zero → `[-maxAbs, maxAbs]` stretched symmetrically; 0 → 0.5. * - all-positive → `[0, colorMax]` occupies top half `[0.5, 1]`. * - all-negative → `[colorMin, 0]` occupies bottom half `[0, 0.5]`. * - degenerate → 0.5 (single colour at the midpoint). */ export declare function colorValueToT(value: number, colorMin: number, colorMax: number): number; /** * Convert a discrete series palette (from `--psp-charts--series-N--color`) * into a `GradientStop[]` with stops at `i / (N - 1)`. The resulting * stops can feed `buildGradientLUT` / `ensureGradientTexture` / any * other code path that already accepts a gradient — so categorical * coloring and numeric gradients share one LUT pipeline. Integer idx * sampling via `t = idx / (N - 1)` lands exactly on a palette color; * the linear blend between stops is only hit by non-integer samples * (which categorical data doesn't produce). */ export declare function paletteToStops(palette: [number, number, number][]): GradientStop[]; /** * Bake a sampled LUT for GPU upload as RGBA8 (`size × 1`). Default 256 * samples — visually indistinguishable from a denser sample at typical * viewport sizes and keeps the texture tiny (1 KB). */ export declare function buildGradientLUT(stops: GradientStop[], size?: number): Uint8Array;