color#

Initializing the color Class#

A color is created by using one of the following constructors:

The color(r, g, b) constructor creates a color using rgb values:

Parameter

Description

r

An integer in the range 0 to 255 representing the red value.

g

An integer in the range 0 to 255 representing the green value.

b

An integer in the range 0 to 255 representing the blue value.

// Construct a yellow color "Yellow" with the color class 
// using rgb values.
color Yellow = color(255, 247, 0);

The color(value) constructor creates a color using rgb values:

Parameter

Description

value

A Hexcode or a predefined ColorType.

// Construct a yellow Color "yellow" with the Color class 
// using a Hexcode.
color Yellow = color(0xFFF700);

// Construct a yellow Color "yellow" with the Color class 
// using a predefined color.
color Yellow = color(yellow);

This Yellow object will be used in all subsequent examples throughout this API documentation when referring to Color class methods.

Class Methods#

hsv()#

The hsv(hue, saturation, value) method changes the existing color instance using hsv.

Parameters

Description

hue

An integer from 0 - 360 that represents the hue of the color.

saturation

A double from 0.0 - 1.0 that represents the saturation of the color.

value

A double from 0.0 - 1.0 that represents the brightness of the color.

Returns: An integer value representing the color.

// Change Yellow to a color that is red using HSV values.
Yellow.hsv(0, 1.0, 1.0);

web()#

The web(value) method changes the existing color instance using webstring.

Parameters

Description

value

The color value in web format.

Returns: An integer value representing the color.

// Change Yellow to a color that is red using a Hexcode.
Yellow.web("#ff0000");

isTransparent()#

The isTransparent() method returns if the color is transparent or not.

Returns: true if the color is transparent. false if it is not.

The Color.web(color) command creates a color using a hexadecimal value.

This is a non-blocking command and allows the next command to run without delay.

Parameters

Description

color

A hexadecimal or web color value that defines a specific color.

Returns: A reference to the new color.

// Create a color using a web color value.
Color color;
color.web("#00FF00");  // Green color