Class Palette

Class Documentation

class Palette

Public Functions

Palette(const Colors::RGB colors[], uint8_t size)

Constructor. Sets the Palette’s colors.

Parameters
  • colors: Source color array.

  • size: Number of colors in the array.

Palette(const Palette &other)

Copy constructor.

Parameters

Palette &operator=(const Palette &other)

Copy assignment operator.

Return

New Palette.

Parameters

~Palette()
Colors::RGB &get_color_at_index(uint8_t index) const

Returns the color at the specified index. If the index exceeds the size of the color palette, the index wraps around to the start of the array and counts the remainder. For example, if the Section has 10 Pixels and 5 Colors, the Pixel at index 7 will use the color at index 2 (7 % 5 == 2). Used mainly to determine which color a Pixel should use during an animation based on where it is in the array.

Return

Color at the specified index.

Parameters
  • index: Desired index.

Colors::RGB *get_colors() const

Returns the colors used in the Palette.

Return

Palette colors.

uint8_t get_num_colors() const

Returns the number of colors in the Palette.

Return

Palette size.

void set_colors(const Colors::RGB colors[], uint8_t num_colors)

Swaps the palette’s color scheme.

Parameters
  • colors: New colors.

  • size: New size.