• Blend low to high in sRGB by where value sits in [min, max], clamped outside. Heatmap plots and per-bar colouring call this once per bar, so it allocates only the result string: no closure, no cache, no lookup table.

    The clamp is two comparisons rather than Math.min/Math.max because both are false against a not-available value, which lands it on low instead of poisoning the output with NaN. Canvas ignores an unparseable fillStyle and silently keeps the previous one, so a bad string would bleed a neighbour's colour across the bar rather than fail loudly.

    Parameters

    • value: number
    • min: number
    • max: number
    • low: string
    • high: string

    Returns string