18#define SPARTA_UNMANAGED_COLOR_NORMAL "\033[0;0m"
19#define SPARTA_UNMANAGED_COLOR_BOLD "\033[0;1m"
20#define SPARTA_UNMANAGED_COLOR_RED "\033[0;31m"
21#define SPARTA_UNMANAGED_COLOR_GREEN "\033[0;32m"
22#define SPARTA_UNMANAGED_COLOR_YELLOW "\033[0;33m"
23#define SPARTA_UNMANAGED_COLOR_BLUE "\033[0;34m"
24#define SPARTA_UNMANAGED_COLOR_MAGENTA "\033[0;35m"
25#define SPARTA_UNMANAGED_COLOR_CYAN "\033[0;36m"
26#define SPARTA_UNMANAGED_COLOR_BRIGHT_RED "\033[1;31m"
27#define SPARTA_UNMANAGED_COLOR_BRIGHT_GREEN "\033[1;32m"
28#define SPARTA_UNMANAGED_COLOR_BRIGHT_YELLOW "\033[1;33m"
29#define SPARTA_UNMANAGED_COLOR_BRIGHT_BLUE "\033[1;34m"
30#define SPARTA_UNMANAGED_COLOR_BRIGHT_MAGENTA "\033[1;35m"
31#define SPARTA_UNMANAGED_COLOR_BRIGHT_CYAN "\033[1;36m"
32#define SPARTA_UNMANAGED_COLOR_BG_RED "\033[0;41m"
33#define SPARTA_UNMANAGED_COLOR_BG_GREEN "\033[0;42m"
34#define SPARTA_UNMANAGED_COLOR_BG_YELLOW "\033[0;43m"
35#define SPARTA_UNMANAGED_COLOR_BG_BLUE "\033[0;44m"
36#define SPARTA_UNMANAGED_COLOR_BG_MAGENTA "\033[0;45m"
37#define SPARTA_UNMANAGED_COLOR_BG_CYAN "\033[0;46m"
40#define SPARTA_CURRENT_COLOR_NORMAL sparta::color::ColorScheme::getDefaultScheme().color(Color::Normal)
41#define SPARTA_CURRENT_COLOR_BRIGHT_NORMAL sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightNormal)
42#define SPARTA_CURRENT_COLOR_BG_NORMAL sparta::color::ColorScheme::getDefaultScheme().color(Color::BgNormal)
43#define SPARTA_CURRENT_COLOR_BOLD sparta::color::ColorScheme::getDefaultScheme().color(Color::Bold)
44#define SPARTA_CURRENT_COLOR_BRIGHT_BOLD sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightBold)
45#define SPARTA_CURRENT_COLOR_BG_BOLD sparta::color::ColorScheme::getDefaultScheme().color(Color::BgBold)
46#define SPARTA_CURRENT_COLOR_RED sparta::color::ColorScheme::getDefaultScheme().color(Color::Red)
47#define SPARTA_CURRENT_COLOR_BRIGHT_RED sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightRed)
48#define SPARTA_CURRENT_COLOR_BG_RED sparta::color::ColorScheme::getDefaultScheme().color(Color::BgRed)
49#define SPARTA_CURRENT_COLOR_GREEN sparta::color::ColorScheme::getDefaultScheme().color(Color::Green)
50#define SPARTA_CURRENT_COLOR_BRIGHT_GREEN sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightGreen)
51#define SPARTA_CURRENT_COLOR_BG_GREEN sparta::color::ColorScheme::getDefaultScheme().color(Color::BgGreen)
52#define SPARTA_CURRENT_COLOR_YELLOW sparta::color::ColorScheme::getDefaultScheme().color(Color::Yellow)
53#define SPARTA_CURRENT_COLOR_BRIGHT_YELLOW sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightYellow)
54#define SPARTA_CURRENT_COLOR_BG_YELLOW sparta::color::ColorScheme::getDefaultScheme().color(Color::BgYellow)
55#define SPARTA_CURRENT_COLOR_BLUE sparta::color::ColorScheme::getDefaultScheme().color(Color::Blue)
56#define SPARTA_CURRENT_COLOR_BRIGHT_BLUE sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightBlue)
57#define SPARTA_CURRENT_COLOR_BG_BLUE sparta::color::ColorScheme::getDefaultScheme().color(Color::BgBlue)
58#define SPARTA_CURRENT_COLOR_MAGENTA sparta::color::ColorScheme::getDefaultScheme().color(Color::Magenta)
59#define SPARTA_CURRENT_COLOR_BRIGHT_MAGENTA sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightMagenta)
60#define SPARTA_CURRENT_COLOR_BG_MAGENTA sparta::color::ColorScheme::getDefaultScheme().color(Color::BgMagenta)
61#define SPARTA_CURRENT_COLOR_CYAN sparta::color::ColorScheme::getDefaultScheme().color(Color::Cyan)
62#define SPARTA_CURRENT_COLOR_BRIGHT_CYAN sparta::color::ColorScheme::getDefaultScheme().color(Color::BrightCyan)
63#define SPARTA_CURRENT_COLOR_BG_CYAN sparta::color::ColorScheme::getDefaultScheme().color(Color::BgCyan)
66static constexpr char const * ALL_COLORS[] = {
68 SPARTA_UNMANAGED_COLOR_BOLD,
69 SPARTA_UNMANAGED_COLOR_RED,
70 SPARTA_UNMANAGED_COLOR_GREEN,
71 SPARTA_UNMANAGED_COLOR_YELLOW,
72 SPARTA_UNMANAGED_COLOR_BLUE,
73 SPARTA_UNMANAGED_COLOR_MAGENTA,
74 SPARTA_UNMANAGED_COLOR_CYAN,
75 SPARTA_UNMANAGED_COLOR_BRIGHT_RED,
76 SPARTA_UNMANAGED_COLOR_BRIGHT_GREEN,
77 SPARTA_UNMANAGED_COLOR_BRIGHT_YELLOW,
78 SPARTA_UNMANAGED_COLOR_BRIGHT_BLUE,
79 SPARTA_UNMANAGED_COLOR_BRIGHT_MAGENTA,
80 SPARTA_UNMANAGED_COLOR_BRIGHT_CYAN,
81 SPARTA_UNMANAGED_COLOR_BG_RED,
82 SPARTA_UNMANAGED_COLOR_BG_GREEN,
83 SPARTA_UNMANAGED_COLOR_BG_YELLOW,
84 SPARTA_UNMANAGED_COLOR_BG_BLUE,
85 SPARTA_UNMANAGED_COLOR_BG_MAGENTA,
86 SPARTA_UNMANAGED_COLOR_BG_CYAN
92 Normal, Bold, Red, Green, Yellow, Blue, Magenta, Cyan,
93 BrightRed, BrightGreen, BrightYellow, BrightBlue,
94 BrightMagenta, BrightCyan, BgRed, BgGreen, BgYellow, BgBlue,
101#define SPARTA_CMDLINE_COLOR_NORMAL ""
102#define SPARTA_CMDLINE_COLOR_ERROR ""
103#define SPARTA_CMDLINE_COLOR_WARNING ""
104#define SPARTA_CMDLINE_COLOR_GOOD ""
131 virtual const char* value_(
Color color)
156 for (
char const * c : ALL_COLORS)
166 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_RED);
167 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_GREEN);
168 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_YELLOW);
169 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_BLUE);
170 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_MAGENTA);
171 basic_colors_.emplace_back(SPARTA_UNMANAGED_COLOR_BRIGHT_CYAN);
172 basic_colors_.emplace_back(
static_cast<char const*
>(
nullptr));
199 const char *
const * next =
color + 1;
200 if (*next ==
nullptr){
217 bool enabled_ =
true;
Color
Define enums for accessing the different colors via a ColorScheme.
#define SPARTA_UNMANAGED_COLOR_NORMAL
Exception class for all of Sparta.
Helpers for enforcing StaticInitialization order.
Accessor methods for obtaining color code strings.
std::vector< const char * > all_colors_
A dummy empty string array to make nextBasicColor work.
std::vector< const char * > basic_colors_
A list of colors in order.
const char *const * nextBasicColor(const char *const *color=nullptr)
Find the next basic color after the color inputted.
virtual void enabled(bool enabled)
would we like to enable or disable colors. By invoking this function with false, all color accessor f...
static ColorScheme * _GBL_COLOR_SCHEME
The default color scheme singleton.
char const * empty_[1]
Whether or not we are returning real colors.
static ColorScheme & getDefaultScheme()
Return the default instance to the global.
const char * color(Color c)
The accessors that should always be used for colors.
Macros for handling exponential backoff.