Package dev.prozilla.pine.common.system
Class Color
java.lang.Object
dev.prozilla.pine.common.system.Color
- All Implemented Interfaces:
Cloneable<Color>,Printable,Transceivable<Color>,Transmittable<Color>
- Direct Known Subclasses:
Colour
Represents an RGBA color.
-
Constructor Summary
ConstructorsConstructorDescriptionColor()The default color is black.Color(float red, float green, float blue) Creates an RGB-Color with an alpha value of 1.Color(float red, float green, float blue, float alpha) Creates an RGBA-Color.Color(int red, int green, int blue) Creates an RGB-Color with an alpha value of 1.Color(int red, int green, int blue, int alpha) Creates an RGBA-Color.Creates an RGB-Color from a java.awt.Color instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic Coloraqua()static Colorblack()static Colorblue()clone()Returns a new object that is equal to this object.static Colorcyan()static ColordarkBlue()static ColordarkCyan()static ColordarkGray()static Colorstatic Colorstatic Colorstatic ColordarkRed()static ColorDecodes aStringinto aColor.static ColordimGray()booleanChecks if two colors are equal.booleanfloatgetAlpha()Returns the transparency.floatgetBlue()Returns the blue component.floatgetGreen()Returns the green component.floatgetRed()Returns the red component.static Colorgold()static Colorgray()static Colorgreen()inthashCode()static Colorhsl(float hue, float saturation, float lightness) Source: HSL to RGB color conversionstatic Colorhsl(int hue, int saturation, int lightness) static Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorlime()static Colormagenta()static Colormaroon()static Colorstatic ColorMixes half of this color with half of another color.Mixes this color with another color based on a factor.multiply(float scalar) static Colornavy()static Colorolive()static Colororange()static Colorstatic ColorDeprecated.static Colorpink()static Colorpurple()static Colorstatic Colorred()self()set(float red, float green, float blue, float alpha) set(int red, int green, int blue, int alpha) setAlpha(float alpha) Sets the transparency.setAlpha(int alpha) Sets the transparency.setBlue(float blue) Sets the blue component.setBlue(int blue) Sets the blue component.setGreen(float green) Sets the green component.setGreen(int green) Sets the green component.setRed(float red) Sets the red component.setRed(int red) Sets the red component.setRGB(float red, float green, float blue) setRGB(int red, int green, int blue) static Colorsilver()static ColorskyBlue()static Colorstatic Colorteal()toColour()static Colortomato()toString()Returns a string representation of this object.Returns the color as a (x,y,z)-Vector.Returns the color as a (x,y,z,w)-Vector.voidTransmits this object's data to a given target object.static Colorstatic Colorstatic Colorviolet()static Colorwhite()static Colorstatic Coloryellow()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.Transceivable
receive
-
Constructor Details
-
Color
public Color()The default color is black. -
Color
Creates an RGB-Color from a java.awt.Color instance.- Parameters:
color- Color instance
-
Color
public Color(float red, float green, float blue) Creates an RGB-Color with an alpha value of 1.- Parameters:
red- The red component. Range from 0f to 1f.green- The green component. Range from 0f to 1f.blue- The blue component. Range from 0f to 1f.
-
Color
public Color(float red, float green, float blue, float alpha) Creates an RGBA-Color.- Parameters:
red- The red component. Range from 0f to 1f.green- The green component. Range from 0f to 1f.blue- The blue component. Range from 0f to 1f.alpha- The transparency. Range from 0f to 1f.
-
Color
public Color(int red, int green, int blue) Creates an RGB-Color with an alpha value of 1.- Parameters:
red- The red component. Range from 0 to 255.green- The green component. Range from 0 to 255.blue- The blue component. Range from 0 to 255.
-
Color
public Color(int red, int green, int blue, int alpha) Creates an RGBA-Color.- Parameters:
red- The red component. Range from 0 to 255.green- The green component. Range from 0 to 255.blue- The blue component. Range from 0 to 255.alpha- The transparency. Range from 0 to 255.
-
-
Method Details
-
transmit
Description copied from interface:TransmittableTransmits this object's data to a given target object.- Specified by:
transmitin interfaceTransmittable<Color>- Parameters:
target- the target object to which data will be transmitted
-
setRGB
-
set
-
set
-
setRGB
-
setRGB
-
getRed
public float getRed()Returns the red component. Range from 0f to 1f.- Returns:
- The red component.
-
setRed
Sets the red component.- Parameters:
red- The red component. Range from 0f to 1f.
-
setRed
Sets the red component.- Parameters:
red- The red component. Range from 0 to 255.
-
getGreen
public float getGreen()Returns the green component. Range from 0f to 1f.- Returns:
- The green component.
-
setGreen
Sets the green component.- Parameters:
green- The green component. Range from 0f to 1f.
-
setGreen
Sets the green component.- Parameters:
green- The green component. Range from 0 to 255.
-
getBlue
public float getBlue()Returns the blue component. Range from 0f to 1f.- Returns:
- The blue component.
-
setBlue
Sets the blue component.- Parameters:
blue- The blue component. Range from 0f to 1f.
-
setBlue
Sets the blue component.- Parameters:
blue- The blue component. Range from 0 to 255.
-
getAlpha
public float getAlpha()Returns the transparency. Range from 0f to 1f.- Returns:
- The transparency.
-
setAlpha
Sets the transparency.- Parameters:
alpha- The transparency. Range from 0f to 1f.
-
setAlpha
Sets the transparency.- Parameters:
alpha- The transparency. Range from 0 to 255.
-
multiply
-
mix
Mixes half of this color with half of another color.- Parameters:
color- Color to mix with this color
-
mix
Mixes this color with another color based on a factor.- Parameters:
color- Color to mix with this colorfactor- Mixing factor, Range from 0f to 1f.
-
toVector3f
Returns the color as a (x,y,z)-Vector.- Returns:
- The color as vec3.
-
toVector4f
Returns the color as a (x,y,z,w)-Vector.- Returns:
- The color as vec4.
-
toColour
-
self
- Specified by:
selfin interfaceTransceivable<Color>
-
equals
-
equals
Checks if two colors are equal. Two colors are equal if they share the same R, G, B and A values. -
hashCode
public int hashCode() -
clone
Description copied from interface:CloneableReturns a new object that is equal to this object. -
toString
Description copied from interface:PrintableReturns a string representation of this object. -
hsl
-
hsl
Source: HSL to RGB color conversion -
decode
Decodes aStringinto aColor. Supports octal and hexadecimal number representations of opaque and transparent colors.- Parameters:
input- String that represents a color as a 24-bit or 32-bit integer- Returns:
- Color
- Throws:
NumberFormatException- If the string cannot be decoded.
-
parse
Deprecated.Replaced byColorParseras of 1.2.0 -
white
-
black
-
red
-
green
-
blue
-
transparent
-
aqua
-
cyan
-
darkBlue
-
darkCyan
-
darkGray
-
darkGreen
-
darkMagenta
-
darkOrange
-
darkRed
-
dimGray
-
gold
-
gray
-
lightBlue
-
lightCyan
-
lightGray
-
lightGreen
-
lightYellow
-
lime
-
magenta
-
maroon
-
mediumBlue
-
mintCream
-
olive
-
orange
-
orangeRed
-
pink
-
purple
-
rebeccaPurple
-
silver
-
skyBlue
-
springGreen
-
teal
-
tomato
-
turquoise
-
violet
-
whiteSmoke
-
yellow
-
ColorParseras of 1.2.0