NAME Graphics::ColorNames - defines RGB values for common color names SYNOPSIS use Graphics::ColorNames qw( hex2tuple ); tie %NameTable, 'Graphics::ColorNames', 'X'; my $rgbhex = $NameTable{'green'}; # returns '00ff00' my @rgbtup = hex2tuple( $rgbhex ); # returns (0, 255, 0) DESCRIPTION This module defines RGB values for common color names. The intention is to (1) provide a common module that authors can use with other modules to specify colors; and (2) free module authors from having to "re-invent the wheel" whenever they decide to give the users the option of specifying a color by name rather than RGB value. Usage The interface is through a tied hash: tie %NAMETABLE, 'Graphics::ColorNames', SCHEME where `%NAMETABLE' is the tied hash and `SCHEME' is the color scheme. Currently three schemes are available: X 550 color names used in X-Windows. *This is the default naming scheme*, since it provides the most names. HTML 16 common color names defined in the HTML 4.0 specification. These names are also used with CSS and SVG. Windows 16 commom color names used with Microsoft Windows and related products. These are actually the same colors as `HTML', although with different names. RGB values can be retrieved with a case-insensitive hash key: $rgb = $colors{'AliceBlue'}; The value returned is in the six-digit hexidecimal format used in HTML and CSS (without the initial '#'). To convert it to separate red, green, and blue values (between 0 and 255), use the `hex2tuple' function: @rgb = hex2tuple( $colors{'AliceBlue'} ); The `hex2tuple' function is not exported by default. You must specify it explicitly when you 'use' the module. CAVEAT This module is experimental. The interface may change. AUTHOR Robert Rothenberg LICENSE Copyright (c) 2001 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.