23 #define ANSI_ESC "\x1B"
26 #define ANSI_CSI "\x9B"
29 #define ANSI_DSC "\x90"
32 #define ANSI_OSC "\x9D"
41#define ANSI_RESET ANSI_ESC "[0m"
43#define ANSI_BOLD ANSI_ESC "[1m"
44#define ANSI_FAINT ANSI_ESC "[2m"
45#define ANSI_ITALIC ANSI_ESC "[3m"
46#define ANSI_UNDER ANSI_ESC "[4m"
47#define ANSI_SBLINK ANSI_ESC "[5m"
48#define ANSI_RBLINK ANSI_ESC "[6m"
49#define ANSI_REVERSE ANSI_ESC "[7m"
50#define ANSI_HIDE ANSI_ESC "[8m"
51#define ANSI_STRIKE ANSI_ESC "[9m"
56#define ANSI_DEF_FONT ANSI_ESC "[10m"
61#define ANSI_Franktur ANSI_ESC "[20m"
63#define ANSI_BOLD_OFF ANSI_ESC "[21m"
64#define ANSI_HI_OFF ANSI_ESC "[22m"
65#define ANSI_ITALIC_OFF ANSI_ESC "[23m"
66#define ANSI_UNDER_OFF ANSI_ESC "[24m"
67#define ANSI_BLINK_OFF ANSI_ESC "[25m"
68#define ANSI_REVERSE_OFF ANSI_ESC "[27m"
69#define ANSI_REVEAL ANSI_ESC "[28m"
70#define ANSI_STRIKE_OFF ANSI_ESC "[29m"
73#define ANSI_BLACK ANSI_ESC "[30m"
74#define ANSI_RED ANSI_ESC "[31m"
75#define ANSI_GREEN ANSI_ESC "[32m"
76#define ANSI_YELLOW ANSI_ESC "[33m"
77#define ANSI_BLUE ANSI_ESC "[34m"
78#define ANSI_PURPLE ANSI_ESC "[35m"
79#define ANSI_CYAN ANSI_ESC "[36m"
80#define ANSI_WHITE ANSI_ESC "[37m"
82#define ANSI_DEFAULT ANSI_ESC "[39m"
85#define ANSI_BK_BLACK ANSI_ESC "[40m"
86#define ANSI_BK_RED ANSI_ESC "[41m"
87#define ANSI_BK_GREEN ANSI_ESC "[42m"
88#define ANSI_BK_YELLOW ANSI_ESC "[43m"
89#define ANSI_BK_BLUE ANSI_ESC "[44m"
90#define ANSI_BK_PURPLE ANSI_ESC "[45m"
91#define ANSI_BK_CYAN ANSI_ESC "[46m"
92#define ANSI_BK_WHITE ANSI_ESC "[47m"
94#define ANSI_BK_DEFAULT ANSI_ESC "[49m"
97#define ANSI_BLACK_HI ANSI_ESC "[90m"
98#define ANSI_RED_HI ANSI_ESC "[91m"
99#define ANSI_GREEN_HI ANSI_ESC "[92m"
100#define ANSI_YELLOW_HI ANSI_ESC "[93m"
101#define ANSI_BLUE_HI ANSI_ESC "[94m"
102#define ANSI_PURPLE_HI ANSI_ESC "[95m"
103#define ANSI_CYAN_HI ANSI_ESC "[96m"
104#define ANSI_WHITE_HI ANSI_ESC "[97m"
108#define ANSI_BK_BLACK_HI ANSI_ESC "[100m"
109#define ANSI_BK_RED_HI ANSI_ESC "[101m"
110#define ANSI_BK_GREEN_HI ANSI_ESC "[102m"
111#define ANSI_BK_YELLOW_HI ANSI_ESC "[103m"
112#define ANSI_BK_BLUE_HI ANSI_ESC "[104m"
113#define ANSI_BK_PURPLE_HI ANSI_ESC "[105m"
114#define ANSI_BK_CYAN_HI ANSI_ESC "[106m"
115#define ANSI_BK_WHITE_HI ANSI_ESC "[107m"
128#define ANSI_SGR(str) ANSI_ESC "[" #str "m"
138#define ANSI_RGB(r, g, b) ANSI_ESC "[38;2;" #r ";" #g ";" #b "m"
148#define ANSI_BK_RGB(r, g, b) ANSI_ESC "[48;2;" #r ";" #g ";" #b "m"
162#define ANSI_C0 ANSI_ESC "[1;1H"
169#define ANSI_CUU1 ANSI_ESC "[1A"
176#define ANSI_CUD1 ANSI_ESC "[1B"
183#define ANSI_CUF1 ANSI_ESC "[1C"
190#define ANSI_CUB1 ANSI_ESC "[1D"
197#define ANSI_CNL1 ANSI_ESC "[1E"
204#define ANSI_CPL1 ANSI_ESC "[1F"
211#define ANSI_SU1 ANSI_ESC "[1S"
218#define ANSI_SD1 ANSI_ESC "[1T"
225#define ANSI_ED0 ANSI_ESC "[0J"
232#define ANSI_ED1 ANSI_ESC "[1J"
239#define ANSI_ED2 ANSI_ESC "[2J"
246#define ANSI_ED3 ANSI_ESC "[3J"
254#define ANSI_EL0 ANSI_ESC "[0K"
261#define ANSI_EL1 ANSI_ESC "[1K"
268#define ANSI_EL2 ANSI_ESC "[2K"
276#define ANSI_AUX_PORT_ON ANSI_ESC "[5i"
283#define ANSI_AUX_PORT_OFF ANSI_ESC "[4i"
290#define ANSI_DSR ANSI_ESC "[6n"
298#define ANSI_SCP ANSI_ESC "[s"
305#define ANSI_RCP ANSI_ESC "[u"
318#define ANSI_CUU(n) ANSI_ESC "[" #n "A"
326#define ANSI_CUD(n) ANSI_ESC "[" #n "B"
334#define ANSI_CUF(n) ANSI_ESC "[" #n "C"
342#define ANSI_CUB(n) ANSI_ESC "[" #n "D"
351#define ANSI_CNL(n) ANSI_ESC "[" #n "E"
359#define ANSI_CPL(n) ANSI_ESC "[" #n "F"
367#define ANSI_CHA(n) ANSI_ESC "[" #n "G"
376#define ANSI_CUP(row, col) ANSI_ESC "[" #row ";" #col "H"
389#define ANSI_ED(n) ANSI_ESC "[" #n "J"
400#define ANSI_EL(n) ANSI_ESC "[" #n "K"
408#define ANSI_SU(n) ANSI_ESC "[" #n "S"
416#define ANSI_SD(n) ANSI_ESC "[" #n "T"
426#define ANSI_HVP(row, col) ANSI_ESC "[" #row ";" #col "f"
439#define ANSI_custom(str) ANSI_ESC "[" #str
453 std::string ESC = std::string(
ANSI_ESC);
454 std::string CSI = std::string(
ANSI_CSI);
455 std::string DSC = std::string(
ANSI_DSC);
456 std::string OSC = std::string(
ANSI_OSC);
469 std::string SGR(std::string str) {
470 return ansi::ESC+
"["+str+
"m";
481 std::string RGB(
int r,
int g,
int b) {
482 return ansi::ESC+
"[38;2;"+
483 std::to_string(r)+
";"+
484 std::to_string(g)+
";"+
485 std::to_string(b)+
"m";
496 std::string BK_RGB(
int r,
int g,
int b) {
497 return ansi::ESC+
"[48;2;"+
498 std::to_string(r)+
";"+
499 std::to_string(g)+
";"+
500 std::to_string(b)+
"m";
514 std::string CUU(
int n) {
515 return ansi::ESC+
"["+ std::to_string(n) +
"A";
524 std::string CUD(
int n) {
525 return ansi::ESC+
"["+ std::to_string(n) +
"B";
534 std::string CUF(
int n) {
535 return ansi::ESC+
"["+ std::to_string(n) +
"C";
544 std::string CUB(
int n) {
545 return ansi::ESC+
"["+ std::to_string(n) +
"D";
555 std::string CNL(
int n) {
556 return ansi::ESC+
"["+ std::to_string(n) +
"E";
565 std::string CPL(
int n) {
566 return ansi::ESC+
"["+ std::to_string(n) +
"F";
575 std::string CHA(
int n) {
576 return ansi::ESC+
"["+ std::to_string(n) +
"G";
586 std::string CUP(
int row,
int col) {
587 return ansi::ESC+
"["+ std::to_string(row)+
";"+std::to_string(col) +
"H";
601 std::string ED(
int n) {
602 return ansi::ESC+
"["+ std::to_string(n) +
"J";
614 std::string EL(
int n) {
615 return ansi::ESC+
"["+ std::to_string(n) +
"K";
624 std::string SU(
int n) {
625 return ansi::ESC+
"["+ std::to_string(n) +
"S";
634 std::string SD(
int n) {
635 return ansi::ESC+
"["+ std::to_string(n) +
"T";
646 std::string HVP(
int row,
int col) {
647 return ansi::ESC+
"["+ std::to_string(row)+
";"+std::to_string(col) +
"f";
661 std::string custom(std::string str) {
662 return ansi::ESC+
"["+str;
#define ANSI_OSC
Definition: ansi.h:32
#define ANSI_DSC
Definition: ansi.h:29
#define ANSI_ESC
Definition: ansi.h:23
#define ANSI_CSI
Definition: ansi.h:26