Struct Palette

Nested Relationships

Inheritance Relationships

Derived Types

Struct Documentation

struct Palette

Abstract class for representing collections of const colors Optionally, an enum can be added to sub-classes to allow them to be accessed via a name

Subclassed by Stock::Palettes::Dark2, Stock::Palettes::Greys, Stock::Palettes::Pastel, Stock::Palettes::PiYG, Stock::Palettes::RdYlBu, Stock::Palettes::Set1, Stock::Palettes::Set2, Stock::Palettes::Viridis, Stock::Palettes::YlGn, Stock::Palettes::YlOrRd

Public Types

enum Category

The possibles types of palette Qualitative: Distinct/unrelated colours Sequential: Colors in a sequential order, usually best treated as ordering low to high Diverging: Colors that are ordered such towards a central midpoint


enumerator Qualitative
enumerator Sequential
enumerator Diverging

Public Functions

virtual ~Palette() = default

Default virtual destructor

inline const Color &operator[](size_t i) const

Access the members of the palette as an array


i – Index of the desired element, i must be less than size()

inline size_t size() const

Returns the number of colors in the palette

inline const_iterator begin() const

Returns an iterator to the first item in the palette

inline const_iterator end() const

Returns an iterator to after the last item in the palette

inline bool operator==(const Palette &other) const

Compares two palettes for equality (whether they contain the same colors)

virtual bool getColorBlindFriendly() const = 0

Returns whether the palette is confirmed as suitable for colorblind viewers

virtual Category getCategory() const = 0

Returns the category of the palette



Protected Functions

virtual const std::vector<Color> &colors() const = 0


friend class AutoPalette
class const_iterator : public std::iterator<std::input_iterator_tag, const Color>

Basic iterator that provides constant access to a palettes colors.

Public Functions

inline const_iterator(const Palette &_palette, difference_type _pos)
inline const_iterator &operator++()
inline const_iterator operator++(int)
inline bool operator==(const_iterator other) const
inline bool operator!=(const_iterator other) const
inline const Color &operator*() const