print color table for 256 color xterm

This commit is contained in:
hjp 2016-07-05 19:30:30 +00:00
parent 0c72134b24
commit 378a0a9f70
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/usr/bin/perl
for my $i (0 .. 255) {
print fg(0), bg(15), sprintf("%3d", $i), " : ", bg($i), "x" x 10, rst(), "\n";
}
sub fg {
my ($idx) = @_;
return "\033[38;5;${idx}m";
}
sub bg {
my ($idx) = @_;
return "\033[48;5;${idx}m";
}
sub rst {
return "\033[0m";
}