Those are [ANSI escape sequences][1]; that link is to a chart of color codes but there are other interesting things on that wikipedia page as well. Not all of them work on (e.g.) a normal linux console.
This is incorrect:
> `\033]00m\] # white`
`0` resets the terminal to its default (which is probably white). The actual code for white foreground is 37. Also, the escaped closing brace at the end (`\]`) is not part of the color sequence (see the last few paragraphs below for an explanation of their purpose in setting a prompt).
Note that some GUI terminals allow you to specify a customized color scheme. This will affect the output.
There's [a list here][2] which adds 7 foreground and 7 background colors I had not seen before, but they seem to work:
# Foreground colors
90 Dark gray
91 Light red
92 Light green
93 Light yellow
94 Light blue
95 Light magenta
96 Light cyan
# Background colors
100 Dark gray
101 Light red
102 Light green
103 Light yellow
104 Light blue
105 Light magenta
106 Light cyan
In addition, if you have a 256 color GUI terminal (I think most of them are now), you can apply colors from this chart:
![enter image description here][3]
The ANSI sequence to select these, using the number in the bottom left corner, starts `38;5;` for the foreground and `48;5;` for the background, then the color number, so e.g.:
echo -e "\\033[48;5;95;38;5;214mhello world\\033[0m"
Gives me a light orange on tan (meaning, the color chart is roughly approximated).
You can see the colors in this chart as they would appear on your terminal fairly easily:
#!/bin/bash
color=16;
while [ $color -lt 245 ]; do
echo -e "$color: \\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m"
((color++));
done
The output is self-explanatory.
Some systems set the $TERM variable to `xterm-256color` if you are on a 256 color terminal via some shell code in `/etc/profile`. On others, you should be able to configure your terminal to use this. That will let TUI applications know there are 256 colors, and allow you to add something like this to your `~/.bashrc`:
if [[ "$TERM" =~ 256color ]]; then
PS1="MyCrazyPrompt..."
fi
Beware that when you use color escape sequences in your prompt, you should enclose them in escaped (`\` prefixed) square brackets, like this:
PS1="\[\033[01;32m\]MyPrompt: \[\033[0m\]"
Notice the `[`'s interior to the color sequence are not escaped, but the enclosing ones are. The purpose of the latter is to indicate to the shell that the enclosed sequence does not count toward the character length of the prompt. If that count is wrong, weird things will happen when you scroll back through the history, e.g., if it is too long, the excess length of the last scrolled string will appear attached to your prompt and you won't be able to backspace into it (it's ignored the same way the prompt is).
[1]: http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
[2]: http://misc.flogisoft.com/bash/tip_colors_and_formatting
[3]: https://i.sstatic.net/UQVe5.png