Class Colors

Nested Relationships

Nested Types

Class Documentation

class Colors

Public Types

enum MixMode

Determines the blending algorithm used when mixing two colors.

Values:

None

Do not mix the colors.

Alpha

Mixes both colors with a specific blend percentage (blending is applied to the Layer).

Multiply

Multiplies the base color by the layered color.

Overlay

Only draws the layered color if it’s not black. Black pixels are rendered transparent.

Public Static Functions

void generate_comet(RGB *array, uint8_t array_size, RGB &start_color, RGB &end_color, uint8_t comet_start, uint8_t comet_length)

Generates a comet with a tail.

Parameters
  • array: The array to populate.

  • array_size: The size of the array.

  • body_color: The color of the comet’s body.

  • tail_color: The color that the comet fades to.

  • comet_start: How far the comet body is from the start of the array.

  • comet_length: The length of the comet from body to tail.

Colors::RGB generate_random_color()

Creates a random color.

Return

Random color.

void generate_random_color_array(RGB *array, uint8_t num_colors)

Creates a randomly generated array of colors.

Parameters
  • array: The array to populate.

  • num_colors: The number of colors to generate.

void generate_scaling_color_array(RGB *array, RGB &base_color, RGB &target_color, uint8_t num_colors, bool mirror = false)

Creates an array of colors that gradually blend from a base color to a target color.

Parameters
  • array: The array to populate.

  • base_color: The initial color.

  • target_color: The target color.

  • num_colors: Number of colors in the array.

  • mirror: If true, the array will be mirrored from the target color back to the base color.

Colors::RGB mix_colors(const RGB &color_one, const RGB &color_two, MixMode mode, uint8_t alpha = 0)

Mixes two colors.

Return

The mixed color.

Parameters
  • color_one: The first color to mix.

  • color_two: The second color to mix.

  • mode: The type of mixing to perform.

  • alpha: Color two alpha factor (0 - 255).

struct RGB

Stores an RGB definition of a color.

Public Functions

RGB(uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0)

Constructor. Defaults to black if no other parameters are provided.

Parameters
  • red: Red value.

  • green: Green value.

  • blue: Blue value.

RGB(const RGB &other)

Copy constructor.

Parameters
  • other: RGB to copy.

void operator=(RGB color_two)
bool operator==(RGB color_two) const
bool operator!=(RGB color_two) const
RGB operator*(float multiplier) const

Public Members

uint8_t r

The color’s red value.

uint8_t g

The color’s green value.

uint8_t b

The color’s blue value.