App-colorxform
view release on metacpan or search on metacpan
script/colorxform view on Meta::CPAN
#!perl
our $DATE = '2018-09-07'; # DATE
our $VERSION = '0.002'; # VERSION
use 5.010001;
use strict;
use warnings;
use Perinci::CmdLine::Any;
Perinci::CmdLine::Any->new(
url => '/App/colorxform/colorxform',
)->run;
# ABSTRACT: Transform colors on the CLI
# PODNAME: colorxform
__END__
=pod
=encoding UTF-8
=head1 NAME
colorxform - Transform colors on the CLI
=head1 VERSION
This document describes version 0.002 of colorxform (from Perl distribution App-colorxform), released on 2018-09-07.
=head1 SYNOPSIS
Usage:
% colorxform [options]
=head1 DESCRIPTION
Some CLI programs output horrible colors (e.g. hard to read on terminal with
black background) and the colors are either uncustomizable or cumbersome to
customize. This is where C<colorxform> comes in. You pipe the output and it will
replace some colors with another, per your specification.
An example, put this in your C<~/.config/colorxform.conf>:
[profile=ledger]
fg_transforms = {"blue":"#18b2b2", "red":"bold red"}
then:
% ledger -f myledger.dat --color --force-color balance | colorxform -P ledger
You can create a shell alias for convenience:
% function ledger() { C<which ledger> --color --force-color "$@" | colorxform -P ledger; }
so you can just issue this to get the colors transformed:
% ledger -f myledger.dat balance
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--bg-transforms-json>=I<s>
See C<--bg-transforms>.
=item B<--bg-transforms>=I<s>
Default value:
{}
List of background colors to replace with other colors. You can specify color
using RGB code (e.g. `#123456`) or color names like those recognized by
<pm:Term::ANSIColor> (e.g. `blue` or `bold blue`).
=item B<--fg-transforms-json>=I<s>
See C<--fg-transforms>.
=item B<--fg-transforms>=I<s>
Default value:
{}
List of foreground colors to replace with other colors. You can specify color
code using RGB code (e.g. `#123456`) or color names like those recognized by
<pm:Term::ANSIColor> (e.g. `blue` or `bold blue`).
=back
=head2 Configuration options
=over
=item B<--config-path>=I<filename>, B<-c>
Set path to configuration file.
=item B<--config-profile>=I<s>, B<-P>
Set configuration profile to use.
=item B<--no-config>, B<-C>
Do not use any configuration file.
=back
=head2 Environment options
=over
=item B<--no-env>
Do not read environment for default options.
=back
=head2 Output options
=over
=item B<--format>=I<s>
Choose output format, e.g. json, text.
Default value:
undef
=item B<--json>
Set output format to json.
=item B<--naked-res>
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,"OK",[1,2,3],{"func.extra"=>4}]
( run in 1.028 second using v1.01-cache-2.11-cpan-39bf76dae61 )