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

NAME
Graphics::Toolkit::Color::Manual::Name - GTC color name handling

SYNOPSIS
This manual page explains all there is to know when using color names in GTC. The first chapter describes their role in the overall functionality of the library. The second defines their syntax. (How to write them?) The next outlines the coverage of the built-in names (default scheme). And the last chapter illustrates the concept of a color scheme and how to use them. This is important background to understand the results and inner workings of the methods: name and closest_name.

ROLE
Because it is intuitive and relatively effortless for humans to refer to colors by name, GTC can interpret them as a convenience. But after the name is read, it gets translated into RGB values, since most GTC functionality is about calculating numeric color values. So color names are just one format among many and thus mostly a part of the IO layer.

SYNTAX
Color names are mere strings that get normalized to allow a greater flexibility in usage. Upper and lower case can be chosen freely. And also some special characters like the underscore '_', dash '-', whitespace ' ', the apostrophe ' and the dot '.', that are even sometimes part of the official name, may be inserted or removed. That can sometimes improve readability ('true_red') or help you to adapt the spelling of color names to local standards without additional effort. GTC output will always contain normalized names without special characters and in complete lowercase.

There is only one character in GTC color names that holds a special meaning, which is the colon ':'. It separates the scheme name on the left side from the actual color name on the right ('SVG:green'). You might think of schemes as name spaces for color names. Color names without a colon are from the default scheme ('blue').

DEFAULT
The default scheme contains 716 color names which all can be retrieved with:

  my @names = Graphics::Toolkit::Color::Name::all();

But they can also be seen by name and with their color displayed under: "NAMES" in Graphics::Toolkit::Color::Name::Constant. They are assembled from the X11 and HTML (SVG) standard, which are most of the commonly used color names on the internet. But a lot of them are not aesthetically pleasing. For that reason also the colors of the Pantone reports were added. They often have longer, more complicated names but they are picked by designers.

Because the default scheme contains so many names, some colors end up with having several names. For that reason the names are grouped by importance, so if you ask for just one color name, you will get the better known one (for instance 'gray' and not 'gray50').

SCHEME
Besides the just mentioned default color name scheme, there are no other schemes that come with GTC. They have to be obtained separately. For instance to access the names of the SVG standard, you have to install the module Graphics::ColorNames::SVG, which of course depends on the module Graphics::ColorNames. The list of available schemes includes: Crayola, CSS, EmergyC, GrayScale, HTML, IE, Mozilla, Netscape, Pantone, PantoneReport, SVG, VACCC, Werner, Windows and WWW. The following code will check what is already installed:

   my @schemes = Graphics::ColorNames::all_schemes();

Conveniently all modules can be installed at once with Bundle::Graphics::ColorNames and you can also create your own, which is explained here.

AUTHOR
Herbert Breunung, <lichtkind@cpan.org>

COPYRIGHT
Copyright 2026 Herbert Breunung.

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