#JavaScript - ANSI Escape Codes
ANSI Escape Codes are special characters which can be used to control formatting, colors or other output preferences in a text terminal. Escape Codes are non-printing code and will not appear in the output directly.
- \033 begins the escape sequence
- [ indicates the color
- 33 is the foreground color for yellow
- m indicates the end of the setting
Note: \033[39m is used set the color back to the terminal defult
console.log('\033[33m Hello World \033[39m');
This will give a nice yellow color Hello World.
The complete table of ANSI Escape Codes is available at http://en.wikipedia.org/wiki/ANSI_escape_code
f means foreground b means background
reset = "\u001b[0m";
hicol = "\u001b[1m";
locol = "\u001b[2m";
underline = "\u001b[4m";
inverse = "\u001b[7m";
fblack = "\u001b[30m";
fred = "\u001b[31m";
fgreen = "\u001b[32m";
fyellow = "\u001b[33m";
fblue = "\u001b[34m";
fmagenta = "\u001b[35m";
fcyan = "\u001b[36m";
fwhite = "\u001b[37m";
bblack = "\u001b[40m";
bred = "\u001b[41m";
bgreen = "\u001b[42m";
byellow = "\u001b[43m";
bblue = "\u001b[44m";
bmagenta = "\u001b[45m";
bcyan = "\u001b[46m";
bwhite = "\u001b[47m";