Interface Color
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintargb()Get the ARGB value of this color.static Colorargb(int argb) Creates a color from the specifiedargbvalue.static Colorargb(int alpha, int red, int green, int blue) Creates a color object from the specified rgb components@NotNull ColorInterpolate betweenthiscolor and the specifiedothercolor in HSV space.@NotNull ColorInterpolate betweenthiscolor and the specifiedothercolor.@NotNull Colorbrighten()Brighten the color by 25%.@NotNull Colorbrighten(@Range(from=0L,to=1L) float amount) Brighten the color.@NotNull Colordarken()Darken the color by 25%.@NotNull Colordarken(@Range(from=0L,to=1L) float amount) Darken the color.@Range(from=0L,to=255L) intgetAlpha()Get the alpha component.@Range(from=0L,to=255L) intgetBlue()Get the blue component.@Range(from=0L,to=255L) intgetGreen()Get the green component.@Range(from=0L,to=255L) intgetRed()Get the red component.Get the hex code representation of this color.float @NotNull []hsv()Get the HSV (Hue Saturation Value) color componentsstatic Colorhsv(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 Colorhsva(float hue, float saturation, float value, float alpha) Creates a color from the specified hue, saturation, value and alpha parametersstatic ColorInterpolates between multiple colors in HSV color space.static ColorInterpolates between multiple colors.@NotNull ColormultiplyArgb(float multiplier) Multiply the ARGB values by the specifiedmultiplier@NotNull ColormultiplyHsv(float multiplier) Convert the color to HSV and then multiply each component by the specifiedmultiplier@NotNull ColormultiplyHsv(float hue, float sat, float val) Convert the color to HSV and then multiply each component by the specified multiplier values@NotNull ColormultiplyRgb(float multiplier) Multiply the RGB values by the specifiedmultiplierintrgb()Get the RGB value of this color.static Colorrgb(int rgb) Creates a color from the specifiedrgbvalue.static Colorrgb(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_VALUEor greater thanMAX_VALUE.
-
rgb
Creates a color from the specifiedrgbvalue.- 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_VALUEor greater thanMAX_VALUE.
-
argb
Creates a color from the specifiedargbvalue.- 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
colorsarray is empty ornull, thennullis 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
colorsarray is empty ornull, thennullis 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
amountand 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
amountand 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 betweenthiscolor and the specifiedothercolor.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
-