Functions | Variables
oomph::ANSIEscapeCode Namespace Reference

Contains an enumeration of the ANSI escape codes used for colouring text (when piped to the command line). Adapted from the guide on: https://stackoverflow.com/questions/2616906/how-do-i-output- coloured-text-to-a-linux-terminal?utm_medium=organic&utm_source= google_rich_qa&utm_campaign=google_rich_qa Here, \033 is the ESC character, ASCII 27. It is followed by [, then zero or more numbers separated by ;, and finally the letter m. The numbers describe the colour and format to switch to from that point onwards. More...

Functions

void set_text_effect (std::string text_effect)
 Function to change text effect. NOTE: This assumes the user knows what they're doing/assigning; no error checking done here... More...
 

Variables

std::string Text_effect = "1"
 Variable to decide on effects. More...
 
std::string Black = "\033[" + Text_effect + ";30m"
 The code for each type of colour. More...
 
std::string Red = "\033[" + Text_effect + ";31m"
 
std::string Green = "\033[" + Text_effect + ";32m"
 
std::string Yellow = "\033[" + Text_effect + ";33m"
 
std::string Blue = "\033[" + Text_effect + ";34m"
 
std::string Magenta = "\033[" + Text_effect + ";35m"
 
std::string Cyan = "\033[" + Text_effect + ";36m"
 
std::string Reset = "\033[0m"
 

Detailed Description

Contains an enumeration of the ANSI escape codes used for colouring text (when piped to the command line). Adapted from the guide on: https://stackoverflow.com/questions/2616906/how-do-i-output- coloured-text-to-a-linux-terminal?utm_medium=organic&utm_source= google_rich_qa&utm_campaign=google_rich_qa Here, \033 is the ESC character, ASCII 27. It is followed by [, then zero or more numbers separated by ;, and finally the letter m. The numbers describe the colour and format to switch to from that point onwards.

Function Documentation

◆ set_text_effect()

void oomph::ANSIEscapeCode::set_text_effect ( std::string  text_effect)

Function to change text effect. NOTE: This assumes the user knows what they're doing/assigning; no error checking done here...

Definition at line 60 of file oomph_utilities.cc.

References Text_effect.

Variable Documentation

◆ Black

std::string oomph::ANSIEscapeCode::Black = "\033[" + Text_effect + ";30m"

The code for each type of colour.

Definition at line 70 of file oomph_utilities.cc.

◆ Blue

std::string oomph::ANSIEscapeCode::Blue = "\033[" + Text_effect + ";34m"

Definition at line 74 of file oomph_utilities.cc.

◆ Cyan

std::string oomph::ANSIEscapeCode::Cyan = "\033[" + Text_effect + ";36m"

Definition at line 76 of file oomph_utilities.cc.

◆ Green

std::string oomph::ANSIEscapeCode::Green = "\033[" + Text_effect + ";32m"

Definition at line 72 of file oomph_utilities.cc.

◆ Magenta

std::string oomph::ANSIEscapeCode::Magenta = "\033[" + Text_effect + ";35m"

Definition at line 75 of file oomph_utilities.cc.

◆ Red

std::string oomph::ANSIEscapeCode::Red = "\033[" + Text_effect + ";31m"

Definition at line 71 of file oomph_utilities.cc.

◆ Reset

std::string oomph::ANSIEscapeCode::Reset = "\033[0m"

Definition at line 77 of file oomph_utilities.cc.

◆ Text_effect

std::string oomph::ANSIEscapeCode::Text_effect = "1"

Variable to decide on effects.

Definition at line 67 of file oomph_utilities.cc.

Referenced by set_text_effect().

◆ Yellow

std::string oomph::ANSIEscapeCode::Yellow = "\033[" + Text_effect + ";33m"

Definition at line 73 of file oomph_utilities.cc.