App-ColorNamer

 view release on metacpan or  search on metacpan

lib/App/ColorNamer.pm  view on Meta::CPAN

return the closest match; and C<exact> key will be absent.

=head3 C<name>

    {
        'name' => 'Mint Green',
    ...

This key will contain the name of the color that is closest to the
color you provided. For a full list of
colors known to the module, see C<known_colors()> method.

=head3 C<hex>

    {
        'hex' => '98ff98'
    ...

This key will contain six hexadecimal digits representing the color
that is closest to the one you provided.

=head3 C<rgb>

    {
        'rgb' => {
            'r' => 152,
            'b' => 152,
            'g' => 255     
        },
    ...

This key will contain a hashref with three values that represent
RGB (red, green, and blue) values of the matched color. The keys for
those values are C<r>, C<b> and C<g> for red, green and blue values
respectively. These values will be decimal.

=head3 C<hsl>

    {
        'hsl' => {
            'l' => '0.798039215686275',
            'h' => 120,
            's' => 1
        },
    ...

This key is the same as C<rgb>, except this one specifies the
HSL (hue, saturation, lightness) values. The keys for the values are
C<h>, C<s> and C<l> for hue, saturation and lightness respectively.

=head2 C<error>

    my $color = $app->get_name('98ff98')
        or die $app->error;

If C<get_name()> method fails, the error will be available as a human
readable string returned by C<error()> method.

=head2 C<known_colors>

    use Data::Dumper;
    print Dumper $app->known_colors;

    $VAR1 = {
        'rgb' => {
                   'r' => 255,
                   'b' => 240,
                   'g' => 255
                 },
        'name' => 'Ivory',
        'hsl' => {
                   'l' => '0.970588235294118',
                   'h' => 60,
                   's' => 1
                 },
        'hex' => 'fffff0'
      },
      {
        'rgb' => {
                   'r' => 255,
                   'b' => 255,
                   'g' => 255
                 },
        'name' => 'White',
        'hsl' => {
                   'l' => 1,
                   'h' => 0,
                   's' => 0
                 },
        'hex' => 'ffffff'
      }
    ....

Takes no arguments. Returns an arrayref, each element of which is
a hashref that represents one known to the plugin color. The format
of the hashrefs are the same as of that returned by C<get_name()>
method.

=head2 C<sane_colors>

    my $current_sane_colors = $app->sane_colors;

    # adds 'Rose White', 'Baja White', and 'Gin Fizz' to sane colors
    push @$current_sane_colors, qw/FFF6F5  FFF8D1  FFF9E2/;
    $app->sane_colors( $current_sane_colors );

Returns an arrayref with 6-digit hex codes of colors that
the module accredits with "sanity". This means those are the colors
that I could imagine when I read the name (see LIST OF SANE COLORS
section below). Can be called with one optional argument, which
must be an arrayref. When specified, each element of the arrayref
must be a hexadecimal code of one of the colors known to the module
(see C<known_colors()> method above); and the new list of colors
will be the new "sane colors". In other words, these will be
the only colors plugin will consider when second argument to
C<get_name()> method is set to a true value.

=head2 C<color>

    my $last_color = $app->color;



( run in 0.479 second using v1.01-cache-2.11-cpan-39bf76dae61 )