Class Color
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classColor.AnimatedAn animatable version of Color, that supports recoloring with animations.
public final classColor.GradientA gradient color.
public final classColor.ChromaA color that changes over time, in an endless cycle. You can use the saturation and brightness fields to set the tone of the chroma. Some examples:
brightness = 0.2f, saturation = 0.8f-> dark chromabrightness = 0.8f, saturation = 0.8f-> less offensive chroma tonepublic classColor.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static ColorTRANSPARENTpublic final static ColorWHITEpublic final static ColorBLACKpublic final static Colors.PaletteTRANSPARENT_PALETTEprivate Floathueprivate Floatsaturationprivate Floatbrightnessprivate Floatalphaprivate transient Booleandirtyprivate transient Integerargbprivate final Integerrprivate final Integergprivate final Integerbprivate final Integerapublic final static Color.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description Color(FloatArray hsb, Integer alpha)Color(FloatArray hsb)Color(FloatArray hsb, Float alpha)Color(Integer r, Integer g, Integer b, Integer alpha)Color(Integer r, Integer g, Integer b)Color(Integer r, Integer g, Integer b, Float alpha)Color(Float hue, Float saturation, Float brightness, Integer alpha)Color(Float hue, Float saturation, Float brightness, Float alpha)Color(Float hue, Float saturation, Float brightness)
-
Method Summary
Modifier and Type Method Description final FloatgetHue()final UnitsetHue(Float hue)final FloatgetSaturation()final UnitsetSaturation(Float saturation)final FloatgetBrightness()final UnitsetBrightness(Float brightness)final FloatgetAlpha()final UnitsetAlpha(Float alpha)final BooleangetDirty()Set this to true to update the argb value. final UnitsetDirty(Boolean dirty)Set this to true to update the argb value. final IntegergetARGB()final UnitsetArgb(Integer argb)return an integer representation of this color. final IntegergetR()final IntegergetG()final IntegergetB()final IntegergetA()Color.AnimatedtoAnimatable()Colorclone()Booleanequals(Object other)StringtoString()IntegerhashCode()final Colortake(Color color)final static Colorfrom(String hex)Turn the given hex string into a color. final static Colorfrom(String hex, Integer alpha)final static Colorfrom(String hex, Float alpha)-
-
Constructor Detail
-
Color
Color(FloatArray hsb, Integer alpha)
-
Color
Color(FloatArray hsb)
-
Color
Color(FloatArray hsb, Float alpha)
-
-
Method Detail
-
getSaturation
final Float getSaturation()
-
setSaturation
final Unit setSaturation(Float saturation)
-
getBrightness
final Float getBrightness()
-
setBrightness
final Unit setBrightness(Float brightness)
-
setArgb
final Unit setArgb(Integer argb)
return an integer representation of this color. Utilizes bit-shifts to store the color as one 32-bit integer, like so:
0bAAAAAAAARRRRRRRRGGGGGGGGBBBBBBBBaka0xAARRGGBB
-
toAnimatable
Color.Animated toAnimatable()
- Returns:
a new, animatable version of this color
-
from
final static Color from(String hex)
Turn the given hex string into a color.
If it is 8 characters long, it is assumed to be in the format
#RRGGBBAA(alpha optional)If there is a leading
#, it will be removed.If it is 1 character long, the character is repeated e.g.
#f->#ffffffIf it is 2 characters long, the character is repeated e.g.
#0f->#0f0f0fIf it is 3 characters long, the character is repeated e.g.
#0fe->#00ffee
-
-
-
-