X-Git-Url: http://git.shiar.net/barcat.git/blobdiff_plain/ca6b20aa1d3f9ca870d0a26a802b9a263218ea79..7353470c733658bd4645085180191f2bfd918ab5:/barcat diff --git a/barcat b/barcat index 15a2269..804b3b0 100755 --- a/barcat +++ b/barcat @@ -52,8 +52,22 @@ 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 )], + fire88 => [map {"38;5;$_"} qw( + 80 32 48 64 68 72 76 77 78 79 47 + )], + fire256=> [map {"38;5;$_"} qw( + 235 52 88 124 160 196 + 202 208 214 220 226 227 228 229 230 231 159 + )], + ramp88 => [map {"38;5;$_"} qw( + 64 65 66 67 51 35 39 23 22 26 25 28 + )], + whites => [qw( 1;30 0;37 1;37 )], + greys => [map {"38;5;$_"} 52, 235..255, 47], + }->{$_[1]} // [ split /[^0-9;]/, $_[1] ]; }, 'stat|s!', 'signal-stat=s', @@ -87,7 +101,7 @@ GetOptions(\%opt, }, ) or exit 64; # EX_USAGE -$opt{width} ||= $ENV{COLUMNS} || 80; +$opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80; $opt{color} //= -t *STDOUT; # enable on tty $opt{'graph-format'} //= '-'; $opt{trim} *= $opt{width} / 100 if $opt{trimpct}; @@ -396,7 +410,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,