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.
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 |
---|---|
|
A six-digit integer in hexadecimal format (e.g., |
# Example coming soon
RGB#
Creates a color using separate red, green, and blue values.
Usage:
Color(r, g, b)
Parameter |
Description |
---|---|
|
An integer from 0 to 255 representing the red component. |
|
An integer from 0 to 255 representing the green component. |
|
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 |
---|---|
|
A web color as a string (hex code) (e.g., |
# Example coming soon
Predefined Color#
Creates a color using a predefined Color
constant.
Usage:
Color(value)
Parameter |
Description |
---|---|
|
A built-in color constant: |
# 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 |
---|---|
|
An integer from 0 to 255 representing the red component of the color. |
|
An integer from 0 to 255 representing the green component of the color. |
|
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 |
---|---|
|
An integer from 0 to 360 representing the hue of the color. |
|
A float from 0.0 to 1.0 representing the saturation of the color. |
|
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 |
---|---|
|
A web color (hex code) as a string used to update the existing color instance. |
# Example coming soon