For the BEWD, we had to write a terminal program - I wrote a little script that makes calls to the WMATA api for next train times. Pretty cool.
It was looking a bit dull - so I decided to add some color.
Unfortunately, there was no orange for the Orange line. It took some googling, but eventually - I found it … Using ANSI Color Codes to Colorize Your Bash Prompt on Linux.
Dude even provides some useful info and a bit of code to generate a reference table.
It is also possible (in these newfangled modern times) to use a full 256 colors in most consoles. The color table below can be used to determine the code for each color by adding the column and row number. In order to make use of these codes, we use the syntax
\033[38;5;#mfor the foreground (text) and
\033[48;5;#mfor the background, or in a single statement like
\033[38;5;#;48;5;#mto set both at once, where # is an 8-bit (0-255) color code.
The best way to understand is to try it out. Run the command:
Here is the script for the reference table: