Skip to main content
Version: 1.x

@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

ParameterTypeDescription
inputColorRGBA64[]
targetSizenumber
preserveInputColorsboolean
Returns:

ColorRGBA64[]