ANSI Escape Codes
When you work in the terminal (e.g. on Unix ), having colors and text formatting often improves the user experience.
There is a great post on Stack Overflow called List of ANSI color escape sequences which goes into detail on all supported escape codes.
Here is a basic selection:
Code | Usage |
---|---|
\033[1m |
Bold |
\033[3m |
Italic |
\033[4m |
Underline |
\033[38;2;<r>;<g>;<b>m |
Set RGB foreground color |
\033[48;2;<r>;<g>;<b>m |
Set RGB background color |
There’s a list of terminals that support RGB, most importantly Terminal.app and Hyper don’t support it while iTerm2 , Alacritty and PuTTY support it (check the link for an exhaustive list).
Edit this page on GitHub