@Override
    public Color getColor(final float f) {
        if (v0 <= f && f <= v1) {
            final float t = (f - v0) / (v1 - v0);
            final int a = (int) (t * (a1 - a0) + a0 + 0.5);
            final int r = (int) (t * (r1 - r0) + r0 + 0.5);
            final int g = (int) (t * (g1 - g0) + g0 + 0.5);
            final int b = (int) (t * (b1 - b0) + b0 + 0.5);
            return new Color(r, g, b, a);
        }
        return null;
    }
Constructs a palette entry for the range of values v0 &le; f &lt; v1. The return color value will be interpolated between the two specified colors.

@param v0     the lower bounds (inclusive) of the covered range of values
@param v1     the upper bounds (non-inclusive) of the covered range of value
@param color0 the color assigned to value v0
@param color1 the color assigned to value v1
src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/floatingpoint/PaletteEntryForRange.java