-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add commonly used ANSI escape codes to AMReX_ANSIEscCode.H. They can be used to print colored output. For example, amrex::Print() << Font::Bold << FGColor::Red << "Hello world from AMReX\n" << ResetDisplay << Font::Faint << FGColor::BrightCyan << Font::Underline << "Hello world again from AMReX " << ResetDisplay << BGColor::White << FGColor::Black << amrex::Version() << ResetDisplay << std::endl;
- Loading branch information
1 parent
2c307a8
commit e2af96c
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#ifndef AMREX_ANSI_ESC_CODE_H_ | ||
#define AMREX_ANSI_ESC_CODE_H_ | ||
|
||
// https://en.wikipedia.org/wiki/ANSI_escape_code | ||
|
||
namespace amrex { | ||
|
||
constexpr char ResetDisplay[] = "\033[0m"; | ||
|
||
namespace Font { | ||
constexpr char Bold [] = "\033[1m"; | ||
constexpr char Faint [] = "\033[2m"; | ||
constexpr char Italic [] = "\033[3m"; | ||
constexpr char Underline [] = "\033[4m"; | ||
constexpr char SlowBlink [] = "\033[5m"; | ||
constexpr char RapidBlink [] = "\033[6m"; | ||
} | ||
|
||
namespace FGColor { // Forground colors | ||
constexpr char Black [] = "\033[30m"; | ||
constexpr char Red [] = "\033[31m"; | ||
constexpr char Green [] = "\033[32m"; | ||
constexpr char Yellow [] = "\033[33m"; | ||
constexpr char Blue [] = "\033[34m"; | ||
constexpr char Magenta [] = "\033[35m"; | ||
constexpr char Cyan [] = "\033[36m"; | ||
constexpr char White [] = "\033[37m"; | ||
|
||
constexpr char Gray [] = "\033[90m"; | ||
constexpr char BrightBlack [] = "\033[90m"; | ||
constexpr char BrightRed [] = "\033[91m"; | ||
constexpr char BrightGreen [] = "\033[92m"; | ||
constexpr char BrightYellow [] = "\033[93m"; | ||
constexpr char BrightBLUE [] = "\033[94m"; | ||
constexpr char BrightMagenta [] = "\033[95m"; | ||
constexpr char BrightCyan [] = "\033[96m"; | ||
constexpr char BrightWhite [] = "\033[97m"; | ||
} | ||
|
||
namespace BGColor { // Background colors | ||
constexpr char Black [] = "\033[40m"; | ||
constexpr char Red [] = "\033[41m"; | ||
constexpr char Green [] = "\033[42m"; | ||
constexpr char Yellow [] = "\033[43m"; | ||
constexpr char Blue [] = "\033[44m"; | ||
constexpr char Magenta [] = "\033[45m"; | ||
constexpr char Cyan [] = "\033[46m"; | ||
constexpr char White [] = "\033[47m"; | ||
|
||
constexpr char Gray [] = "\033[100m"; | ||
constexpr char BrightBlack [] = "\033[100m"; | ||
constexpr char BrightRed [] = "\033[101m"; | ||
constexpr char BrightGreen [] = "\033[102m"; | ||
constexpr char BrightYellow [] = "\033[103m"; | ||
constexpr char BrightBlue [] = "\033[104m"; | ||
constexpr char BrightMagenta [] = "\033[105m"; | ||
constexpr char BrightCyan [] = "\033[106m"; | ||
constexpr char BrightWhite [] = "\033[107m"; | ||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters