Mattia Barbon > Acme-Colour-Fuzzy-0.02 > Acme::Colour::Fuzzy

Download:
Acme-Colour-Fuzzy-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Acme::Colour::Fuzzy - give names to arbitrary RGB triplets

SYNOPSIS ^

  # specify colour set, default is VACCC
  my $fuzzy = Acme::Colour::Fuzzy->new( 'VACCC' );

  # list of similar colours, sorted by similarity
  my @approximations = $fuzzy->colour_approximations( $r, $g, $b, $count );

  # made-up name for the colour
  my $name = $fuzzy->colour_name( $r, $g, $b );

DESCRIPTION ^

This module uses sophisticated colour-distance metrics and some made-up computations to give a likely name to an arbitrary RGB triplet.

METHODS ^

new

  my $fuzzy = Acme::Colour::Fuzzy->new( $colour_set );

Creates a new Acme::Colour::Fuzzy object using the specified colour set. The coolour set can be any backend for Graphic::ColorNames with 'VACCC' as default.

colour_approximations

  my @approximations = $fuzzy->colour_approximations( $r, $g, $b, $count );

Returns a list of at most $count colours similar to the given one. Each element of the list is an hash with the following structure:

  { name     => 'Red', # name taken from Graphics::ColourNames
    distance => 7.1234567,
    rgb      => [ 255, 0, 0 ],
    }

colour_name

  my $name = $fuzzy->colour_name( $r, $g, $b );

Makes up a colour name using the data computed by colour_approximations.

SEE ALSO ^

Color::Distance::HCL

AUTHOR ^

Mattia Barbon, <mbarbon@cpan.org>

COPYRIGHT ^

Copyright (C) 2007, Mattia Barbon

This program is free software; you can redistribute it or modify it under the same terms as Perl itself.

syntax highlighting: