@microsoft/fast-colors > rescale

rescale() function

Take the input array of colors and extrapolates them to a larger palette of size targetSize. If preserveInputColors is false the input colors are evenly distributed into the output. Otherwise, the positions of the input colors are adjusted from a perfectly even distribution in order to ensure that the exact color values appearing in the input array also appear in the output array. The larger targetSize is compared to input.length the smaller those adjustments will be.

Signature:

export declare function rescale(input: ColorRGBA64[], targetSize: number, preserveInputColors: boolean): ColorRGBA64[];

Parameters

Parameter Type Description
input ColorRGBA64[]
targetSize number
preserveInputColors boolean

Returns:

ColorRGBA64[]