How to create a testcolor.sh like the following screenshot?
up vote
18
down vote
favorite
I found this image on the internet, but don't know how was it made,
Can anyone provide a sample on that? I just would like to have a color table as well.
bash shell-script colors
add a comment |
up vote
18
down vote
favorite
I found this image on the internet, but don't know how was it made,
Can anyone provide a sample on that? I just would like to have a color table as well.
bash shell-script colors
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44
add a comment |
up vote
18
down vote
favorite
up vote
18
down vote
favorite
I found this image on the internet, but don't know how was it made,
Can anyone provide a sample on that? I just would like to have a color table as well.
bash shell-script colors
I found this image on the internet, but don't know how was it made,
Can anyone provide a sample on that? I just would like to have a color table as well.
bash shell-script colors
bash shell-script colors
edited Jun 25 '12 at 23:24
Gilles
523k12610411575
523k12610411575
asked Jun 25 '12 at 8:08
daisy
28.2k48167297
28.2k48167297
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44
add a comment |
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44
add a comment |
7 Answers
7
active
oldest
votes
up vote
24
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
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's alsocolortest-256
included.
– shrx
Apr 5 '16 at 9:24
add a comment |
up vote
17
down vote
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 " 33[%sm%s33[0m" "$s$f" "gYw "
for b in 0 1 2 3 4 5 6 7; do
printf " 33[4%s;%sm%s33[0m" "$b" "$s$f" " gYw "
done
echo
done
done
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
add a comment |
up vote
8
down vote
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
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
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
add a comment |
up vote
6
down vote
echo -e "n33[4;31mLight Colors33[0m ttt 33[1;4;31mDark Colors33[0m"
echo -e " e[0;30;47m Black e[0m 0;30m tt e[1;30;40m Dark Gray e[0m 1;30m"
echo -e " e[0;31;47m Red e[0m 0;31m tt e[1;31;40m Dark Red e[0m 1;31m"
echo -e " e[0;32;47m Green e[0m 0;32m tt e[1;32;40m Dark Green e[0m 1;32m"
echo -e " e[0;33;47m Brown e[0m 0;33m tt e[1;33;40m Yellow e[0m 1;33m"
echo -e " e[0;34;47m Blue e[0m 0;34m tt e[1;34;40m Dark Blue e[0m 1;34m"
echo -e " e[0;35;47m Magenta e[0m 0;35m tt e[1;35;40m Dark Magentae[0m 1;35m"
echo -e " e[0;36;47m Cyan e[0m 0;36m tt e[1;36;40m Dark Cyan e[0m 1;36m"
echo -e " e[0;37;47m Light Graye[0m 0;37m tt e[1;37;40m White e[0m 1;37m"
and so on.
add a comment |
up vote
5
down vote
While it's not that hard to replicate, your screenshot likely came from tldp.org; 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:
#!/bin/bash
#
# 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 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG33[$BG $T 33[0m";
done
echo;
done
echo
There's a similar table available as a demo in the F-ANSI library:
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
add a comment |
up vote
1
down vote
This script seems to be the one that produced the picture.
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
add a comment |
up vote
0
down vote
I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH.
#!/bin/bash
echo "tput colors test"
echo "================"
echo
echo "tput setaf/setab [0-9] ... tput sgr0"
echo
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
done
echo $(tput sgr0)
done
echo
echo "END"
echo
exit
add a comment |
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
24
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
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's alsocolortest-256
included.
– shrx
Apr 5 '16 at 9:24
add a comment |
up vote
24
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
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's alsocolortest-256
included.
– shrx
Apr 5 '16 at 9:24
add a comment |
up vote
24
down vote
accepted
up vote
24
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
install the package named as:
colortest
and enjoy coloring by running the binaries like colortest-8
colortest-16
colortest-16b
and so on
answered Jun 25 '12 at 8:12
SHW
7,89133470
7,89133470
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's alsocolortest-256
included.
– shrx
Apr 5 '16 at 9:24
add a comment |
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's alsocolortest-256
included.
– shrx
Apr 5 '16 at 9:24
2
2
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
This answer probably refers to package in a specific Linux distribution. Where are the sources available for the other flavors of Unix?
– raimue
Nov 23 '12 at 19:52
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
in debian/ubuntu: apt-get install colortest
– r03
Aug 6 '14 at 18:47
There's also
colortest-256
included.– shrx
Apr 5 '16 at 9:24
There's also
colortest-256
included.– shrx
Apr 5 '16 at 9:24
add a comment |
up vote
17
down vote
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 " 33[%sm%s33[0m" "$s$f" "gYw "
for b in 0 1 2 3 4 5 6 7; do
printf " 33[4%s;%sm%s33[0m" "$b" "$s$f" " gYw "
done
echo
done
done
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
add a comment |
up vote
17
down vote
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 " 33[%sm%s33[0m" "$s$f" "gYw "
for b in 0 1 2 3 4 5 6 7; do
printf " 33[4%s;%sm%s33[0m" "$b" "$s$f" " gYw "
done
echo
done
done
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
add a comment |
up vote
17
down vote
up vote
17
down vote
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 " 33[%sm%s33[0m" "$s$f" "gYw "
for b in 0 1 2 3 4 5 6 7; do
printf " 33[4%s;%sm%s33[0m" "$b" "$s$f" " gYw "
done
echo
done
done
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 " 33[%sm%s33[0m" "$s$f" "gYw "
for b in 0 1 2 3 4 5 6 7; do
printf " 33[4%s;%sm%s33[0m" "$b" "$s$f" " gYw "
done
echo
done
done
edited Nov 27 '15 at 13:18
user79743
answered Jun 26 '12 at 1:35
Gilles
523k12610411575
523k12610411575
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
add a comment |
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
colortest is nice, but this answer gives exactly what the original asker asked for. it's also nice to see the color codes on the screen. saves thinking about it.
– pdwalker
Aug 3 '17 at 6:27
add a comment |
up vote
8
down vote
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
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
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
add a comment |
up vote
8
down vote
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
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
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
add a comment |
up vote
8
down vote
up vote
8
down vote
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
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
edited Jun 25 '12 at 8:55
answered Jun 25 '12 at 8:48
jasonwryan
48.7k14134183
48.7k14134183
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
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
add a comment |
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
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
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
Jun 29 '12 at 1:55
I like this figure, but SHW provided the exact script, I'll pick his answer ;-P
– daisy
Jun 29 '12 at 1:55
1
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
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
add a comment |
up vote
6
down vote
echo -e "n33[4;31mLight Colors33[0m ttt 33[1;4;31mDark Colors33[0m"
echo -e " e[0;30;47m Black e[0m 0;30m tt e[1;30;40m Dark Gray e[0m 1;30m"
echo -e " e[0;31;47m Red e[0m 0;31m tt e[1;31;40m Dark Red e[0m 1;31m"
echo -e " e[0;32;47m Green e[0m 0;32m tt e[1;32;40m Dark Green e[0m 1;32m"
echo -e " e[0;33;47m Brown e[0m 0;33m tt e[1;33;40m Yellow e[0m 1;33m"
echo -e " e[0;34;47m Blue e[0m 0;34m tt e[1;34;40m Dark Blue e[0m 1;34m"
echo -e " e[0;35;47m Magenta e[0m 0;35m tt e[1;35;40m Dark Magentae[0m 1;35m"
echo -e " e[0;36;47m Cyan e[0m 0;36m tt e[1;36;40m Dark Cyan e[0m 1;36m"
echo -e " e[0;37;47m Light Graye[0m 0;37m tt e[1;37;40m White e[0m 1;37m"
and so on.
add a comment |
up vote
6
down vote
echo -e "n33[4;31mLight Colors33[0m ttt 33[1;4;31mDark Colors33[0m"
echo -e " e[0;30;47m Black e[0m 0;30m tt e[1;30;40m Dark Gray e[0m 1;30m"
echo -e " e[0;31;47m Red e[0m 0;31m tt e[1;31;40m Dark Red e[0m 1;31m"
echo -e " e[0;32;47m Green e[0m 0;32m tt e[1;32;40m Dark Green e[0m 1;32m"
echo -e " e[0;33;47m Brown e[0m 0;33m tt e[1;33;40m Yellow e[0m 1;33m"
echo -e " e[0;34;47m Blue e[0m 0;34m tt e[1;34;40m Dark Blue e[0m 1;34m"
echo -e " e[0;35;47m Magenta e[0m 0;35m tt e[1;35;40m Dark Magentae[0m 1;35m"
echo -e " e[0;36;47m Cyan e[0m 0;36m tt e[1;36;40m Dark Cyan e[0m 1;36m"
echo -e " e[0;37;47m Light Graye[0m 0;37m tt e[1;37;40m White e[0m 1;37m"
and so on.
add a comment |
up vote
6
down vote
up vote
6
down vote
echo -e "n33[4;31mLight Colors33[0m ttt 33[1;4;31mDark Colors33[0m"
echo -e " e[0;30;47m Black e[0m 0;30m tt e[1;30;40m Dark Gray e[0m 1;30m"
echo -e " e[0;31;47m Red e[0m 0;31m tt e[1;31;40m Dark Red e[0m 1;31m"
echo -e " e[0;32;47m Green e[0m 0;32m tt e[1;32;40m Dark Green e[0m 1;32m"
echo -e " e[0;33;47m Brown e[0m 0;33m tt e[1;33;40m Yellow e[0m 1;33m"
echo -e " e[0;34;47m Blue e[0m 0;34m tt e[1;34;40m Dark Blue e[0m 1;34m"
echo -e " e[0;35;47m Magenta e[0m 0;35m tt e[1;35;40m Dark Magentae[0m 1;35m"
echo -e " e[0;36;47m Cyan e[0m 0;36m tt e[1;36;40m Dark Cyan e[0m 1;36m"
echo -e " e[0;37;47m Light Graye[0m 0;37m tt e[1;37;40m White e[0m 1;37m"
and so on.
echo -e "n33[4;31mLight Colors33[0m ttt 33[1;4;31mDark Colors33[0m"
echo -e " e[0;30;47m Black e[0m 0;30m tt e[1;30;40m Dark Gray e[0m 1;30m"
echo -e " e[0;31;47m Red e[0m 0;31m tt e[1;31;40m Dark Red e[0m 1;31m"
echo -e " e[0;32;47m Green e[0m 0;32m tt e[1;32;40m Dark Green e[0m 1;32m"
echo -e " e[0;33;47m Brown e[0m 0;33m tt e[1;33;40m Yellow e[0m 1;33m"
echo -e " e[0;34;47m Blue e[0m 0;34m tt e[1;34;40m Dark Blue e[0m 1;34m"
echo -e " e[0;35;47m Magenta e[0m 0;35m tt e[1;35;40m Dark Magentae[0m 1;35m"
echo -e " e[0;36;47m Cyan e[0m 0;36m tt e[1;36;40m Dark Cyan e[0m 1;36m"
echo -e " e[0;37;47m Light Graye[0m 0;37m tt e[1;37;40m White e[0m 1;37m"
and so on.
answered Jun 25 '12 at 10:36
rush
19k46094
19k46094
add a comment |
add a comment |
up vote
5
down vote
While it's not that hard to replicate, your screenshot likely came from tldp.org; 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:
#!/bin/bash
#
# 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 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG33[$BG $T 33[0m";
done
echo;
done
echo
There's a similar table available as a demo in the F-ANSI library:
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
add a comment |
up vote
5
down vote
While it's not that hard to replicate, your screenshot likely came from tldp.org; 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:
#!/bin/bash
#
# 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 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG33[$BG $T 33[0m";
done
echo;
done
echo
There's a similar table available as a demo in the F-ANSI library:
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
add a comment |
up vote
5
down vote
up vote
5
down vote
While it's not that hard to replicate, your screenshot likely came from tldp.org; 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:
#!/bin/bash
#
# 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 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG33[$BG $T 33[0m";
done
echo;
done
echo
There's a similar table available as a demo in the F-ANSI library:
While it's not that hard to replicate, your screenshot likely came from tldp.org; 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:
#!/bin/bash
#
# 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 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG33[$BG $T 33[0m";
done
echo;
done
echo
There's a similar table available as a demo in the F-ANSI library:
edited Feb 23 '17 at 1:40
answered Jul 2 '15 at 7:18
dimo414
647722
647722
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
add a comment |
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
2
2
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
This is the exact answer to the question.
– wisbucky
Feb 23 '17 at 1:01
add a comment |
up vote
1
down vote
This script seems to be the one that produced the picture.
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
add a comment |
up vote
1
down vote
This script seems to be the one that produced the picture.
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
add a comment |
up vote
1
down vote
up vote
1
down vote
This script seems to be the one that produced the picture.
This script seems to be the one that produced the picture.
answered Sep 15 '14 at 18:41
Jeff Sharp
1112
1112
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
add a comment |
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
Welcome to U&L.SE. Nice Catch btw
– eyoung100
Sep 15 '14 at 18:48
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
That script was (almost certainly) sourced from tlpd.org.
– dimo414
Feb 23 '17 at 1:41
add a comment |
up vote
0
down vote
I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH.
#!/bin/bash
echo "tput colors test"
echo "================"
echo
echo "tput setaf/setab [0-9] ... tput sgr0"
echo
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
done
echo $(tput sgr0)
done
echo
echo "END"
echo
exit
add a comment |
up vote
0
down vote
I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH.
#!/bin/bash
echo "tput colors test"
echo "================"
echo
echo "tput setaf/setab [0-9] ... tput sgr0"
echo
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
done
echo $(tput sgr0)
done
echo
echo "END"
echo
exit
add a comment |
up vote
0
down vote
up vote
0
down vote
I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH.
#!/bin/bash
echo "tput colors test"
echo "================"
echo
echo "tput setaf/setab [0-9] ... tput sgr0"
echo
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
done
echo $(tput sgr0)
done
echo
echo "END"
echo
exit
I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH.
#!/bin/bash
echo "tput colors test"
echo "================"
echo
echo "tput setaf/setab [0-9] ... tput sgr0"
echo
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
done
echo $(tput sgr0)
done
echo
echo "END"
echo
exit
edited Nov 26 at 0:58
Rui F Ribeiro
38.3k1475127
38.3k1475127
answered Jul 2 '15 at 9:22
Tilia
105119
105119
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f41563%2fhow-to-create-a-testcolor-sh-like-the-following-screenshot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can find a collection of script for this in the ArchWiki.
– aloisdg
Jan 8 '16 at 7:44