1 #ifndef GENESIS_UTILS_TEXT_STYLE_H_ 2 #define GENESIS_UTILS_TEXT_STYLE_H_ 92 : foreground_(foreground_color)
96 : foreground_(foreground_color)
104 : foreground_(foreground_color)
109 : foreground_(foreground_color)
110 , background_(background_color)
114 : foreground_(foreground_color)
115 , background_(background_color)
119 : foreground_(foreground_color)
120 , background_(background_color)
136 swap(foreground_, other.foreground_);
137 swap(background_, other.background_);
138 swap(bold_, other.bold_);
163 std::string
operator() ( std::string
const& text )
const;
187 std::string foreground_ =
"";
188 std::string background_ =
"";
191 bool enabled_ =
true;
208 #endif // include guard Style(std::string const &foreground_color, std::string const &background_color)
static bool is_background_color(std::string name)
Return true iff the given name is a background color name.
static std::string get_foreground_color_value(std::string name)
Return the color value string for a given foreground color name.
void swap(Style &lhs, Style &rhs)
Style & operator=(Style const &)=default
Simple text style class for colorized and bold output to a terminal.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
std::ostream & operator<<(std::ostream &os, const Matrix< signed char > &matrix)
Template specialization for signed char, in order to print nicely.
std::string operator()(std::string const &text) const
Operator that returns a text with the current Style applied to it.
Style(const char *foreground_color)
Style(std::string const &foreground_color)
Style(std::string const &foreground_color, bool bold)
std::string to_bash_string(std::string const &text) const
Additional output function with the same purpose as operator().
std::string to_python_string(std::string const &text) const
Additional output function with the same purpose as operator().
std::string foreground_color() const
static bool is_foreground_color(std::string name)
Return true iff the given name is a foreground color name.
Style(std::string const &foreground_color, std::string const &background_color, bool bold)
bool enabled() const
Return whether the Style is currently enabled.
Style & reset()
Reset the Style to use not colors and not bold.
static std::string get_background_color_value(std::string name)
Return the color value string for a given background color name.
static const std::array< std::pair< std::string, std::string >, 17 > background_colors
List of all valid background color names and their color strings.
Style(std::string const &foreground_color, const char *background_color)
std::string background_color() const
static const std::array< std::pair< std::string, std::string >, 17 > foreground_colors
List of all valid foreground color names and their color strings.
bool bold() const
Return whether the Style uses bold.