Custom Colors#

Introduction#

The VEX AIR Drone supports the use of custom colors for drawing, display, and its LEDs. Custom colors can be created using RGB values, hex codes, HSV values, or predefined constants. Custom Colors includes methods for both creating and updating color objects. Below is a list of available methods:

Constructors – Create a new Color object.

  • Color(value) – Accepts a predefined constant, hex string (e.g. "#FFF700"), or hex integer (e.g. 0xFFF700).

  • Color(r, g, b) – Creates a color using red, green, and blue values (0–255).

Mutators – Update an existing Color object.

  • rgb – Updates a color using new RGB values.

  • hsv – Updates a color using hue (0–360), saturation, and brightness (0.0–1.0).

  • web – Updates a color using a web hex color string (e.g. "#32C8B6").

Creating a Custom Color#

To use a custom color, you must first create a Color object using one of the following constructors:

Hexadecimal Integer#

Creates a color using a six-digit hexadecimal integer.

Usage:
Color(value)

Parameter

Description

value

A six-digit integer in hexadecimal format (e.g., 0xFFF700 for yellow).

# Example coming soon

RGB#

Creates a color using separate red, green, and blue values.

Usage:
Color(r, g, b)

Parameter

Description

r

An integer from 0 to 255 representing the red component.

g

An integer from 0 to 255 representing the green component.

b

An integer from 0 to 255 representing the blue component.

# Example coming soon

Web Color#

Creates a color using a web color string (hex code).

Usage:
Color(value)

Parameter

Description

value

A web color as a string (hex code) (e.g., "#FFF700").

# Example coming soon

Predefined Color#

Creates a color using a predefined Color constant.

Usage:
Color(value)

Parameter

Description

value

A built-in color constant:
BLACK, BLUE, CYAN, GREEN, ORANGE, PURPLE, RED, TRANSPARENT, WHITE, YELLOW.

# Example coming soon

Mutators#

These methods allow you to modify a Color object after it has been created during a project.

rgb#

rgb updates the color of an existing Color object using RGB values.

Usage:
rgb(r, g, b)

Parameters

Description

r

An integer from 0 to 255 representing the red component of the color.

g

An integer from 0 to 255 representing the green component of the color.

b

An integer from 0 to 255 representing the blue component of the color.

# Example coming soon

hsv#

hsv updates the color of an existing Color object using HSV values.

Note: hsv can only be used to change a Color object that has already been created. It cannot be used to create a new Color Object.

Usage:
hsv(h, s, v)

Parameters

Description

h

An integer from 0 to 360 representing the hue of the color.

s

A float from 0.0 to 1.0 representing the saturation of the color.

v

A float from 0.0 to 1.0 representing the brightness of the color.

# Example coming soon

web#

web updates the color of an existing Color object using a web color (hex code).

Usage:
web(value)

Parameters

Description

value

A web color (hex code) as a string used to update the existing color instance.

# Example coming soon