Color - CreedVI/Raylib-J GitHub Wiki

The Color class is used to create a custom Color data structure or to use a statically predefined Color.

Constructors:

Color()

Color myColour = new Color();

Results in a Color with an RGBA value of 0, 0, 0, 255.


Color(int r, int g, int b, int a)

Color myColour = new Color(66,66,66 255);

Results in a Color with an RGBA value of 66, 66, 66, 255.

Methods

toString()- Returns String of the RGBA

Color myColour = new Color(66,66,66, 255);
myColour.toString();

Returns a String with a value of 66, 66, 66, 255


getR()- Returns the value of R

Color myColour = new Color(66,66,66, 255);
myColour.getR();

Returns 66.


getG()- Returns the value of G

Color myColour = new Color(42,44,77, 255);
myColour.getG();

Returns 44.


getB()- Returns the value of B

Color myColour = new Color(53,67,55, 255);
myColour.getB();

Returns 55.


getA()- Returns the value of A

Color myColour = new Color(66,66,66, 255);
myColour.getA();

Returns 255.


setR()

myColor.setR(55);

Sets the value of R to 55


setG()

myColor.setG(33);

Sets the value of G to 33


setB()

myColor.setB(97);

Sets the value of B to 97


setA()

myColor.setA(21);

Sets the value of A to 21

Predefined Colors

Name RGBA
LIGHTGRAY 200, 200, 200, 255
GRAY 130, 130, 130, 255
DARKGRAY 80, 80, 80, 255
YELLOW 253, 249, 0, 255
GOLD 255, 203, 0, 255
ORANGE 255, 161, 0, 255
PINK 255, 109, 194, 255
RED 230, 41, 55, 255
MAROON 190, 33, 55, 255
GREEN 0, 228, 48, 255
LIME 0, 158, 47, 255
DARKGREEN 0, 117, 44, 255
SKYBLUE 102, 191, 255, 255
BLUE 0, 121, 241, 255
DARKBLUE 0, 82, 172, 255
PURPLE 200, 122, 255, 255
VIOLET 135, 60, 190, 255
DARKPURPLE 112, 31, 126, 255
BEIGE 211, 176, 131, 255
BROWN 127, 106, 79, 255
DARKBROWN 76, 63, 47, 255
WHITE 255, 255, 255, 255
BLACK 0, 0, 0, 255
BLANK 0, 0, 0, 0
MAGENTA 255, 0, 255, 255
RAYWHITE 245, 245, 245, 255