2020-03-17 04:31:30 +00:00
|
|
|
#ifndef VT_H
|
|
|
|
#define VT_H
|
|
|
|
|
2022-02-02 21:43:34 +00:00
|
|
|
// 3-bit color codes
|
2020-03-17 04:31:30 +00:00
|
|
|
#define VT_COLOR_BLACK 0
|
|
|
|
#define VT_COLOR_RED 1
|
|
|
|
#define VT_COLOR_GREEN 2
|
|
|
|
#define VT_COLOR_YELLOW 3
|
|
|
|
#define VT_COLOR_BLUE 4
|
2022-02-02 21:43:34 +00:00
|
|
|
#define VT_COLOR_MAGENTA 5
|
2020-03-17 04:31:30 +00:00
|
|
|
#define VT_COLOR_CYAN 6
|
|
|
|
#define VT_COLOR_WHITE 7
|
|
|
|
|
|
|
|
#define VT_COLOR_FOREGROUND 3
|
|
|
|
#define VT_COLOR_BACKGROUND 4
|
|
|
|
|
|
|
|
#define VT_COLOR_EXPAND0(type, color) #type #color
|
|
|
|
#define VT_COLOR_EXPAND1(type, color) VT_COLOR_EXPAND0(type, color)
|
|
|
|
#define VT_COLOR(type, color) VT_COLOR_EXPAND1(VT_COLOR_##type, VT_COLOR_##color)
|
|
|
|
|
|
|
|
#define VT_ESC "\x1b"
|
|
|
|
#define VT_CSI "["
|
2020-03-18 21:18:25 +00:00
|
|
|
#define VT_CUP(x, y) VT_ESC VT_CSI y ";" x "H"
|
2020-03-17 04:31:30 +00:00
|
|
|
#define VT_ED(n) VT_ESC VT_CSI #n "J"
|
|
|
|
#define VT_SGR(n) VT_ESC VT_CSI n "m"
|
|
|
|
|
2020-03-22 21:50:11 +00:00
|
|
|
// Add more macros if necessary
|
2020-03-17 04:31:30 +00:00
|
|
|
#define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore))
|
|
|
|
#define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color))
|
|
|
|
#define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color))
|
|
|
|
#define VT_RST VT_SGR("")
|
|
|
|
#define VT_CLS VT_ED(2)
|
|
|
|
|
2022-03-13 23:22:14 +00:00
|
|
|
// ASCII BEL character, plays an alert tone
|
|
|
|
#define BEL '\a'
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
#endif
|