Script to display all terminal colors

Here is my solution with Bash only:

for x in {0..8}; do 
    for i in {30..37}; do 
        for a in {40..47}; do 
            echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "
        done
        echo
    done
done
echo ""

One-liner:

for x in {0..8}; do for i in {30..37}; do for a in {40..47}; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; echo ""

Here's a picture in Cygwin:

Cygwin screenshot


A simple one-liner that should work for most people.

msgcat --color=test

You can also use the colortest Install colortest package.

  1. Install it with this command:

    sudo apt-get install colortest
    
  2. It provides several commands which you can use, depending on how many colors you want:

    colortest-16   colortest-16b  colortest-256  colortest-8
    

Example output from colortest-16b:

enter image description here