fern.tools
Class ColorSpectrum

java.lang.Object
  extended by fern.tools.ColorSpectrum

public class ColorSpectrum
extends Object

Provides methods to assign colors to numbers between 0 and 1.

Author:
Florian Erhard

Constructor Summary
ColorSpectrum()
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorSpectrum

public ColorSpectrum()
Method Detail

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 1
colors - color spectrum
Returns:
color for the value