-
Notifications
You must be signed in to change notification settings - Fork 3
/
chalk.h
151 lines (137 loc) Β· 6.77 KB
/
chalk.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* https://github.com/gomjellie/chalk.c
*
* MIT λΌμ΄μ μ€
* Copyright (c) 2020 [email protected]
*
* μ΄ μννΈμ¨μ΄μ 볡μ λ³Έκ³Ό κ΄λ ¨λ λ¬Έμν νμΌ(βμννΈμ¨μ΄β)μ νλνλ μ¬λμ
* λꡬλΌλ μννΈμ¨μ΄λ₯Ό λ³λ€λ₯Έ μ ν μμ΄ λ¬΄μμΌλ‘ μ¬μ©ν μ μλ κΆνμ λΆμ¬ λ°λλ€.
* μ¬κΈ°μλ μννΈμ¨μ΄μ 볡μ λ³Έμ 무μ νμΌλ‘
* μ¬μ©, 볡μ , μμ , λ³ν©, 곡ν, λ°°ν¬, μλΈλΌμ΄μ μ€ μ€μ λ° ν맀ν μ μλ κΆλ¦¬μ
* μ΄μμ νμλ₯Ό μννΈμ¨μ΄λ₯Ό μ 곡λ°μ λ€λ₯Έ μμ·¨μΈλ€μκ² νμ©ν μ μλ κΆλ¦¬κ° ν¬ν¨λλ©°,
* λ€μκ³Ό κ°μ 쑰건μ μΆ©μ‘±μν€λ κ²μ μ μ λ‘ νλ€.
*
* μμ κ°μ μ μκΆ μλ΄ λ¬Έκ΅¬μ λ³Έ νμ© λ¬Έκ΅¬κ° μννΈμ¨μ΄μ λͺ¨λ 볡μ λ³Έ λ° μ€μ λΆλΆμ ν¬ν¨λμ΄μΌ νλ€.
*
* μ΄ μννΈμ¨μ΄λ μνμ±, νΉμ λͺ©μ μ ν©μ±, κ·Έλ¦¬κ³ λΉμΉ¨ν΄μ λν 보μ¦μ ν¬ν¨ν
* μ΄λ ν ννμ 보μ¦λ λͺ
μμ μ΄λ 묡μμ μΌλ‘ μ€μ λμ§ μμ βμλ κ·Έλλ‘μβ μνλ‘ μ 곡λλ€.
* μννΈμ¨μ΄λ₯Ό κ°λ°ν νλ‘κ·Έλλ¨Έλ μ μκΆμλ μ΄λ ν κ²½μ°μλ μννΈμ¨μ΄λ μννΈμ¨μ΄μ
* μ¬μ© λ±μ νμμ κ΄λ ¨νμ¬ μΌμ΄λλ μ΄λ€ μꡬμ¬νμ΄λ μν΄ λ° κΈ°ν μ±
μμ λν΄
* κ³μ½μ, λΆλ²νμ λλ κΈ°ν μ΄μ λ‘ μΈν μ±
μμ μ§μ§ μλλ€.
*
* MIT License
*
* Copyright (c) 2020 [email protected]
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef _CHALK_H_
#define _CHALK_H_
#define CHALK_DEFAULT_FG "\x1b[39m"
#define CHALK_DEFAULT_BG "\x1b[49m"
#define CHALK_DEFAULT_STRIKE "\x1b[29m"
#define CHALK_DEFAULT_REVEAL "\x1b[28m"
#define CHALK_DEFAULT_INVERSE "\x1b[27m"
#define CHALK_DEFAULT_BLINK "\x1b[25m"
#define CHALK_DEFAULT_UNDERLINE "\x1b[24m"
#define CHALK_DEFAULT_ITALIC "\x1b[23m"
#define CHALK_DEFAULT_INTENSITY "\x1b[22m"
#define CHALK_DEFAULT_BOLD "\x1b[21m"
#define CHALK_RESET "\x1b[0m"
#define CHALK_BLACK(FMT) "\x1b[30m" FMT CHALK_DEFAULT_FG
#define CHALK_RED(FMT) "\x1b[31m" FMT CHALK_DEFAULT_FG
#define CHALK_GREEN(FMT) "\x1b[32m" FMT CHALK_DEFAULT_FG
#define CHALK_YELLOW(FMT) "\x1b[33m" FMT CHALK_DEFAULT_FG
#define CHALK_BLUE(FMT) "\x1b[34m" FMT CHALK_DEFAULT_FG
#define CHALK_MAGENTA(FMT) "\x1b[35m" FMT CHALK_DEFAULT_FG
#define CHALK_CYAN(FMT) "\x1b[36m" FMT CHALK_DEFAULT_FG
#define CHALK_WHITE(FMT) "\x1b[37m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_BLACK(FMT) "\x1b[90m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_RED(FMT) "\x1b[91m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_GREEN(FMT) "\x1b[92m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_YELLOW(FMT) "\x1b[93m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_BLUE(FMT) "\x1b[94m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_MAGENTA(FMT) "\x1b[95m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_CYAN(FMT) "\x1b[96m" FMT CHALK_DEFAULT_FG
#define CHALK_LIGHT_WHITE(FMT) "\x1b[97m" FMT CHALK_DEFAULT_FG
#define CHALK_BG_BLACK(FMT) "\x1b[40m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_RED(FMT) "\x1b[41m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_GREEN(FMT) "\x1b[42m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_YELLOW(FMT) "\x1b[43m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_BLUE(FMT) "\x1b[44m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_MAGENTA(FMT) "\x1b[45m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_CYAN(FMT) "\x1b[46m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_WHITE(FMT) "\x1b[47m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_BLACK(FMT) "\x1b[100m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_RED(FMT) "\x1b[101m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_GREEN(FMT) "\x1b[102m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_YELLOW(FMT) "\x1b[103m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_BLUE(FMT) "\x1b[104m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_MAGENTA(FMT) "\x1b[105m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_CYAN(FMT) "\x1b[106m" FMT CHALK_DEFAULT_BG
#define CHALK_BG_LIGHT_WHITE(FMT) "\x1b[107m" FMT CHALK_DEFAULT_BG
#define CHALK_BOLD(FMT) "\x1b[1m" FMT CHALK_DEFAULT_BOLD
#define CHALK_DIM(FMT) "\x1b[2m" FMT CHALK_DEFAULT_INTENSITY
#define CHALK_ITALIC(FMT) "\x1b[3m" FMT CHALK_DEFAULT_ITALIC
#define CHALK_UNDERLINE(FMT) "\x1b[4m" FMT CHALK_DEFAULT_UNDERLINE
#define CHALK_BLINK(FMT) "\x1b[5m" FMT CHALK_DEFAULT_BLINK
#define CHALK_STRIKE(FMT) "\x1b[9m" FMT CHALK_DEFAULT_STRIKE
#define CHALK_INVERSE(FMT) "\x1b[7m" FMT CHALK_DEFAULT_INVERSE
#define CHALK_HIDE(FMT) "\x1b[8m" FMT CHALK_DEFAULT_REVEAL
#ifdef CHALK_NO_PREFIX
#define BLACK CHALK_BLACK
#define RED CHALK_RED
#define GREEN CHALK_GREEN
#define YELLOW CHALK_YELLOW
#define BLUE CHALK_BLUE
#define MAGENTA CHALK_MAGENTA
#define CYAN CHALK_CYAN
#define WHITE CHALK_WHITE
#define LIGHT_BLACK CHALK_LIGHT_BLACK
#define LIGHT_RED CHALK_LIGHT_RED
#define LIGHT_GREEN CHALK_LIGHT_GREEN
#define LIGHT_YELLOW CHALK_LIGHT_YELLOW
#define LIGHT_BLUE CHALK_LIGHT_BLUE
#define LIGHT_MAGENTA CHALK_LIGHT_MAGENTA
#define LIGHT_CYAN CHALK_LIGHT_CYAN
#define LIGHT_WHITE CHALK_LIGHT_WHITE
#define BG_BLACK CHALK_BG_BLACK
#define BG_RED CHALK_BG_RED
#define BG_GREEN CHALK_BG_GREEN
#define BG_YELLOW CHALK_BG_YELLOW
#define BG_BLUE CHALK_BG_BLUE
#define BG_MAGENTA CHALK_BG_MAGENTA
#define BG_CYAN CHALK_BG_CYAN
#define BG_WHITE CHALK_BG_WHITE
#define BG_LIGHT_BLACK CHALK_BG_LIGHT_BLACK
#define BG_LIGHT_RED CHALK_BG_LIGHT_RED
#define BG_LIGHT_GREEN CHALK_BG_LIGHT_GREEN
#define BG_LIGHT_YELLOW CHALK_BG_LIGHT_YELLOW
#define BG_LIGHT_BLUE CHALK_BG_LIGHT_BLUE
#define BG_LIGHT_MAGENTA CHALK_BG_LIGHT_MAGENTA
#define BG_LIGHT_CYAN CHALK_BG_LIGHT_CYAN
#define BG_LIGHT_WHITE CHALK_BG_LIGHT_WHITE
#define BOLD CHALK_BOLD
#define DIM CHALK_DIM
#define ITALIC CHALK_ITALIC
#define UNDERLINE CHALK_UNDERLINE
#define BLINK CHALK_BLINK
#define STRIKE CHALK_STRIKE
#define INVERSE CHALK_INVERSE
#define HIDE CHALK_HIDE
#endif /* CHALK_NO_PREFIX */
#endif /* _CHALK_H_ */