Ookii.CommandLine for C++  2.0.0
Functions | Variables
ookii::vt::text_format Namespace Reference

Provides constants for various virtual terminal sequences that control text format. More...

Functions

template<typename CharType = ookii::details::default_char_type>
std::basic_string< CharType > get_extended_color (int red, int green, int blue, bool foreground=true)
 Returns the virtual terminal sequence to the foreground or background color to an RGB color. More...
 

Variables

constexpr const char * background_black = "\x1b[40m"
 Sets the background color to black.
 
constexpr const char * background_blue = "\x1b[44m"
 Sets the background color to blue.
 
constexpr const char * background_cyan = "\x1b[46m"
 Sets the background color to cyan.
 
constexpr const char * background_default = "\x1b[49m"
 Sets the background color to default.
 
constexpr const char * background_green = "\x1b[42m"
 Sets the background color to green.
 
constexpr const char * background_magenta = "\x1b[45m"
 Sets the background color to magenta.
 
constexpr const char * background_red = "\x1b[41m"
 Sets the background color to red.
 
constexpr const char * background_white = "\x1b[47m"
 Sets the background color to white.
 
constexpr const char * background_yellow = "\x1b[43m"
 Sets the background color to yellow.
 
constexpr const char * bold_bright = "\x1b[1m"
 Applies the brightness/intensity flag to the foreground color.
 
constexpr const char * bright_background_black = "\x1b[100m"
 Sets the background color to bright black.
 
constexpr const char * bright_background_blue = "\x1b[104m"
 Sets the background color to bright blue.
 
constexpr const char * bright_background_cyan = "\x1b[106m"
 Sets the background color to bright cyan.
 
constexpr const char * bright_background_green = "\x1b[102m"
 Sets the background color to bright green.
 
constexpr const char * bright_background_magenta = "\x1b[105m"
 Sets the background color to bright magenta.
 
constexpr const char * bright_background_red = "\x1b[101m"
 Sets the background color to bright red.
 
constexpr const char * bright_background_white = "\x1b[107m"
 Sets the background color to bright white.
 
constexpr const char * bright_background_yellow = "\x1b[103m"
 Sets the background color to bright yellow.
 
constexpr const char * bright_foreground_black = "\x1b[90m"
 Sets the foreground color to bright black.
 
constexpr const char * bright_foreground_blue = "\x1b[94m"
 Sets the foreground color to bright blue.
 
constexpr const char * bright_foreground_cyan = "\x1b[96m"
 Sets the foreground color to bright cyan.
 
constexpr const char * bright_foreground_green = "\x1b[92m"
 Sets the foreground color to bright green.
 
constexpr const char * bright_foreground_magenta = "\x1b[95m"
 Sets the foreground color to bright magenta.
 
constexpr const char * bright_foreground_red = "\x1b[91m"
 Sets the foreground color to bright red.
 
constexpr const char * bright_foreground_white = "\x1b[97m"
 Sets the foreground color to bright white.
 
constexpr const char * bright_foreground_yellow = "\x1b[93m"
 Sets the foreground color to bright yellow.
 
constexpr const char * default_format = "\x1b[0m"
 Resets the text format to the settings before modification.
 
constexpr const char * foreground_black = "\x1b[30m"
 Sets the foreground color to black.
 
constexpr const char * foreground_blue = "\x1b[34m"
 Sets the foreground color to blue.
 
constexpr const char * foreground_cyan = "\x1b[36m"
 Sets the foreground color to cyan.
 
constexpr const char * foreground_default = "\x1b[39m"
 Sets the foreground color to default.
 
constexpr const char * foreground_green = "\x1b[32m"
 Sets the foreground color to green.
 
constexpr const char * foreground_magenta = "\x1b[35m"
 Sets the foreground color to magenta.
 
constexpr const char * foreground_red = "\x1b[31m"
 Sets the foreground color to red.
 
constexpr const char * foreground_white = "\x1b[37m"
 Sets the foreground color to white.
 
constexpr const char * foreground_yellow = "\x1b[33m"
 Sets the foreground color to yellow.
 
constexpr const char * negative = "\x1b[7m"
 Swaps foreground and background colors.
 
constexpr const char * no_bold_bright = "\x1b[22m"
 Removes the brightness/intensity flag to the foreground color.
 
constexpr const char * no_underline = "\x1b[24m"
 Removes underline.
 
constexpr const char * positive = "\x1b[27m"
 Returns foreground and background colors to normal.
 
constexpr const char * underline = "\x1b[4m"
 Adds underline.
 

Detailed Description

Provides constants for various virtual terminal sequences that control text format.

Function Documentation

◆ get_extended_color()

template<typename CharType = ookii::details::default_char_type>
std::basic_string<CharType> ookii::vt::text_format::get_extended_color ( int  red,
int  green,
int  blue,
bool  foreground = true 
)
inline

Returns the virtual terminal sequence to the foreground or background color to an RGB color.

Parameters
redThe red component of the color, between 0 and 255.
greenThe green component of the color, between 0 and 255.
blueThe blue component of the color, between 0 and 255.
foregroundtrue to apply the color to the foreground; otherwise, it's applied to the background.
Returns
A string with the virtual terminal sequence.