Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSI Escape Codes #2509

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions Src/Base/AMReX_ANSIEscCode.H
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
1 change: 1 addition & 0 deletions Src/Base/AMReX_Print.H
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
#include <AMReX.H>
#include <AMReX_ParallelContext.H>
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_ANSIEscCode.H>

#include <sstream>
#include <fstream>
1 change: 1 addition & 0 deletions Src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -72,6 +72,7 @@ target_sources( amrex
AMReX_parstream.H
AMReX_parstream.cpp
# I/O stuff --------------------------------------------------------------
AMReX_ANSIEscCode.H
AMReX_FabConv.H
AMReX_FabConv.cpp
AMReX_FPC.H
2 changes: 1 addition & 1 deletion Src/Base/Make.package
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ C$(AMREX_BASE)_headers += AMReX_ParReduce.H
#
# I/O stuff.
#
C${AMREX_BASE}_headers += AMReX_FabConv.H AMReX_FPC.H AMReX_Print.H AMReX_IntConv.H AMReX_VectorIO.H
C${AMREX_BASE}_headers += AMReX_ANSIEscCode.H AMReX_FabConv.H AMReX_FPC.H AMReX_Print.H AMReX_IntConv.H AMReX_VectorIO.H
C${AMREX_BASE}_sources += AMReX_FabConv.cpp AMReX_FPC.cpp AMReX_IntConv.cpp AMReX_VectorIO.cpp

#