#!/usr/bin/env perl
#$Id: rgb.pl,v 1.3 2002/02/27 07:19:13 sakane Exp $
# Be eaten /usr/X11R6/lib/X11/rgb.txt.
$RGB='/usr/X11R6/lib/X11/rgb.txt';
$cstr = ' ';
print "
\n";
open(FP, $RGB);
while() {
if (/^\s*([\d]+)\s+([\d]+)\s+([\d]+)\s+([a-zA-Z0-9 ]+)$/) {
$n = sprintf "%02x%02x%02x", $1, $2, $3;
$cv{$n} = $4;
$cn{$4} = $n;
}
}
close FP;
# ôÀôÀôÀ
print "\n";
$i = 0;
foreach (sort keys %cv) {
printf "%s", ($i % 3 == 0) ? "" : "";
printf "| %s | ", $_, $cstr;
printf "#%s | ", $_;
printf "%s | %s", $cv{$_};
printf "%s", ($i % 3 == 2) ? "
" : "";
$i++;
}
print "\n" if ($i%3!=2);
print "
\n";
print "
\n";
print "\n";
$i = 0;
foreach (sort keys %cn) {
printf "%s", ($i % 3 == 0) ? "" : "";
printf "| %s | ", $cn{$_}, $cstr;
printf "#%s | ", $cn{$_};
printf "%s | %s", $_;
printf "%s", ($i % 3 == 2) ? "
" : "";
$i++;
}
print "
\n";