Graphic...:Scheme(3)

πŸ“¦
version 1.972 Β· 2 versions
, in fedora 44

πŸ’– Graphics::Toolkit::Color::Name::Scheme πŸ’–

okay bestie so this is a manual page from User Contributed Perl Documentation, and we're talking about Graphics::Toolkit::Color::Name::Scheme β€” literally a name space for color names. that's the whole vibe. let's get into it πŸŽ€


✨ 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 🌸

so this module is mainly for internal usage β€” it models name spaces for HTML, SVG, Pantone ... colors. that's the job, that's the assignment, and it ate πŸ’…

but you can also use it yourself to create your own set color names, or to give color name constants slightly different values. customizing your lil color world, iconic behavior honestly πŸ¦‹


🧚 ROUTINES 🧚

⭐ new

Needs no arguments. that's it. that's the whole thing. low maintenance king πŸ‘‘

⭐ sub add_color

takes two positional arguments: a color name, and an ARRAY with three RGB values in range of 0 .. 255. no cap, just feed it the name and the numbers πŸ“

⭐ all_names

List of all names held by the scheme. the whole roster, the full lineup πŸ’œ

⭐ is_name_taken

Pseudo boolean that tells you if the given name is already held. like, is this name claimed or not bestie πŸ™ˆ

⭐ values_from_name

Returns the value tuple associated with the name. name in, tuple out ✨

⭐ names_from_values

Returns an ARRAY ref with all names associated with these RGB values, or an empty string if none. so heads up β€” sometimes it's an array ref, sometimes it's just an empty string. not me noticing that little quirk 😭

⭐ closest_names

Returns an 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 β€” which is the first and only parameter, iykyk 🫢


πŸ‘€ SEE ALSO πŸ‘€

  • Color::Library
  • Graphics::ColorNamesLite::All

Copyright 2025 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>


and that's the whole page, bestie!! πŸ’– big slay to Herbert Breunung for writing it, and this one's running on perl v5.42.0 with a date of 2026-01-17. periodt βœ¨πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from