DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Colours
Display all the pretty colours in an xterm (or PuTTY session) so you can choose the combination you need...
Really helpful when you're writing a program and want to display something, or are hacking on your .dircolors or similar...
#!/usr/bin/perl
#
# JohnGH 29/12/2007
#
use warnings;
use strict;
my @range = ( 0 .. 8, 30 .. 37, 41 .. 47 , 90 .. 107);
my $count = shift;
if ( $count == 1 ) {
for my $a ( @range ) {
print "\e[${a}m$a\e[0m\n";
}
}
elsif ( $count == 2 ) {
for my $a ( @range ) {
for my $b ( @range ) {
print "\e[$a;${b}m$a;$b\e[0m\n";
}
}
} else {
for my $a ( @range ) {
for my $b ( @range ) {
for my $c ( @range ) {
print "\e[$a;$b;${c}m$a;$b;$c\e[0m\n";
}
}
}
}





