From 628cc78d7f81eaad4f0a06a26afc171d2667e685 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 23 Sep 2019 17:40:45 +0200 Subject: [PATCH] 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). --- barcat | 9 ++++++--- t/t0002-usage_-h_|wc_-l.out | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) 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 -- 2.30.0