Playing with my brand new ZSH prompt, I needed to get a preview of my terminal colors.
To see the result above, you can :
- download this script [display_colors.py] and save it locally
- run it with python /path/to/display_colors.py –terse
When working on your prompt (or any other output you with to colorize), you can pick the color you wish to use from the list.
Run, python /path/to/display.py without the –terse parameter. You will get a long list of colors, here’s a sample :
From this list, we can tell that 31 is the code for a red and 32 for a greenish yellow. Next in the list, we would see 33 for another shade of yellow.
You can eolorize text using the sequence \033[0;31m where 31 is the color you wish to display (here, the red)
For example, we can do
echo "colors \033[0;33mYellow \033[1;31mRed \033[0;37mcolors"
Follow up (how to bold, underline)