Graphic...r::Name(3)

πŸ’– Graphics::Toolkit::Color::Name β€” the perl manual page, bestie edition πŸ’–

okay so this is a User Contributed Perl Documentation page, manual section 3, for Graphics::Toolkit::Color::Name. it lives in your perl install, and honestly? it's giving translator. color name in, numbers out. numbers in, color name out. slay. πŸŽ€


✨ NAME ✨

Graphics::Toolkit::Color::Name β€” translate color names to values and vice versa πŸ¦‹


✨ SYNOPSIS ✨

here's the whole vibe in code, no notes:

use Graphics::Toolkit::Color::Name;
my @names = Graphics::Toolkit::Color::Name::all('HTML', 'default');
my $values = Graphics::Toolkit::Color::Name::get_values('green');
my $values = Graphics::Toolkit::Color::Name::get_values('green', [qw/SVG X/]);
my $name = Graphics::Toolkit::Color::Name::from_values([0, 128, 0]);
my $name = Graphics::Toolkit::Color::Name::from_values([0, 128, 0], 'HTML');
my ($name, $distance) = Graphics::Toolkit::Color::Name::closest_from_values(
                            [0, 128, 0], [qw/CSS Pantone/], 'all');

Graphics::Toolkit::Color::Name::add_scheme( $scheme, 'custom' );

✨ DESCRIPTION ✨

okay so picture this: this module autoloads and holds a whole set of color schemes, and inside those schemes live color names with their associated RGB values. those are your color name spaces, bestie. πŸ’…

there's a default scheme, and then there's extra ones that get fed in by Graphics::ColorNames::* modules. those have to be installed separately, so heads up. πŸ™ˆ and for your convenance (yes, that's the word, we're keeping it), the author created Bundle::Graphics::ColorNames to install them all at once β€” which also frees you from the search of which module provides which space (some provide several, because of course they do 😭).

this module also provides methods that search in those schemes. and wherever a method accepts a color scheme name, it will default to the default name space β€” but it also accepts an ARRAY with several scheme names. versatile icon. πŸ‘‘


✨ SCHEMES ✨

acceptable scheme names are currently:

  • Crayola
  • CSS
  • EmergyC
  • GrayScale
  • HTML
  • IE
  • Mozilla
  • Netscape
  • Pantone
  • PantoneReport
  • SVG
  • VACCC
  • Werner
  • Windows
  • WWW
  • X (X11)

that's the whole roster, periodt. ⭐


✨ ROUTINES ✨

🌸 all

returns a list of color names constants of the default schema. every argument you pass is interpreted as a scheme name. if you provide some, the method shows only the names from those schemes. 🫢

🌸 get_values

accepts two arguments. the first one is required and it's a color name. the result will be the RGB value tuple (ARRAY) of that color. ✨

optionally you can hand it a second argument, which is a color scheme name β€” and if you don't, the default scheme is used. > please note this is the only routine in this lib where you can provide only one scheme. πŸ’€ that's a real limitation, not a vibe.

🌸 from_values

this method works the other way around from the previous one. it takes an RGB value tuple and returns a color name if possible. and if no stored color has the exact same values? you get an empty string. 😭

the search is limited to the default color scheme, unless you provide the name of another scheme β€” or several of them in an ARRAY β€” as the second argument.

if the provided values belong to several color names, only the first one is returned, which is in many cases the most popular. and if you provide the third positional argument with a positive pseudo boolean, you get all found color names. obsessed. πŸ”₯

🌸 closest_from_values

this method gets the same parameters and works almost the same way as the previous method. the big difference: the search is not for an exact match but the closest one (Euclidean distance). 🧚

this way you are guaranteed to get one or several names in return. these names have to be delivered inside an ARRAY ref, because there is a second return value β€” the distance between the provided values and the found color. two-for-one, we love to see it. πŸ’œ


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


okay and for the little sign-off moment: this page is from perl v5.42.0, dated 2026-01-17, and it's the Graphic...r::Name(3) page β€” yes the title got truncated in the header, that's just how it renders, don't panic bestie. πŸŽ€βœ¨ bye, go name some colors πŸ’…

πŸ“¦ where this page comes from