Package foundry.veil.api.client.color
Class Color
java.lang.Object
foundry.veil.api.client.color.Color
- All Implemented Interfaces:
Colorc
A representation of color as four floating point elements.
- Since:
- 1.0.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<Color> Allows ARGB components.static final com.mojang.serialization.Codec
<Integer> Allows ARGB components.static final Colorc
static final Colorc
static final Colorc
static final Colorc
static final com.mojang.serialization.Codec
<Color> Allows only RGB components with a full alpha component.static final com.mojang.serialization.Codec
<Integer> Allows only RGB components with a full alpha component.static final Colorc
static final Colorc
static final Colorc
static final Colorc
static final Colorc
-
Constructor Summary
ConstructorsConstructorDescriptionColor()
Creates a new black color with full alpha.Color
(float red, float green, float blue) Sets the red, green, and blue components of this color.Color
(float red, float green, float blue, float alpha) Sets the red, green, blue, and alpha components of this color.Color
(int rgb) Creates a new color with the specified RGB values.Color
(int color, boolean alpha) Creates a new color with the specified ARGB values.Copies the color from the specified color. -
Method Summary
Modifier and TypeMethodDescriptionfloat
alpha()
alpha
(float alpha) Sets the value of the alpha component.alphaInt
(int alpha) Sets the value of the alpha component from0
to255
.float
blue()
blue
(float blue) Sets the value of the blue component.blueInt
(int blue) Sets the value of the blue component from0
to255
.darken
(float amount) Mixes this color with black to "darken" it.boolean
Applies a grayscale filter to this color.float
green()
green
(float green) Sets the value of the green component.greenInt
(int green) Sets the value of the green component from0
to255
.int
hashCode()
invert()
Inverts this color.Linearly interpolates between this color and the specified color.lighten
(float amount) Mixes this color with white to "brighten" it.Mixes this color with the specified color.float
red()
red
(float red) Sets the value of the red component.redInt
(int red) Sets the value of the red component from0
to255
.sepia()
Applies a sepia filter to this color.set
(float red, float green, float blue) Sets the red, green, and blue components of this color.set
(float red, float green, float blue, float alpha) Sets the red, green, blue, and alpha components of this color.setARGB
(int argb) Sets the red, green, blue, and alpha components of this color to the specified value.setHSV
(float hue, float saturation, float luminance) Converts the specified hue, saturation, and luminance values (HSV) to RGB.setHue
(float hue) Converts the specified hue value (HSV) to RGB.setInt
(int red, int green, int blue) Sets the red, green, and blue components of this color as ints from0
to255
.setInt
(int red, int green, int blue, int alpha) Sets the red, green, blue, and alpha components of this color as ints from0
to255
.setLuminance
(float luminance) Converts the specified luminance value (HSV) to RGB.setRGB
(int rgb) Sets the red, green, and blue components of this color to the specified value.setSaturation
(float saturation) Converts the specified saturation value (HSV) to RGB.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface foundry.veil.api.client.color.Colorc
alphaInt, argb, blueInt, darken, grayscale, greenInt, hue, invert, lerp, lighten, luminance, maxComponent, minComponent, mix, redInt, rgb, saturation, sepia, setHSV, setHue, setLuminance, setSaturation
-
Field Details
-
RGB_INT_CODEC
Allows only RGB components with a full alpha component. -
ARGB_INT_CODEC
Allows ARGB components. -
RGB_CODEC
Allows only RGB components with a full alpha component. -
ARGB_CODEC
Allows ARGB components. -
WHITE
-
BLACK
-
RED
-
GREEN
-
BLUE
-
TRANSPARENT
-
VANILLA_TOOLTIP_BACKGROUND
-
VANILLA_TOOLTIP_BORDER_TOP
-
VANILLA_TOOLTIP_BORDER_BOTTOM
-
-
Constructor Details
-
Color
public Color()Creates a new black color with full alpha. -
Color
public Color(int rgb) Creates a new color with the specified RGB values.- Parameters:
rgb
- The color values formatted as RRGGBB- See Also:
-
Color
public Color(int color, boolean alpha) Creates a new color with the specified ARGB values.- Parameters:
color
- The color values formatted as AARRGGBBalpha
- Whether the color values contain an alpha component
-
Color
public Color(float red, float green, float blue) Sets the red, green, and blue components of this color.- Parameters:
red
- The red amountgreen
- The green amountblue
- The blue amount
-
Color
public Color(float red, float green, float blue, float alpha) Sets the red, green, blue, and alpha components of this color.- Parameters:
red
- The red amountgreen
- The green amountblue
- The blue amountalpha
- The alpha amount
-
Color
Copies the color from the specified color.- Parameters:
copy
- The color to copy from
-
-
Method Details
-
red
Sets the value of the red component.- Parameters:
red
- The new red value- Returns:
- This color
-
green
Sets the value of the green component.- Parameters:
green
- The new green value- Returns:
- This color
-
blue
Sets the value of the blue component.- Parameters:
blue
- The new blue value- Returns:
- This color
-
alpha
Sets the value of the alpha component.- Parameters:
alpha
- The new alpha value- Returns:
- This color
-
redInt
Sets the value of the red component from0
to255
.- Parameters:
red
- The new red value- Returns:
- This color
-
greenInt
Sets the value of the green component from0
to255
.- Parameters:
green
- The new green value- Returns:
- This color
-
blueInt
Sets the value of the blue component from0
to255
.- Parameters:
blue
- The new blue value- Returns:
- This color
-
alphaInt
Sets the value of the alpha component from0
to255
.- Parameters:
alpha
- The new alpha value- Returns:
- This color
-
set
Sets the red, green, and blue components of this color.- Parameters:
red
- The new red amountgreen
- The new green amountblue
- The new blue amount- Returns:
- This color
-
set
Sets the red, green, blue, and alpha components of this color.- Parameters:
red
- The new red amountgreen
- The new green amountblue
- The new blue amountalpha
- The new alpha amount- Returns:
- This color
-
setInt
Sets the red, green, and blue components of this color as ints from0
to255
.- Parameters:
red
- The new red amountgreen
- The new green amountblue
- The new blue amount- Returns:
- This color
-
setInt
Sets the red, green, blue, and alpha components of this color as ints from0
to255
.- Parameters:
red
- The new red amountgreen
- The new green amountblue
- The new blue amountalpha
- The new alpha amount- Returns:
- This color
-
setRGB
Sets the red, green, and blue components of this color to the specified value.- Parameters:
rgb
- The color values formatted as RRGGBB- Returns:
- This color
-
setARGB
Sets the red, green, blue, and alpha components of this color to the specified value.- Parameters:
argb
- The color values formatted as AARRGGBB- Returns:
- This color
-
red
public float red() -
green
public float green() -
blue
public float blue() -
alpha
public float alpha() -
lerp
Linearly interpolates between this color and the specified color.- Parameters:
other
- The other color to store indelta
- The delta from 0 to 1- Returns:
- This color
-
mix
Mixes this color with the specified color.- Parameters:
color
- The color to mix withamount
- The amount of that color to mix from 0 to 1- Returns:
- This color
-
lighten
Mixes this color with white to "brighten" it.- Parameters:
amount
- The amount of white to add- Returns:
- This color
-
darken
Mixes this color with black to "darken" it.- Parameters:
amount
- The amount of black to add- Returns:
- This color
-
invert
Inverts this color.- Returns:
- This color
-
grayscale
Applies a grayscale filter to this color.- Returns:
- The passed in color
-
sepia
Applies a sepia filter to this color.- Returns:
- The passed in color
-
setHue
Converts the specified hue value (HSV) to RGB.- Parameters:
hue
- The hue angle from 0 to 360 degrees- Returns:
- This color
-
setSaturation
Converts the specified saturation value (HSV) to RGB.- Parameters:
saturation
- The saturation percentage from 0 to 1- Returns:
- This color
-
setLuminance
Converts the specified luminance value (HSV) to RGB.- Parameters:
luminance
- The brightness percentage from 0 to 1- Returns:
- This color
-
setHSV
Converts the specified hue, saturation, and luminance values (HSV) to RGB.- Parameters:
hue
- The hue angle from 0 to 360 degreessaturation
- The saturation percentage from 0 to 1luminance
- The brightness percentage from 0 to 1- Returns:
- This color
-
equals
-
hashCode
public int hashCode()
-