rainbow (lolcat) colour palette
[barcat.git] / barcat
diff --git a/barcat b/barcat
index 253ec8685c81d922d87c5d189af3770e4f160628..54141ee247a58f552644cf2d536eb4eaa0647d8e 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -64,6 +64,16 @@ GetOptions(\%opt,
                        )],
                        whites => [qw( 1;30 0;37 1;37 )],
                        greys  => [map {"38;5;$_"} 0, 232..255, 15],
+                       rainbow=> [map {"38;5;$_"}
+                               196, # r
+                               (map { 196 + $_*6   } 0..4), # +g
+                               (map { 226 - $_*6*6 } 0..4), # -r
+                               (map {  46 + $_     } 0..4), # +b
+                               (map {  51 - $_*6   } 0..4), # -g
+                               (map {  21 + $_*6*6 } 0..4), # +r
+                               (map { 201 - $_     } 0..4), # -b
+                               196,
+                       ],
                }->{$_[1]} // [ split /[^0-9;]/, $_[1] ];
        },
        'stat|s!',
@@ -657,6 +667,10 @@ Sparkline graphics of simple input given as inline parameters:
 
     barcat -_ 3 1 4 1 5 0 9 2 4
 
+Misusing the spark functionality to draw a lolcat line:
+
+    seq $(tput cols) | barcat --spark --indicator=- --palette=rainbow
+
 =head1 AUTHOR
 
 Mischa POSLAWSKY <perl@shiar.org>