toxi.color
Class Hue

java.lang.Object
  extended by toxi.color.Hue

public class Hue
extends java.lang.Object

This class defines color hues and allows them to be access by name. There are also methods to check if a hue is one of the 7 primary hues (rainbow) or to find the closest defined hue for a given color.


Field Summary
static Hue AZURE
           
static Hue BLUE
           
static Hue CYAN
           
static Hue GREEN
           
static Hue INDIGO
           
static Hue LIME
           
static Hue ORANGE
           
static Hue PINK
           
static float PRIMARY_VARIANCE
          Tolerance value for checking if a given hue is primary (default 0.01)
static Hue PURPLE
           
static Hue RED
           
static Hue TEAL
           
static Hue YELLOW
           
 
Constructor Summary
Hue(java.lang.String name, float hue)
           
Hue(java.lang.String name, float hue, boolean isPrimary)
           
 
Method Summary
static Hue getClosest(float hue, boolean primaryOnly)
          Finds the closest defined & named Hue for the given hue value.
static Hue getForName(java.lang.String name)
           
 float getHue()
           
 java.lang.String getName()
           
 boolean isPrimary()
           
static boolean isPrimary(float hue)
           
static boolean isPrimary(float hue, float variance)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RED

public static final Hue RED

ORANGE

public static final Hue ORANGE

YELLOW

public static final Hue YELLOW

LIME

public static final Hue LIME

GREEN

public static final Hue GREEN

TEAL

public static final Hue TEAL

CYAN

public static final Hue CYAN

AZURE

public static final Hue AZURE

BLUE

public static final Hue BLUE

INDIGO

public static final Hue INDIGO

PURPLE

public static final Hue PURPLE

PINK

public static final Hue PINK

PRIMARY_VARIANCE

public static float PRIMARY_VARIANCE
Tolerance value for checking if a given hue is primary (default 0.01)

Constructor Detail

Hue

public Hue(java.lang.String name,
           float hue)

Hue

public Hue(java.lang.String name,
           float hue,
           boolean isPrimary)
Method Detail

getClosest

public static final Hue getClosest(float hue,
                                   boolean primaryOnly)
Finds the closest defined & named Hue for the given hue value. Optionally, the search can be limited to primary hues only.

Parameters:
hue - normalized hue (0.0 ... 1.0) will be automatically wrapped
primaryOnly - only consider the 7 primary hues
Returns:
closest Hue instance

getForName

public static final Hue getForName(java.lang.String name)

isPrimary

public static boolean isPrimary(float hue)

isPrimary

public static boolean isPrimary(float hue,
                                float variance)

getHue

public float getHue()

getName

public java.lang.String getName()

isPrimary

public boolean isPrimary()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object