|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_TEXT_STYLE_H_
2 #define GENESIS_UTILS_TEXT_STYLE_H_
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;
203 std::ostream&
operator << ( std::ostream& out, Style
const& style );
208 #endif // include guard
static std::string get_background_color_value(std::string name)
Return the color value string for a given background color name.
static bool is_background_color(std::string name)
Return true iff the given name is a background color name.
void swap(Style &lhs, Style &rhs)
std::ostream & operator<<(std::ostream &os, Color const &color)
Write a textual representation of the Color the a stream, in the format "(r, g, b,...
std::string foreground_color() const
static const std::array< std::pair< std::string, std::string >, 17 > background_colors
List of all valid background color names and their color strings.
void swap(Color &lhs, Color &rhs)
static std::string get_foreground_color_value(std::string name)
Return the color value string for a given foreground color name.
Style(std::string const &foreground_color, std::string const &background_color)
Style(std::string const &foreground_color, bool bold)
Style(std::string const &foreground_color, std::string const &background_color, bool bold)
static bool is_foreground_color(std::string name)
Return true iff the given name is a foreground color name.
std::string to_bash_string(std::string const &text) const
Additional output function with the same purpose as operator().
Simple text style class for colorized and bold output to a terminal.
static const std::array< std::pair< std::string, std::string >, 17 > foreground_colors
List of all valid foreground color names and their color strings.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::string to_python_string(std::string const &text) const
Additional output function with the same purpose as operator().
bool enabled() const
Return whether the Style is currently enabled.
bool bold() const
Return whether the Style uses bold.
Style(const char *foreground_color)
Style(std::string const &foreground_color)
std::string background_color() const
Style & operator=(Style const &)=default
Style & reset()
Reset the Style to use not colors and not bold.
Style(std::string const &foreground_color, const char *background_color)
std::string operator()(std::string const &text) const
Operator that returns a text with the current Style applied to it.