Terminal: list colors

If you want to change the color of parts of your prompt, you can using the following commands and color values inside the prompt definition.

Available colors

First, get a list of available colors by using the following command:

for i in {1..256}; do print -P "%F{$i}Color : $i"; done;

Terminal colors

Variable declarations

Next, use the following variables in your prompt setup (PS1 or PROMPT depending on the shell:

  • %F{118} (1 to 256)
  • $FG[018] (1 to 256)
  • $fg[magenta] (magenta, red, white, yellow, black, blue, cyan, green)

References