Take the 2-minute tour ×
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

4 Answers 4

up vote 13 down vote accepted

install the package named as:

colortest

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 –  user28706 Aug 6 at 18:47

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:

#!/bin/bash
#
# ANSI color scheme script featuring Space Invaders
#
# Original: http://crunchbanglinux.org/forums/post/126921/#p126921
# 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"
  done
done
bld=$'\e[1m'
rst=$'\e[0m'

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

                                   $f7▌$rst

                              $f7    ▄█▄    $rst
                              $f7▄█████████▄$rst
                              $f7▀▀▀▀▀▀▀▀▀▀▀$rst

EOF

spacey

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
1  
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

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
echo
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"
    done
    echo
  done
done
share|improve this answer
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

Your Answer

 
discard

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.