HDK
|
#include <sysutil.h>
Public Member Functions | |
Term () noexcept | |
Default ctr: assume ANSI escape sequences are ok. More... | |
Term (FILE *file) | |
Term (const std::ostream &stream) | |
std::string | ansi (string_view command) const |
std::string | ansi (string_view command, string_view text) const |
std::string | ansi_fgcolor (int r, int g, int b) |
Extended color control: take RGB values from 0-255. More... | |
std::string | ansi_bgcolor (int r, int g, int b) |
bool | is_console () const noexcept |
Term object encapsulates information about terminal output for the sake of constructing ANSI escape sequences.
|
inlinenoexcept |
Sysutil::Term::Term | ( | FILE * | file | ) |
Construct from a FILE*: ANSI codes ok if the file describes a live console, otherwise they will be supressed.
Sysutil::Term::Term | ( | const std::ostream & | stream | ) |
Construct from a stream: ANSI codes ok if the file describes a live console, otherwise they will be supressed.
std::string Sysutil::Term::ansi | ( | string_view | command | ) | const |
ansi("appearance") returns the ANSI escape sequence for the named command (if ANSI codes are ok, otherwise it will return the empty string). Accepted commands include: "default", "bold", "underscore", "blink", "reverse", "concealed", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "black_bg", "red_bg", "green_bg", "yellow_bg", "blue_bg", "magenta_bg", "cyan_bg", "white_bg". Commands may be combined with "," for example: "bold,green,white_bg".
|
inline |
std::string Sysutil::Term::ansi_bgcolor | ( | int | r, |
int | g, | ||
int | b | ||
) |
std::string Sysutil::Term::ansi_fgcolor | ( | int | r, |
int | g, | ||
int | b | ||
) |
Extended color control: take RGB values from 0-255.