App-Colorist
view release on metacpan or search on metacpan
lib/App/Colorist.pm view on Meta::CPAN
silver (7) white (15)
These are the most common ways to color text. If just a single name is given this way, it is the color of the foreground or text itself.
=item *
B<Numeric color.> Another option is to assign each a color. For most terminals, this can be any integer in the 0-15 range with the colors usually being like those named above. If you use a terminal that supports it, you may use numbers in the 0-255 r...
=item *
B<Color pair.> If you would like to set the background color, you may do so by setting the color to a hash (or object, if you prefer). The keys in the hash are "fg" for setting the foreground color and "bg" for setting the background. The color itsel...
=item *
B<Gray scale.> For terminals supporting 256 colors, you may use the gray scale by setting the color name to a 1-tuple (single element array) containing the numeric index of the shade of gray you want to use. In these scheme, C<[0]> is black and C<[23...
=item *
B<RGB color.> The final option is to use a 3-tuple (an array with 3 elements) to use one of the 216 colors available on 256 color terminals. As with most representations of the sort, the first index is red, the second is green, and the third is blue....
=back
lib/App/Colorist/Colorizer.pm view on Meta::CPAN
=head2 get_fg
my $code = $c->get_fg(10);
Returns the escape code required to change the foreground color to the given color number.
=head2 get_bg
my $code = $self->get_bg(10);
Returns the escape code that will change the background color to the given color code.
=head2 gray
my $number = $c->gray(10);
Given a number identifying the desired shade of gray, returns that color number. Only works on terminals supporting 256 colors.
=head2 rgb
my $number = $c->rgb(1, 3, 4);
lib/App/Colorist/Colorizer.pm view on Meta::CPAN
Returns the escape code for changing the foreground color to the given color identifier.
=head2 bg
my $code = $c->bg('blue');
my $code = $c->bg(10);
my $code = $c->bg([ 8 ]);
my $code = $c->bg([ 1, 2, 3 ]);
Returns the escape code for changing the background color to the given color identifier.
=head2 c
my $code = $c->c('rufus');
Given the name of a color defined in the colorset, returns the escape codes defined for that color to change the background and foreground as configured.
=head2 run
Runs the colorization process to colorize input and send that to the output.
=head2 readline
Given an L<IO::Select> object, returns the first line it finds from the selected
file handles. This handles all buffering on the file handles and blocks until a
complete line is available. It returns only the first line that comes available.
t/rules/test/colors.yml view on Meta::CPAN
---
# Since not everyone likes the same colors. The keys here depend on the ruleset
# (named in the arrays following each regex). The values define the color to
# use for that rule keyword as follows:
#
# * no color: To make no special color for that title use ~ (undef)
# * foreground color: To set only the foreground color, provide the name,
# index, or array look up described below for colors to define them.
# * foreground & background color: You need to provide a hash with two keys:
# "fg" and "bg". Each of these keys is set to the color name, index, or
# array lookup.
#
# For example:
#
# DEFAULT: ~
# name: ~
# url: white
# title: { fg: ~, bg: purple }
# spam: [ 14 ]
# calamity: { fg: [ 1, 1, 3 ], bg [ 0, 0, 1 ] }
#
# Here "name" is given no extra color, "url" will have white text in the
# foreground, "title" is printed on a purple background, "spam" will be a shade
# of gray tending toward white on a 256 color screen, and "calamity" will be a
# shade of blue gray in the foreground on a background of dark green on a 256
# color screen.
#
# There is also one special key, "DEFAULT", which can be given a foreground and
# or background color to give everything unmatched a color of your choice.
#
# Colors are named like this:
#
# For standard ANSI colors:
# * black (0) * gray (8)
# * maroon (1) * red (9)
# * green (2) * lime (10)
# * olive (3) * yellow (11)
# * navy (4) * blue (12)
# * purple (5) * fuschia (13)
( run in 0.917 second using v1.01-cache-2.11-cpan-f4a522933cf )