App-Adenosine
    
    
  
  
  
view release on metacpan or search on metacpan
lib/App/Adenosine/Plugin/Rainbow.pm view on Meta::CPAN
   $arg = { fg => $arg } unless ref $arg;
   for (qw(fg bg)) {
      $arg->{$_} = $old_colormap{$arg->{$_}}
         if $arg->{$_} && exists $old_colormap{$arg->{$_}}
   }
   $str = Term::ExtendedColor::fg($arg->{fg}, $str ) if $arg->{fg};
   $str = Term::ExtendedColor::bg($arg->{bg}, $str ) if $arg->{bg};
   $str = Term::ExtendedColor::bold($str           ) if $arg->{bold};
   $str = Term::ExtendedColor::italic($str         ) if $arg->{italic};
   $str = Term::ExtendedColor::underline($str      ) if $arg->{underline};
   return $str;
}
has response_header_colon_color => (
   is => 'ro',
   default => sub { 'blue' },
);
lib/App/Adenosine/Plugin/Rainbow.pm view on Meta::CPAN
 $p->colorize('red1', 'Christmas') . ' ' . $p->colorize('green1', 'tree!');
C<colorize> is the method used to highlight all the pieces that come from the
curl output.  It takes two arguments, first a color specification, and next the
string to be colorized.  The complete color specification is defined as:
 {
    fg         => $color,
    bg         => $color,
    bold       => $is_bold,
    italic     => $is_italic,
    underline  => $is_underline,
 }
All of the keys in the hash are optional.  The values for $color can be found
at L<Term::ExtendedColor/Standard color map>.  Additionally I've added a form
of "legacy support" for named 16 color mode. Those colors are actually
arbitrary and most consoles allow you to redefine them, so the names I gave are
just the defaults.  My named colors are:
lib/App/Adenosine/Plugin/Rainbow.pm view on Meta::CPAN
 magenta
 bright_cyan
 bright_white
As a shortcut, if you pass a simple string instead of a hashref it wil be
explanded to C<< { fg => $str } >>.
Note that unfortunately support for all the attributes are spotty.
For example on my computer I use tmux 1.6 running within terminator 0.96.
In this situation I can't use any of the non-color attributes.  Outside of
tmux C<underline> works, but the others do not.  Similarly, C<bold> only
seems to work with some colors.  It's pretty frustrating, and experimentation
seems necesary.
=head2 Overriding colors at runtime
To change a color when you run C<adenosine> instantiate it as follows:
 #!/usr/bin/env perl
 use lib 'path/to/adenosine/lib';
( run in 0.260 second using v1.01-cache-2.11-cpan-5dc5da66d9d )