24 namespace term_colors {
39 inline const std::string
empty() {
return ""; };
78 inline std::string
rgb_foreground(std::uint8_t r, std::uint8_t g, std::uint8_t b) {
83 inline std::string
rgb_background(std::uint8_t r, std::uint8_t g, std::uint8_t b) {
Terminal color escape sequences and enable/disable control.
ColorLevel
The possible levels of terminal color support.
ColorLevel color_level()
Query the currently detected/forced terminal color support level.
void enable_colors()
Enable colors.
void disable_colors()
Disable all colors.
bool are_colors_enabled()
Query whether terminal color output is currently enabled.
std::string foreground(std::uint8_t r, std::uint8_t g, std::uint8_t b)
Escape sequence to set the given RGB foreground text color.
std::string background(std::uint8_t r, std::uint8_t g, std::uint8_t b)
Escape sequence to set the given RGB background color.
std::string background(std::uint8_t index)
Escape sequence to set the given palette index as background color.
std::string foreground(std::uint8_t index)
Escape sequence to set the given palette index as foreground text color.
const char * red()
Escape sequence to set red text color.
const char * green()
Escape sequence to set green text color.
const char * black()
Escape sequence to set black text color.
const char * white()
Escape sequence to set white text color.
const char * magenta()
Escape sequence to set magenta (pink) text color.
const char * cyan()
Escape sequence to set cyan text color.
const char * blue()
Escape sequence to set blue text color.
const char * yellow()
Escape sequence to set yellow text color.
const char * blink()
escape sequence to set blinking text formatting.
const char * reset()
escape sequence to reset the terminal text formatting.
const char * bold()
escape sequence to set bold text formatting.
const char * underline()
escape sequence to set underlined text formatting.
const char * faint()
escape sequence to set faint (dim) text formatting.
namespace for basic c++ utilities
std::string col256_foreground(std::uint8_t index)
Get the 256-color palette foreground terminal escape char (empty if unsupported).
const std::string reset()
Get the reset terminal escape char.
const std::string col8b_yellow()
Get the yellow terminal escape char.
const std::string col8b_white()
Get the white terminal escape char.
const std::string col8b_magenta()
Get the magenta (pink) terminal escape char.
const std::string empty()
Get the empty terminal escape.
const std::string blink()
Get the blink terminal escape char.
const std::string col8b_green()
Get the green terminal escape char.
sham::term::ColorLevel color_level()
Get the detected/forced terminal color support level.
std::string rgb_background(std::uint8_t r, std::uint8_t g, std::uint8_t b)
Get the 24-bit RGB truecolor background terminal escape char (empty if unsupported).
const std::string col8b_blue()
Get the blue terminal escape char.
const std::string col8b_black()
Get the black terminal escape char.
const std::string underline()
Get the underline terminal escape char.
bool colors_enabled()
Are colors enabled.
std::string col256_background(std::uint8_t index)
Get the 256-color palette background terminal escape char (empty if unsupported).
void disable_colors()
Disable all colors.
void enable_colors()
Enable colors in logs.
std::string rgb_foreground(std::uint8_t r, std::uint8_t g, std::uint8_t b)
Get the 24-bit RGB truecolor foreground terminal escape char (empty if unsupported).
const std::string col8b_cyan()
Get the cyan terminal escape char.
const std::string faint()
Get the faint terminal escape char.
const std::string bold()
Get the bold terminal escape char.
const std::string col8b_red()
Get the red terminal escape char.