1 #ifndef TERMOX_PAINTER_COLOR_HPP
2 #define TERMOX_PAINTER_COLOR_HPP
10 #include <esc/color_index.hpp>
11 #include <esc/true_color.hpp>
18 using Value_t = std::uint8_t;
44 constexpr
Color(Name n) : value{
static_cast<Value_t
>(n)} {}
46 explicit constexpr
Color(Value_t v) : value{v} {}
49 [[nodiscard]]
auto constexpr operator==(
Color x,
Color y) ->
bool
51 return x.value == y.value;
54 [[nodiscard]]
auto constexpr operator!=(Color x, Color y) ->
bool
59 [[nodiscard]]
auto constexpr operator<(Color x, Color y) ->
bool
61 return x.value < y.value;
79 [[nodiscard]]
auto constexpr fg(Color c) -> Foreground_color
87 using Color_index = ::esc::Color_index;
92 using RGB = ::esc::RGB;
95 using HSL = ::esc::HSL;
99 using True_color = ::esc::True_color;
106 using Period_t = std::chrono::milliseconds;
108 std::function<True_color()> get_value;
116 using Value_t = std::variant<Color_index, True_color, Dynamic_color>;
126 using Palette = std::vector<Color_definition>;
131 template <
typename... ColorValues>
132 [[nodiscard]]
static auto make_palette(ColorValues... values) -> Palette
134 auto c = Color::Value_t{0};
135 return {Color_definition{Color{c++}, values}...};
141 [[nodiscard]]
auto color_to_string(Color c) -> std::string;
Color numbers [0 - 180] are valid.
Definition: color.hpp:16
Used to define a single color for a Palette.
Definition: color.hpp:114
Defines an animated color.
Definition: color.hpp:105