Interface Color
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionint
argb()
Get the ARGB value of this color.static Color
argb
(int argb) Creates a color from the specifiedargb
value.static Color
argb
(int alpha, int red, int green, int blue) Creates a color object from the specified rgb components@NotNull Color
Interpolate betweenthis
color and the specifiedother
color in HSV space.@NotNull Color
Interpolate betweenthis
color and the specifiedother
color.@NotNull Color
brighten()
Brighten the color by 25%.@NotNull Color
brighten
(@Range(from=0L,to=1L) float amount) Brighten the color.@NotNull Color
darken()
Darken the color by 25%.@NotNull Color
darken
(@Range(from=0L,to=1L) float amount) Darken the color.@Range(from=0L,to=255L) int
getAlpha()
Get the alpha component.@Range(from=0L,to=255L) int
getBlue()
Get the blue component.@Range(from=0L,to=255L) int
getGreen()
Get the green component.@Range(from=0L,to=255L) int
getRed()
Get the red component.Get the hex code representation of this color.float @NotNull []
hsv()
Get the HSV (Hue Saturation Value) color componentsstatic Color
hsv
(float hue, float saturation, float value) Creates a color from the specified hue, saturation and value parametersfloat @NotNull []
hsva()
Get the HSVA (Hue Saturation Value Alpha) components.static Color
hsva
(float hue, float saturation, float value, float alpha) Creates a color from the specified hue, saturation, value and alpha parametersstatic Color
Interpolates between multiple colors in HSV color space.static Color
Interpolates between multiple colors.@NotNull Color
multiplyArgb
(float multiplier) Multiply the ARGB values by the specifiedmultiplier
@NotNull Color
multiplyHsv
(float multiplier) Convert the color to HSV and then multiply each component by the specifiedmultiplier
@NotNull Color
multiplyHsv
(float hue, float sat, float val) Convert the color to HSV and then multiply each component by the specified multiplier values@NotNull Color
multiplyRgb
(float multiplier) Multiply the RGB values by the specifiedmultiplier
int
rgb()
Get the RGB value of this color.static Color
rgb
(int rgb) Creates a color from the specifiedrgb
value.static Color
rgb
(int red, int green, int blue) Creates a color object from the specified rgb componentstoString()
Get the SCSS string that can be used to represent this string.
-
Field Details
-
MASK
static final int MASK8 bit, color channel mask- See Also:
-
MIN_VALUE
static final int MIN_VALUEMinimum color value- See Also:
-
MAX_VALUE
static final int MAX_VALUEMaximum color value- See Also:
-
-
Method Details
-
rgb
Creates a color object from the specified rgb components- Parameters:
red
- Red componentgreen
- Green componentblue
- Blue component- Returns:
- Created color
- Throws:
IllegalArgumentException
- If any color component is less thanMIN_VALUE
or greater thanMAX_VALUE
.
-
rgb
Creates a color from the specifiedrgb
value.- Parameters:
rgb
- RGB color data- Returns:
- Created color
-
argb
Creates a color object from the specified rgb components- Parameters:
alpha
- Alpha componentred
- Red componentgreen
- Green componentblue
- Blue component- Returns:
- Created color
- Throws:
IllegalArgumentException
- If any color component is less thanMIN_VALUE
or greater thanMAX_VALUE
.
-
argb
Creates a color from the specifiedargb
value.- Parameters:
argb
- ARGB color data- Returns:
- Created color
-
hsv
Creates a color from the specified hue, saturation and value parameters- Parameters:
hue
- Hue component (In range0..1
)saturation
- Saturation component (In range0..1
)value
- Value component (In range0..1
)- Returns:
- Created color
-
hsva
Creates a color from the specified hue, saturation, value and alpha parameters- Parameters:
hue
- Hue component (In range0..1
)saturation
- Saturation component (In range0..1
)value
- Value component (In range0..1
)alpha
- Alpha component (In range0..1
)- Returns:
- Created color
-
lerpRgb
Interpolates between multiple colors.If the
colors
array is empty ornull
, thennull
is returned. If only 1 color is specified, then that color is always returned. Otherwise, an interpolated color is returned.- Parameters:
progress
- Interpolation value (In range0..1
)colors
- Array of colors to interpolate between- Returns:
- Interpolated colors.
-
lerpHsv
Interpolates between multiple colors in HSV color space.If the
colors
array is empty ornull
, thennull
is returned. If only 1 color is specified, then that color is always returned. Otherwise, an interpolated color is returned.- Parameters:
progress
- Interpolation value (In range0..1
)colors
- Array of colors to interpolate between- Returns:
- Interpolated colors.
-
getAlpha
@Range(from=0L,to=255L) int getAlpha()Get the alpha component.- Returns:
- Alpha component
-
getRed
@Range(from=0L,to=255L) int getRed()Get the red component.- Returns:
- Red component
-
getGreen
@Range(from=0L,to=255L) int getGreen()Get the green component.- Returns:
- Green component
-
getBlue
@Range(from=0L,to=255L) int getBlue()Get the blue component.- Returns:
- Blue component
-
hsv
float @NotNull [] hsv()Get the HSV (Hue Saturation Value) color components- Returns:
- HSV Color components
-
hsva
float @NotNull [] hsva()Get the HSVA (Hue Saturation Value Alpha) components.- Returns:
- HSVA Color components
-
argb
int argb()Get the ARGB value of this color.Returned color bits:
0xAARRGGBB
- Returns:
- ARGB value
-
rgb
int rgb()Get the RGB value of this color.Returned color bits:
0x00RRGGBB
- Returns:
- RGB value
-
brighten
Brighten the color by 25%.Multiplies all channels by 25% and then adds that to the current value of the channel.
- Returns:
- Brightened color
- See Also:
-
brighten
Brighten the color.Multiplies all channels by the specified
amount
and then adds that to the current value of the channel.- Parameters:
amount
- Amount to brighten (In range0..1
)- Returns:
- Brightened color
-
darken
Darken the color by 25%.Multiplies all channels by 25% and then subtracts that from the current value of the channel.
- Returns:
- Darkened color.
- See Also:
-
darken
Darken the color.Multiplies all channels by the specified
amount
and then subtracts that from the current value of the channel.- Returns:
- Darkened color.
-
multiplyRgb
Multiply the RGB values by the specifiedmultiplier
- Parameters:
multiplier
- Multiplier- Returns:
- Multiplied color
-
multiplyArgb
Multiply the ARGB values by the specifiedmultiplier
- Parameters:
multiplier
- Multiplier- Returns:
- Multiplied color
-
multiplyHsv
Convert the color to HSV and then multiply each component by the specifiedmultiplier
- Parameters:
multiplier
- Multiplier- Returns:
- Multiplied color
-
multiplyHsv
Convert the color to HSV and then multiply each component by the specified multiplier values- Parameters:
hue
- Hue multipliersat
- Saturation multiplierval
- Value multiplier- Returns:
- Multiplied color
-
blendRgb
@NotNull @NotNull Color blendRgb(@Range(from=0L,to=1L) float progress, @NotNull @NotNull Color other) Interpolate betweenthis
color and the specifiedother
color.Interpolation is performed in RGB color space and is simply:
self + ((other - self) * progress)
- Parameters:
progress
- Interpolation value (In range0..1
)other
- Other color- Returns:
- Interpolated color
-
blendHsv
-
toString
String toString()Get the SCSS string that can be used to represent this string.If the string's value matches a named color (Named colors defined in
NamedColor
), then the name is returned. Otherwise, a hex string representing this color is returned. -
hexString
-