SHARYANTO::Role::ColorTheme - Role for class wanting to support color themes
version 0.72
This role is for class that wants to support color themes. For description about color themes, currently please refer to Text::ANSITable.
Color theme is a defhash containing v (float, should be 1.1), name (str), summary (str), no_color (bool, should be set to 1 if this is a color theme without any colors), and colors (hash, the colors for items).
v
name
summary
no_color
colors
A color should be a scalar containing a single color code which is 6-hexdigit RGB color (e.g. ffc0c0), or a hashref containing multiple color codes, or a coderef which should produce a color code (or a hash of color codes).
ffc0c0
Multiple color codes are keyed by: fg (RGB value for foreground), bg (RGB value for background), ansi_fg (ANSI color escape code for foreground), ansi_bg (ANSI color escape code for background). Future keys like css will be defined.
fg
bg
ansi_fg
ansi_bg
css
Allowing coderef as color allows for flexibility, e.g. for doing gradation border color, random color, etc (see Text::ANSITable::ColorTheme::Demo for an example). Code will be called with ($self, %args) where %args contains various information, like name (the item name being requested), etc. In Text::ANSITable, you can get the row position from $self->{_draw}{y}.
($self, %args)
%args
$self->{_draw}{y}
Get an item's color from the current color theme.
Get an item's color from the current color theme, converted to ANSI codes.
Convert a color from color theme (which can be a scalar containing color code, or a coderef that generates a color code) to ANSI escape code. %args will be sent to coderef.
Please visit the project's homepage at https://metacpan.org/release/SHARYANTO-Roles.
Source repository is at https://github.com/sharyanto/perl-SHARYANTO-Roles.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=SHARYANTO-Roles
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install SHARYANTO::Roles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SHARYANTO::Roles
CPAN shell
perl -MCPAN -e shell install SHARYANTO::Roles
For more information on module installation, please visit the detailed CPAN module installation guide.