From: Mischa POSLAWSKY Date: Mon, 23 Sep 2019 15:40:45 +0000 (+0200) Subject: named palette presets fire, whites X-Git-Tag: v1.07~37 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/628cc78d7f81eaad4f0a06a26afc171d2667e685?ds=sidebyside named palette presets fire, whites Inspired by , 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). --- diff --git a/barcat b/barcat index 15a2269..ad6ccab 100755 --- a/barcat +++ b/barcat @@ -52,8 +52,11 @@ GetOptions(\%opt, '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', @@ -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. -=item --palette=... +=item --palette=( | ...) Override colors of parsed numbers. Can be any CSI escape, such as I<90> for default dark grey, diff --git a/t/t0002-usage_-h_|wc_-l.out b/t/t0002-usage_-h_|wc_-l.out index 8f92bfd..7facc89 100644 --- a/t/t0002-usage_-h_|wc_-l.out +++ b/t/t0002-usage_-h_|wc_-l.out @@ -1 +1 @@ -35 +36