• Convenience function that maps a color palette + value range to Color Lookup Table steps.

    Equal to following one-liner:

     const steps = colorPalette.map((color, i) => ({ color, value: valueMin + (i / (colorPalette.length - 1)) * (valueMax - valueMin) }))
    

    Used like this:

     // Example, construct LUT with regular color steps from an array of colors.
    const lut = new LUT({
    interpolate: true,
    steps: regularColorSteps(0, 100, [ ColorCSS('red'), ColorCSS('blue'), ColorCSS('green') ])
    })

    Returns

    Array of LUTSteps which can be used to construct a LUT object.

    Parameters

    • valueMin: number

      Min LUT value. Attached to the first color in the palette.

    • valueMax: number

      Max LUT value. Attached to the last color in the palette.

    • colorPalette: Color[]
    • Optional opts: {
          alpha?: number;
          formatLabels?: ((value: number) => string);
      }

      Optional extra options.

      • Optional alpha?: number
      • Optional formatLabels?: ((value: number) => string)
          • (value: number): string
          • Parameters

            • value: number

            Returns string

    Returns LUTStep[]