@microsoft/fast-colors > centeredRescale
centeredRescale() function
Takes an input array of colors and extrapolates them to a larger palette. The mapping first takes the input array and extrapolates between each color so that they are separated by spacing-1 slots. Then it adds to either end enough new colors to make up the desired targetSize. All output color slots between the defined stops are interpolated.
Signature:export declare function centeredRescale(input: ColorRGBA64[], config?: CenteredRescaleConfig): ColorRGBA64[];
Parameters
Parameter | Type | Description |
---|---|---|
input | ColorRGBA64[] | |
config | CenteredRescaleConfig |
Example
For an input array with length 5, a targetSize of 17 and spacing of 3 the output would be: 0: scaleColorLight 1: 2: input 0 3: 4: 5: input 1 6: 7: 8: input 2 9: 10: 11: input 3 12: 13: 14: input 4 15: 16: scaleColorDark