Class terminal (o2scl)

O2scl : Class List

class terminal

A class to support extended terminal output such as colors and graphical characters.

Integers specifying terminal colors and attributes

static const int att_underline = 1000
static const int int_high = 10000
static const int int_low = 20000
static const int bg_prefix = 100000
static const int c_black = 256
static const int c_red = 1
static const int c_green = 2
static const int c_yellow = 3
static const int c_blue = 4
static const int c_magenta = 5
static const int c_cyan = 6
static const int c_light_grey = 7
static const int c_dark_grey = 8
static const int c_hi_red = 9
static const int c_hi_green = 10
static const int c_hi_yellow = 11
static const int c_hi_blue = 12
static const int c_hi_magenta = 13
static const int c_hi_cyan = 14
static const int c_white = 15
std::string color_from_int(int col)

Create a terminal color string from an integer.

Public Functions

terminal()
inline bool is_redirected()

Return true if this terminal has been redirected to a file.

size_t str_len(std::string str)

Determine string length, ignoring vt100 terminal sequences.

std::string hrule(size_t n = 78)

Generate a horizontal rule.

std::string cyan_fg()

Switch to cyan foreground.

std::string magenta_fg()

Switch to magenta foreground.

std::string yellow_fg()

Switch to yellow foreground.

std::string red_fg()

Switch to red foreground.

std::string black_fg()

Switch to black foreground.

std::string green_fg()

Switch to green foreground.

std::string blue_fg()

Switch to blue foreground.

std::string cyan_bg()

Switch to cyan background.

std::string magenta_bg()

Switch to magenta background.

std::string yellow_bg()

Switch to yellow background.

std::string red_bg()

Switch to red background.

std::string black_bg()

Switch to black background.

std::string green_bg()

Switch to green background.

std::string blue_bg()

Switch to blue background.

std::string default_fgbg()

Switch to default foreground and background.

std::string bold()

Switch to bold foreground.

std::string eight_bit_fg(short col)

Change foreground to an 8-bit color.

std::string eight_bit_bg(short col)

Change background to an 8-bit color.

std::string three_byte_fg(short red, short green, short blue)

Change foreground to an 3-byte color.

std::string three_byte_bg(short red, short green, short blue)

Change background to an 3-byte color.

std::string lowint()

Switch to low-intensity foreground.

std::string underline()

Switch to underline background.

std::string reverse()

Switch to reversed background.

std::string alt_font()

Switch to alternate character set.

std::string normal_font()

Switch from alternate to normal character set.

std::string eight_bit_summ()

Summarize 8-bit colors.

std::string three_byte_summ()

Summarize 3-byte colors.

std::string three_byte_summ_long()

Summarize 3-byte colors (long form)

Protected Attributes

bool redirected

If true, this terminal has been redirected to a file.