1Reset = "\x1b[0m"
2Bright = "\x1b[1m"
3Dim = "\x1b[2m"
4Underscore = "\x1b[4m"
5Blink = "\x1b[5m"
6Reverse = "\x1b[7m"
7Hidden = "\x1b[8m"
8
9FgBlack = "\x1b[30m"
10FgRed = "\x1b[31m"
11FgGreen = "\x1b[32m"
12FgYellow = "\x1b[33m"
13FgBlue = "\x1b[34m"
14FgMagenta = "\x1b[35m"
15FgCyan = "\x1b[36m"
16FgWhite = "\x1b[37m"
17
18BgBlack = "\x1b[40m"
19BgRed = "\x1b[41m"
20BgGreen = "\x1b[42m"
21BgYellow = "\x1b[43m"
22BgBlue = "\x1b[44m"
23BgMagenta = "\x1b[45m"
24BgCyan = "\x1b[46m"
25BgWhite = "\x1b[47m"
1const COLOR = {
2 reset: '\x1b[0m',
3 bright: '\x1b[1m',
4 dim: '\x1b[2m',
5 underscore: '\x1b[4m',
6 blink: '\x1b[5m',
7 reverse: '\x1b[7m',
8 hidden: '\x1b[8m',
9
10 fgBlack: '\x1b[30m',
11 fgRed: '\x1b[31m',
12 fgGreen: '\x1b[32m',
13 fgYellow: '\x1b[33m',
14 fgBlue: '\x1b[34m',
15 fgMagenta: '\x1b[35m',
16 fgCyan: '\x1b[36m',
17 fgWhite: '\x1b[37m',
18
19 bgBlack: '\x1b[40m',
20 bgRed: '\x1b[41m',
21 bgGreen: '\x1b[42m',
22 bgYellow: '\x1b[43m',
23 bgBlue: '\x1b[44m',
24 bgMagenta: '\x1b[45m',
25 bgCyan: '\x1b[46m',
26 bgWhite: '\x1b[47m',
27};
28
29console.log(`${COLOR.fgRed}This text is red.${COLOR.reset}`);
1console.log('%c My txt ', 'My css');
2
3// Example
4console.log('%c Hello world ', 'background: #222; color: #bada55');
1Reset = "\x1b[0m"
2Bright = "\x1b[1m"
3Dim = "\x1b[2m"
4Underscore = "\x1b[4m"
5Blink = "\x1b[5m"
6Reverse = "\x1b[7m"
7Hidden = "\x1b[8m"
8
9FgBlack = "\x1b[30m"
10FgRed = "\x1b[31m"
11FgGreen = "\x1b[32m"
12FgYellow = "\x1b[33m"
13FgBlue = "\x1b[34m"
14FgMagenta = "\x1b[35m"
15FgCyan = "\x1b[36m"
16FgWhite = "\x1b[37m"
17
18BgBlack = "\x1b[40m"
19BgRed = "\x1b[41m"
20BgGreen = "\x1b[42m"
21BgYellow = "\x1b[43m"
22BgBlue = "\x1b[44m"
23BgMagenta = "\x1b[45m"
24BgCyan = "\x1b[46m"
25BgWhite = "\x1b[47m"
26