Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I found this image on the internet, but don't know how was it made,

enter image description here

Can anyone provide a sample on that? I just would like to have a color table as well.

share|improve this question

7 Answers 7

up vote 16 down vote accepted

install the package named as:


and enjoy coloring by running the binaries like colortest-8 colortest-16 colortest-16b and so on

share|improve this answer
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix? – Raim Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest – r03 Aug 6 '14 at 18:47

The escape sequence ESC [ SPEC1 ; … m changes the text attributes (color, bold, etc.) of subsequently written characters. This is one of the ANSI terminal escape sequences. Each SPEC can be one of the following (the list is not exhaustive):

  • 0 to switch to the default colors.
  • 1 to turn boldface on.
  • 30 through 37 to set the foreground color (black, red, green, yellow, blue, magenta, cyan, gray).
  • 40 through 47 to set the background color (same list).

Here's a shell snippet that outputs almost what you posted.

printf "             "
for b in 0 1 2 3 4 5 6 7; do printf "   4${b}m  "; done
for f in "" 30 31 32 33 34 35 36 37; do
  for s in "  " "1;"; do
    printf "%4sm" "${s}${f}"
    printf "   \033[%sm%s\033[0m  " "$s$f" "gYw"
    for b in 0 1 2 3 4 5 6 7; do
      printf "   \033[4%s;%sm%s\033[0m  " $b $s$f "gYw"
share|improve this answer

There are a few variations, well six to be precise, listed on the Arch Wiki Xresouces page.

As well as the one that is used in your screenshot, there are some more inventive ones—my favourite of which is from the Crunchbang forums and features space invaders:

# ANSI color scheme script featuring Space Invaders
# Original:
# Modified by lolilolicon

f=3 b=4
for j in f b; do
  for i in {0..7}; do
    printf -v $j$i %b "\e[${!j}${i}m"

cat << EOF

 $f1  ▀▄   ▄▀     $f2 ▄▄▄████▄▄▄    $f3  ▄██▄     $f4  ▀▄   ▄▀     $f5 ▄▄▄████▄▄▄    $f6  ▄██▄  $rst
 $f1 ▄█▀███▀█▄    $f2███▀▀██▀▀███   $f3▄█▀██▀█▄   $f4 ▄█▀███▀█▄    $f5███▀▀██▀▀███   $f6▄█▀██▀█▄$rst
 $f1█▀███████▀█   $f2▀▀███▀▀███▀▀   $f3▀█▀██▀█▀   $f4█▀███████▀█   $f5▀▀███▀▀███▀▀   $f6▀█▀██▀█▀$rst
 $f1▀ ▀▄▄ ▄▄▀ ▀   $f2 ▀█▄ ▀▀ ▄█▀    $f3▀▄    ▄▀   $f4▀ ▀▄▄ ▄▄▀ ▀   $f5 ▀█▄ ▀▀ ▄█▀    $f6▀▄    ▄▀$rst

 $bld$f1▄ ▀▄   ▄▀ ▄   $f2 ▄▄▄████▄▄▄    $f3  ▄██▄     $f4▄ ▀▄   ▄▀ ▄   $f5 ▄▄▄████▄▄▄    $f6  ▄██▄  $rst
 $bld$f1█▄█▀███▀█▄█   $f2███▀▀██▀▀███   $f3▄█▀██▀█▄   $f4█▄█▀███▀█▄█   $f5███▀▀██▀▀███   $f6▄█▀██▀█▄$rst
 $bld$f1▀█████████▀   $f2▀▀▀██▀▀██▀▀▀   $f3▀▀█▀▀█▀▀   $f4▀█████████▀   $f5▀▀▀██▀▀██▀▀▀   $f6▀▀█▀▀█▀▀$rst
 $bld$f1 ▄▀     ▀▄    $f2▄▄▀▀ ▀▀ ▀▀▄▄   $f3▄▀▄▀▀▄▀▄   $f4 ▄▀     ▀▄    $f5▄▄▀▀ ▀▀ ▀▀▄▄   $f6▄▀▄▀▀▄▀▄$rst



                              $f7    ▄█▄    $rst



share|improve this answer
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P – warl0ck Jun 29 '12 at 1:55
Fair enough: the wiki page I linked to also includes the script in your screenshot; I just think this is a more interesting way to display X colours :) – jasonwryan Jun 29 '12 at 2:10
echo -e "\n\033[4;31mLight Colors\033[0m \t\t\t  \033[1;4;31mDark Colors\033[0m"
echo -e " \e[0;30;47m Black     \e[0m   0;30m \t\t \e[1;30;40m Dark Gray   \e[0m  1;30m"
echo -e " \e[0;31;47m Red       \e[0m   0;31m \t\t \e[1;31;40m Dark Red    \e[0m  1;31m"
echo -e " \e[0;32;47m Green     \e[0m   0;32m \t\t \e[1;32;40m Dark Green  \e[0m  1;32m"
echo -e " \e[0;33;47m Brown     \e[0m   0;33m \t\t \e[1;33;40m Yellow      \e[0m  1;33m"
echo -e " \e[0;34;47m Blue      \e[0m   0;34m \t\t \e[1;34;40m Dark Blue   \e[0m  1;34m"
echo -e " \e[0;35;47m Magenta   \e[0m   0;35m \t\t \e[1;35;40m Dark Magenta\e[0m  1;35m"
echo -e " \e[0;36;47m Cyan      \e[0m   0;36m \t\t \e[1;36;40m Dark Cyan   \e[0m  1;36m"
echo -e " \e[0;37;47m Light Gray\e[0m   0;37m \t\t \e[1;37;40m White       \e[0m  1;37m"

and so on.

share|improve this answer

This script seems to be the one that produced the picture.

share|improve this answer
Welcome to U&L.SE. Nice Catch btw – eyoung100 Sep 15 '14 at 18:48

While it's not that hard to replicate, your screenshot likely came from; the bottom of that page contains a script that outputs the table you see:

To help myself remember what colours are available, I wrote a script that output all the colours to the screen. Daniel Crisman has supplied a much nicer version which I include below:

#   This file echoes a bunch of color codes to the 
#   terminal to demonstrate what's available.  Each 
#   line is the color code of one forground color,
#   out of 17 (default + 16 escapes), followed by a 
#   test use of that color on all nine background 
#   colors (default + 8 escapes).

T='gYw'   # The test text

echo -e "\n                 40m     41m     42m     43m\
     44m     45m     46m     47m";

for FGs in '    m' '   1m' '  30m' '1;30m' '  31m' '1;31m' '  32m' \
           '1;32m' '  33m' '1;33m' '  34m' '1;34m' '  35m' '1;35m' \
           '  36m' '1;36m' '  37m' '1;37m';
  do FG=${FGs// /}
  echo -en " $FGs \033[$FG  $T  "
  for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en "$EINS \033[$FG\033[$BG  $T  \033[0m";
share|improve this answer

I'm not sure if this is exact answer, but at I found several functions testing tput for colorizing BASH. I hope it helps.


echo "tput colors test"
echo "================"
echo "tput setaf/setab [0-9] ... tput sgr0"

for fg_color in {0..7}; do
  set_foreground=$(tput setaf $fg_color)
  for bg_color in {0..7}; do
    set_background=$(tput setab $bg_color)
    echo -n $set_background$set_foreground
    printf ' F:%s B:%s ' $fg_color $bg_color
  echo $(tput sgr0)

echo "END"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.