33template <SupportsTransparency ColorType>
62 void add(ColorType color)
64 colors_.push_back(color);
76 void set(ColorType color, std::size_t index)
78 if (index >=
size()) {
79 panic(
"index " + std::to_string(index) +
" >= size " + std::to_string(
size()));
81 colors_.at(index) = color;
89 [[nodiscard]] std::size_t
size()
const
91 return colors_.size();
99 [[nodiscard]]
const std::vector<ColorType> &
colors()
const
105 std::vector<ColorType> colors_;
A palette container for colors that support transparency checking.
const std::vector< ColorType > & colors() const
Returns a const reference to the internal color vector.
std::size_t size() const
Returns the number of colors in the palette.
void set(ColorType color, std::size_t index)
Sets the color at a specific index in the palette.
void add(ColorType color)
Adds a color to the end of the palette.
Palette(ColorType color)
Constructs a palette filled with a single color.
constexpr std::size_t max_size
constexpr std::size_t num_pals
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.