Go to the documentation of this file.
25 #ifndef GOBY_UTIL_DEBUG_LOGGER_TERM_COLOR_H
26 #define GOBY_UTIL_DEBUG_LOGGER_TERM_COLOR_H
59 std::ostream&
add_escape_code(std::ostream& os,
const std::string& esc_code);
141 return get_instance()->priv_str_from_col(c);
147 return get_instance()->priv_from_esc_code(s);
153 return get_instance()->priv_esc_code_from_col(c);
159 return get_instance()->priv_esc_code_from_str(s);
170 static std::shared_ptr<TermColor> inst_;
173 Colors::Color priv_from_str(
const std::string& s) {
return colors_map_[s]; }
178 for (
const auto& p : colors_map_)
187 Colors::Color priv_from_esc_code(
const std::string& s) {
return esc_code_map_[s]; }
192 for (
const auto& p : esc_code_map_)
201 std::string priv_esc_code_from_str(
const std::string& s)
207 std::map<std::string, Colors::Color> colors_map_;
208 std::map<std::string, Colors::Color> esc_code_map_;
const std::string esc_green
const std::string esc_lt_yellow
std::ostream & yellow(std::ostream &os)
All text following this manipulator is yellow (e.g. std::cout << yellow << "text";)
const std::string esc_yellow
Color
The eight terminal colors (and bold or "light" variants)
const std::string esc_white
void operator()(TermColor *c)
std::ostream & white(std::ostream &os)
All text following this manipulator is white (e.g. std::cout << white << "text";)
static Colors::Color from_esc_code(const std::string &s)
Color enumeration from escape code (e,g, "\33[31m" -> red)
The global namespace for the Goby project.
Represents the eight available terminal colors (and bold variants)
std::ostream & magenta(std::ostream &os)
All text following this manipulator is magenta (e.g. std::cout << magenta << "text";)
static std::string str_from_col(const Colors::Color &c)
String from color enumeration (e,g, red -> "red")
const std::string esc_lt_white
const std::string esc_lt_magenta
const std::string esc_lt_blue
const std::string esc_lt_red
std::ostream & red(std::ostream &os)
All text following this manipulator is red. (e.g. std::cout << red << "text";)
std::ostream & green(std::ostream &os)
All text following this manipulator is green (e.g. std::cout << green << "text";)
std::ostream & lt_cyan(std::ostream &os)
All text following this manipulator is light cyan (e.g. std::cout << lt_cyan << "text";)
static std::string esc_code_from_col(const Colors::Color &c)
Escape code from color enumeration (e.g. red -> "\33[31m")
static Colors::Color from_str(const std::string &s)
Color enumeration from string (e.g. "blue" -> blue)
const std::string esc_cyan
std::ostream & lt_magenta(std::ostream &os)
All text following this manipulator is light magenta (e.g. std::cout << lt_magenta << "text";)
std::ostream & add_escape_code(std::ostream &os, const std::string &esc_code)
std::ostream & cyan(std::ostream &os)
All text following this manipulator is cyan (e.g. std::cout << cyan << "text";)
const std::string esc_blue
std::ostream & lt_white(std::ostream &os)
All text following this manipulator is bright white (e.g. std::cout << lt_white << "text";)
const std::string esc_lt_green
const std::string esc_nocolor
Converts between string, escape code, and enumeration representations of the terminal colors.
const std::string esc_magenta
const std::string esc_red
std::ostream & nocolor(std::ostream &os)
All text following this manipulator is uncolored (e.g. std::cout << green << "green" << nocolor << "u...
static std::string esc_code_from_str(const std::string &s)
Escape code from string (e.g. "red" -> "\33[31m")
const std::string esc_lt_cyan
std::ostream & blue(std::ostream &os)
All text following this manipulator is blue (e.g. std::cout << blue << "text";)
std::ostream & lt_blue(std::ostream &os)
All text following this manipulator is light blue (e.g. std::cout << lt_blue << "text";)
std::ostream & lt_green(std::ostream &os)
All text following this manipulator is light green (e.g. std::cout << lt_green << "text";)
std::ostream & lt_red(std::ostream &os)
All text following this manipulator is light red (e.g. std::cout << lt_red << "text";)
std::ostream & lt_yellow(std::ostream &os)
All text following this manipulator is light yellow (e.g. std::cout << lt_yellow << "text";)