fern.tools
Class ColorSpectrum
java.lang.Object
fern.tools.ColorSpectrum
public class ColorSpectrum
- extends Object
Provides methods to assign colors to numbers between 0 and 1.
- Author:
- Florian Erhard
Method Summary |
static Color |
getGrayScaleSpectrum(float value)
Gets a gray scale color representing the given number, 0 means white, 1 means black. |
static Color |
getSpectrum(float val,
Color... colors)
Gets a color representing the given number in an given color scale. |
ColorSpectrum
public ColorSpectrum()
getGrayScaleSpectrum
public static Color getGrayScaleSpectrum(float value)
- Gets a gray scale color representing the given number, 0 means white, 1 means black.
- Parameters:
value
- between 0 and 1
- Returns:
- gray scale color
getSpectrum
public static Color getSpectrum(float val,
Color... colors)
- Gets a color representing the given number in an given color scale.
You can give as much colors as you want. The resulting color will be interpolated.
- Parameters:
val
- between 0 and 1colors
- color spectrum
- Returns:
- color for the value