Class PortableColor
java.lang.Object
com.thecoderscorner.menu.domain.state.PortableColor
A portable color that represents a color in the RGBA space with single byte values for each entry (between 0..255).
It can convert to and from web color format strings.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPortableColor(int red, int green, int blue) Create a color from RGB with alpha set to full (255), each value from 0 to 255PortableColor(int red, int green, int blue, int alpha) Create a color from RGBA using values from 0 to 255PortableColor(String htmlCode) Create a color object from a web color code such as #FFFFFF -
Method Summary
-
Field Details
-
BLACK
-
-
Constructor Details
-
PortableColor
public PortableColor(int red, int green, int blue) Create a color from RGB with alpha set to full (255), each value from 0 to 255- Parameters:
red- the red componentgreen- the green componentblue- the blue component
-
PortableColor
public PortableColor(int red, int green, int blue, int alpha) Create a color from RGBA using values from 0 to 255- Parameters:
red- the red componentgreen- the green componentblue- the blue componentalpha- the alpha
-
PortableColor
Create a color object from a web color code such as #FFFFFF- Parameters:
htmlCode- the html code
-
-
Method Details
-
getRed
public int getRed()- Returns:
- red component between 0 and 255
-
getGreen
public int getGreen()- Returns:
- green component between 0 and 255
-
getBlue
public int getBlue()- Returns:
- blue component between 0 and 255
-
getAlpha
public int getAlpha()- Returns:
- alpha component between 0 and 255
-
toString
-
equals
-
hashCode
public int hashCode()
-