Package toxi.color
Class Hue
java.lang.Object
toxi.color.Hue
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
FieldsModifier and TypeFieldDescriptionstatic final Huestatic final Huestatic final Huestatic final Huestatic final Huestatic final Huestatic final Huestatic final Huestatic floatTolerance value for checking if a given hue is primary (default 0.01)static final Huestatic final Huestatic final Huestatic final Hue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final HuegetClosest(float hue, boolean primaryOnly) Finds the closest defined & named Hue for the given hue value.static final HuegetForName(String name) floatgetHue()getName()booleanstatic booleanisPrimary(float hue) static booleanisPrimary(float hue, float variance) toString()
-
Field Details
-
RED
-
ORANGE
-
YELLOW
-
LIME
-
GREEN
-
TEAL
-
CYAN
-
AZURE
-
BLUE
-
INDIGO
-
PURPLE
-
PINK
-
PRIMARY_VARIANCE
public static float PRIMARY_VARIANCETolerance value for checking if a given hue is primary (default 0.01)
-
-
Constructor Details
-
Hue
-
Hue
-
-
Method Details
-
getClosest
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 wrappedprimaryOnly- only consider the 7 primary hues- Returns:
- closest Hue instance
-
getForName
-
isPrimary
public static boolean isPrimary(float hue) -
isPrimary
public static boolean isPrimary(float hue, float variance) -
getHue
public float getHue() -
getName
-
isPrimary
public boolean isPrimary() -
toString
-