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

1
echo "colors \033[0;33mYellow \033[1;31mRed \033[0;37mcolors"

Follow up (how to bold, underline)

Filed under: Debian, Terminal

Tagged with: , , , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to Display your terminal colors

Name (required)

Email (required)

Website

Leave a Reply

  • About Me


    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.