krax

perl colorset

Sep 11th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.80 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # Author: Todd Larason <jtl@molehill.org>
  3. # $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 di
  4. ckey Exp $
  5.  
  6. # use the resources for colors 0-15 - usually more-or-less a
  7. # reproduction of the standard ANSI colors, but possibly more
  8. # pleasing shades
  9.  
  10. # colors 16-231 are a 6x6x6 color cube
  11. for ($red = 0; $red < 6; $red++) {
  12.     for ($green = 0; $green < 6; $green++) {
  13.         for ($blue = 0; $blue < 6; $blue++) {
  14.             printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
  15.                    16 + ($red * 36) + ($green * 6) + $blue,
  16.                    ($red ? ($red * 40 + 55) : 0),
  17.                    ($green ? ($green * 40 + 55) : 0),
  18.                    ($blue ? ($blue * 40 + 55) : 0));
  19.         }
  20.     }
  21. }
  22.  
  23. # colors 232-255 are a grayscale ramp, intentionally leaving out
Add Comment
Please, Sign In to add comment