Class PolyColor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPolyColor.AnimatedAn animatable version of Color, that supports recoloring with animations.
public final classPolyColor.GradientA gradient color.
public final classPolyColor.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 classPolyColor.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static PolyColorTRANSPARENTpublic final static PolyColorWHITEpublic final static PolyColorBLACKpublic final static Colors.PaletteTRANSPARENT_PALETTEprivate Floathueprivate Floatsaturationprivate Floatbrightnessprivate Floatalphaprivate transient Booleandirtyprivate transient Integerargbprivate final Integerrprivate final Integergprivate final Integerbprivate final Integerapublic final static PolyColor.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description PolyColor(FloatArray hsb, Integer alpha)PolyColor(FloatArray hsb)PolyColor(FloatArray hsb, Float alpha)PolyColor(Integer r, Integer g, Integer b, Integer alpha)PolyColor(Integer r, Integer g, Integer b)PolyColor(Integer r, Integer g, Integer b, Float alpha)PolyColor(Float hue, Float saturation, Float brightness, Integer alpha)PolyColor(Float hue, Float saturation, Float brightness, Float alpha)PolyColor(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()PolyColor.AnimatedtoAnimatable()PolyColorclone()Booleanequals(Object other)StringtoString()IntegerhashCode()final PolyColortake(PolyColor color)final static PolyColorfrom(String hex)Turn the given hex string into a color. final static PolyColorfrom(String hex, Integer alpha)final static PolyColorfrom(String hex, Float alpha)-
-
Constructor Detail
-
PolyColor
PolyColor(FloatArray hsb, Integer alpha)
-
PolyColor
PolyColor(FloatArray hsb)
-
PolyColor
PolyColor(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
PolyColor.Animated toAnimatable()
- Returns:
a new, animatable version of this color
-
from
final static PolyColor 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
-
-
-
-