Package org.polyfrost.polyui.color
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.
-
Field Summary
Fields Modifier and Type Field Description public final static PolyColorTRANSPARENTpublic final static PolyColorWHITEpublic final static PolyColorBLACKprivate Floathueprivate Floatsaturationprivate Floatbrightnessprivate Floatalphaprivate transient Booleandirtyprivate final transient Integerargbprivate final Booleantransparentprivate final Integerrprivate final Integergprivate final Integerbprivate final Integera
-
Constructor Summary
Constructors Constructor Description PolyColor(FloatArray hsb, Float alpha)PolyColor(FloatArray hsb)PolyColor(IntArray rgba)PolyColor(Integer r, Integer g, Integer b, Float alpha)PolyColor(Integer r, Integer g, Integer b)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()The hue of this color. final UnitsetHue(Float hue)final FloatgetSaturation()The saturation of this color. final UnitsetSaturation(Float saturation)final FloatgetBrightness()The brightness of this color. final UnitsetBrightness(Float brightness)final FloatgetAlpha()The alpha of this color. 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()BooleangetTransparent()final Integerred()final Integergreen()final Integerblue()final Integeralpha()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)final static StringhexOf(PolyColor color, Boolean alpha, Boolean hash)-
-
Constructor Detail
-
PolyColor
PolyColor(FloatArray hsb, Float alpha)
-
PolyColor
PolyColor(FloatArray hsb)
-
PolyColor
PolyColor(IntArray rgba)
-
-
Method Detail
-
getHue
final Float getHue()
The hue of this color. Can be any value, but is
mod 360, so values are always between 0 and 360.
-
getSaturation
final Float getSaturation()
The saturation of this color. Clamped between
0f..1f.
-
setSaturation
final Unit setSaturation(Float saturation)
-
getBrightness
final Float getBrightness()
The brightness of this color. Clamped between
0f..1f.
-
setBrightness
final Unit setBrightness(Float brightness)
-
getTransparent
Boolean getTransparent()
-
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
-
-
-
-