Graphics::Toolkit::Color::Name::Scheme(3)

NAME
Graphics::Toolkit::Color::Name::Scheme - a name space for color names

SYNOPSIS
    use Graphics::Toolkit::Color::Name::Scheme;
    my $scheme = Graphics::Toolkit::Color::Name::Scheme->new();
    $scheme->add_color( $_->{'name'}, $_->{'rgb_values'} ) for @colors;
    say for $scheme->all_names();
    my $values = $scheme->values_from_name( 'blue' );          # tuple = 3 element ARRAY
    my $names = $scheme->names_from_values( $values );         # tuple -> ARRAY of names
    my ($names, $distance) = $scheme->closest_name( $values ); # tuple -> \@names, $distance

DESCRIPTION
This module is mainly for internal usage to model name spaces for HTML, SVG, Pantone ... colors. You may use it to create your own set of color names or to give color name constants a slightly different value.

ROUTINES

  new
Needs no arguments.

  sub add_color
takes two positional arguments, a color name a n ARRAY with three RGB values in range of 0 .. 255.

  all_names
List of all names held by the scheme.

  is_name_taken
Pseudo boolean tells you if given name is already held.

  values_from_name
Returns the value tuple associated with the name.

  names_from_values
Returns ARRAY ref with all names associated with these RGB values or an empty string if none.

  closest_names
Returns ARRAY ref with all names associated with RGB values from this scheme that are the closest. Second return value is the distance between these closest names and the given value tuple (irst and only parameter).

SEE ALSO
Color::Library

Graphics::ColorNamesLite::All

COPYRIGHT & LICENSE
Copyright 2025-26 Herbert Breunung.

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

AUTHOR
Herbert Breunung, <lichtkind@cpan.org>