]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/colortable
.mintty/colors: Lighten solarized-alt background
[dotfiles.git] / bin / colortable
1 #!/usr/bin/perl
2 # Usage: colortable
3 # Print a color table of ANSI colors (normal+bright)
4
5 sub printrow {
6 $bg = $_[0];
7 for ($bright = 0; $bright < 2; $bright++) {
8 # Normal background
9 $bgc = $bg;
10 printf("\x1b[0m %2s ",$bgc);
11 for ($fg=30; $fg<=37; $fg++) {
12 $fgc = $bright == 1 ? ($fg+60) : $fg;
13 printf("\x1b[%sm\x1b[%sm %2s ", $bgc, $fgc, $fgc);
14 }
15 if ($bg > 0) {
16 # Bright background
17 $bgc = $bg+60;
18 printf("\x1b[0m %3s ",$bgc);
19 for ($fg=30; $fg<=37; $fg++) {
20 $fgc = $bright == 1 ? ($fg+60) : $fg;
21 printf("\x1b[%sm\x1b[%sm %2s ", $bgc, $fgc, $fgc);
22 }
23 }
24 printf("\x1b[0m\n");
25 }
26 }
27
28 # No background
29 for ($bg=0; $bg<=0; $bg++) {
30 printrow $bg;
31 }
32 # Background 40-47 (standard)
33 for ($bg=40; $bg<48; $bg++) {
34 printrow $bg;
35 }