-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvt100.h
78 lines (62 loc) · 2.46 KB
/
vt100.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef VT100_VT100WIN10_INCLUDED
#define VT100_VT100WIN10_INCLUDED
/* (c) 2019 by dbj.org */
/*
VT100 ESC codes for coloring the WIN10 PRO console output
full explanation:
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences?redirectedfrom=MSDN
*/
#include <sdkddkver.h>
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#define VT100_CSI "\x1b["
#define VT100_CLS VT100_CSI "2J"
#define VT100_RESET VT100_CSI "0m"
#define VT100_BOLD_FG VT100_CSI "1m"
#define VT100_ULINE VT100_CSI "4m"
#define VT100_ULINE_OFF VT100_CSI "24m"
#define VT100_COLOR_SWAP VT100_CSI "7m"
#define VT100_FG_RED VT100_CSI "31m"
#define VT100_FG_GREEN VT100_CSI "32m"
#define VT100_FG_YELLOW VT100_CSI "33m"
#define VT100_FG_BLUE VT100_CSI "34m"
#define VT100_FG_CYAN VT100_CSI "36m"
#define VT100_FG_WHITE VT100_CSI "37m"
#define VT100_FG_RED_BOLD VT100_BOLD_FG VT100_FG_RED
#define VT100_FG_GREEN_BOLD VT100_BOLD_FG VT100_FG_GREEN
#define VT100_FG_YELLOW_BOLD VT100_BOLD_FG VT100_FG_YELLOW
#define VT100_FG_BLUE_BOLD VT100_BOLD_FG VT100_FG_BLUE
#define VT100_FG_CYAN_BOLD VT100_BOLD_FG VT100_FG_CYAN
#define VT100_FG_WHITE_BOLD VT100_BOLD_FG VT100_FG_WHITE
#define VT100_BG_BLACK VT100_CSI "40m"
#define VT100_BG_RED VT100_CSI "41m"
#define VT100_BG_GREEN VT100_CSI "42m"
#define VT100_BG_YELLOW VT100_CSI "43m"
#define VT100_BG_BLUE VT100_CSI "44m"
#else // ! (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
// less than WIN10 no colours for cmd.exe
#define VT100_CSI ""
#define VT100_CLS VT100_CSI " "
#define VT100_RESET VT100_CSI " "
#define VT100_BOLD_FG VT100_CSI " "
#define VT100_ULINE VT100_CSI " "
#define VT100_ULINE_OFF VT100_CSI " "
#define VT100_COLOR_SWAP VT100_CSI " "
#define VT100_FG_RED VT100_CSI " "
#define VT100_FG_GREEN VT100_CSI " "
#define VT100_FG_YELLOW VT100_CSI " "
#define VT100_FG_BLUE VT100_CSI " "
#define VT100_FG_CYAN VT100_CSI " "
#define VT100_FG_WHITE VT100_CSI " "
#define VT100_FG_RED_BOLD VT100_BOLD_FG VT100_FG_RED
#define VT100_FG_GREEN_BOLD VT100_BOLD_FG VT100_FG_GREEN
#define VT100_FG_YELLOW_BOLD VT100_BOLD_FG VT100_FG_YELLOW
#define VT100_FG_BLUE_BOLD VT100_BOLD_FG VT100_FG_BLUE
#define VT100_FG_CYAN_BOLD VT100_BOLD_FG VT100_FG_CYAN
#define VT100_FG_WHITE_BOLD VT100_BOLD_FG VT100_FG_WHITE
#define VT100_BG_BLACK VT100_CSI " "
#define VT100_BG_RED VT100_CSI " "
#define VT100_BG_GREEN VT100_CSI " "
#define VT100_BG_YELLOW VT100_CSI " "
#define VT100_BG_BLUE VT100_CSI " "
#endif // ! (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#endif // VT100_VT100WIN10_INCLUDED