11const std::string ansi_reset =
"\033[0m";
14const std::array<std::pair<Style, std::string>, 8> style_mappings = {
15 {{Style::bold,
"\033[1m"},
16 {Style::italic,
"\033[3m"},
17 {Style::red,
"\033[31m"},
18 {Style::green,
"\033[32m"},
19 {Style::blue,
"\033[34m"},
20 {Style::yellow,
"\033[33m"},
21 {Style::cyan,
"\033[36m"},
22 {Style::magenta,
"\033[35m"}}};
37 for (
const auto &[flag, ansi_code] : style_mappings) {
43 return prefix + text + ansi_reset;
std::string style(const std::string &text, Style styles) const override
Applies ANSI escape codes to style text according to the specified Style flags.
Style
Bitmask flags for text styling options.
@ none
No styling applied.
constexpr bool has_style(Style styles, Style flag)
Checks if a specific style flag is set in a Style value.