-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchalk.h
259 lines (247 loc) Β· 6.72 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#include <iostream>
#include <windows.h>
#include <string>
class Chalk
{
private:
void SetTextColor(int colorCode, std::string Text)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colorCode);
std::cout << Text;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
public:
//* Working for basic colors, only text colors
// To get blue colored texts during cout
void blue(std::string Text)
{
SetTextColor(1, Text);
}
// To get green colored texts during cout
void green(std::string Text)
{
SetTextColor(2, Text);
}
// To get cyan colored texts during cout
void cyan(std::string Text)
{
SetTextColor(3, Text);
}
// To get red colored texts during cout
void red(std::string Text)
{
SetTextColor(4, Text);
}
// To get purple colored texts during cout
void purple(std::string Text)
{
SetTextColor(5, Text);
}
// To get yellow colored texts during cout
void yellow(std::string Text)
{
SetTextColor(5, Text);
}
// To get white colored texts during cout
void white(std::string Text)
{
SetTextColor(7, Text);
}
// To get grey colored texts during cout
void grey(std::string Text)
{
SetTextColor(8, Text);
}
// To get brightBlue colored texts during cout
void brightBlue(std::string Text)
{
SetTextColor(9, Text);
}
// To get brightGreen colored texts during cout
void brightGreen(std::string Text)
{
SetTextColor(10, Text);
}
// To get brightCyan colored texts during cout
void brightCyan(std::string Text)
{
SetTextColor(11, Text);
}
// To get brightRed colored texts during cout
void brightRed(std::string Text)
{
SetTextColor(12, Text);
}
// To get magenta colored texts during cout
void magenta(std::string Text)
{
SetTextColor(13, Text);
}
// To get brightWhite colored texts during cout
void brightWhite(std::string Text)
{
SetTextColor(15, Text);
}
//* Working for blue background, and combinations of other text colors
// To get black colored fonts, in blue colored background
void bgBlueFgBlack(std::string Text)
{
SetTextColor(16, Text);
}
// To get white colored fonts with blue background
void bgBlueFgWhite(std::string Text)
{
SetTextColor(22, Text);
}
// To get red colored font in blue background
void BgBlueFgRed(std::string Text)
{
SetTextColor(20, Text);
}
// To get grey colored font in blue background
void BgBlueFgGrey(std::string Text)
{
SetTextColor(24, Text);
}
// To get green colored font in blue background
void BgBlueFgGreen(std::string Text)
{
SetTextColor(26, Text);
}
// To get cyan colored font in blue background
void BgBlueFgCyan(std::string Text)
{
SetTextColor(27, Text);
}
// To get magenta colored font in blue background
void BgBlueFgMagenta(std::string Text)
{
SetTextColor(28, Text);
}
//* Working for green background and combination of other text colors
// To get black colored font in green background
void bgGreenFgBlack(std::string Text)
{
SetTextColor(32, Text);
}
// To get blue colored text in green background
void bgGreenFgBlue(std::string Text)
{
SetTextColor(33, Text);
}
// To get light colored text in green background
void bgGreenFgLightBlue(std::string Text)
{
SetTextColor(35, Text);
}
// To get Red colored text in green background
void bgGreenFgRed(std::string Text)
{
SetTextColor(36, Text);
}
// To get pink colored text in green background
void bgGreenFgPink(std::string Text)
{
SetTextColor(45, Text);
}
// To get yellow colored text in green background
void bgGreenFgYellow(std::string Text)
{
SetTextColor(46, Text);
}
// To get white colored text in green background
void bgGreenFgWhite(std::string Text)
{
SetTextColor(47, Text);
}
//* Working for light blue background and combination of other text colors
// To get black colored text in light blue background
void bgLightBlueFgBlack(std::string Text)
{
SetTextColor(48, Text);
}
// To get blue colored text in light blue background
void bgLightBlueFgBlue(std::string Text)
{
SetTextColor(49, Text);
}
// To get green colored text in light blue background
void bgLightBlueFgGreen(std::string Text)
{
SetTextColor(50, Text);
}
// To get red colored text in light blue background
void bgLightBlueFgRed(std::string Text)
{
SetTextColor(52, Text);
}
// To get white colored text in light blue background
void bgLightBlueFgWhite(std::string Text)
{
SetTextColor(54, Text);
}
// To get light green colored text in light blue background
void bgLightBlueFgLightGreen(std::string Text)
{
SetTextColor(58, Text);
}
// To get cyan colored text in light blue background
void bgLightBlueFgCyan(std::string Text)
{
SetTextColor(59, Text);
}
// To get magenta colored text in light blue background
void bgLightBlueFgMagenta(std::string Text)
{
SetTextColor(61, Text);
}
// To get yellow colored text in light blue background
void bgLightBlueFgYellow(std::string Text)
{
SetTextColor(62, Text);
}
//* Working for red background and combination of other text colors
// To get black colored text in red background
void bgRedFgBlack(std::string Text)
{
SetTextColor(64, Text);
}
// To get blue colored text in red background
void bgRedFgBlue(std::string Text)
{
SetTextColor(65, Text);
}
// To get green colored text in red background
void bgRedFgGreen(std::string Text)
{
SetTextColor(66, Text);
}
// To get light green colored text in red background
void bgRedFgLightGreen(std::string Text)
{
SetTextColor(74, Text);
}
// To get cyan colored in red background
void bgRedFgCyan(std::string Text)
{
SetTextColor(75, Text);
}
// To get pink colored text in red background
void bgRedFgPink(std::string Text)
{
SetTextColor(77, Text);
}
// To get yellow colored text in red background
void bgRedFgYellow(std::string Text)
{
SetTextColor(78, Text);
}
void printLoop()
{
for (int i = 0; i < 300; i++)
{
std::cout << "\nColor number: " << i << "\n";
SetTextColor(i, "Hello world!\t");
}
}
};