named palette presets fire, whites
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 23 Sep 2019 15:40:45 +0000 (17:40 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 24 Sep 2019 00:08:51 +0000 (02:08 +0200)
Inspired by <https://github.com/sindresorhus/sparkly>, a js spark port.
Different from its {style:'fire'} in being 16-color compatible and having
red at the lower end (matching lower temperature to low values).

barcat
t/t0002-usage_-h_|wc_-l.out

diff --git a/barcat b/barcat
index 15a2269c9829079d81e0b86368e9a398e3d566f4..ad6ccab98ffdaf7ad0eaab230979ff1fbbecff05 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -52,8 +52,11 @@ GetOptions(\%opt,
        'spark:s' => sub {
                $opt{spark} = [split //, $_[1] || '▁▂▃▄▅▆▇█'];
        },
        'spark:s' => sub {
                $opt{spark} = [split //, $_[1] || '▁▂▃▄▅▆▇█'];
        },
-       'palette:s' => sub {
-               $opt{palette} = [ split /\s/, $_[1] ];
+       'palette=s' => sub {
+               $opt{palette} = {
+                       fire   => [qw( 90 31 91 33 93 97 96 )],
+                       whites => [qw( 1;30 0;37 1;37 )],
+               }->{$_[1]} // [ split /\s/, $_[1] ];
        },
        'stat|s!',
        'signal-stat=s',
        },
        'stat|s!',
        'signal-stat=s',
@@ -396,7 +399,7 @@ Bars extend from 0 or the minimum value if lower,
 to the largest value encountered.
 These options can be set to customize this range.
 
 to the largest value encountered.
 These options can be set to customize this range.
 
-=item --palette=<color>...
+=item --palette=(<preset> | <color>...)
 
 Override colors of parsed numbers.
 Can be any CSI escape, such as I<90> for default dark grey,
 
 Override colors of parsed numbers.
 Can be any CSI escape, such as I<90> for default dark grey,
index 8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 100644 (file)
@@ -1 +1 @@
-35
+36