new([rgb_txt=$rgb_file])> - constructor. Returns a Color::Rgb object.
Optionally accepts a path to the rgb.txt file. If you omit the file, it
will use the path in the $Color::Rgb::RGB_TXT variable, which defaults to
/usr/X11R6/lib/X11/rgb.txt. It means, instead of using rgb_txt=>
option, you could also set the value of the $Color::Rgb::RGB_TXT variable
to the correct path before you call the new() constructor (but definitely
after you load the Color::Rgb class with use or require).
Note: If your system does not provide with any rgb.txt file, Color::Rgb distribution includes one you can use instead.
name2rgb($name [,$delimiter]) - returns list of numeric Red, Green and Blue
values for a $name delimited (optionally) by a $delimiter . $name is
name of the color in the English language (Ex., black, red, purple etc.).
If name does not exist in the rgb.txt file it will return undef.
|o||name2hex($name [,$prefix]) - similar to rgb($name) method, but returns hexadecimal string representing red, green and blue colors, prefixed (optionally) with $prefix. If $name does not exist in the rgb.txt file it will return undef.|
|o||hex($name, [,$delimiter]) - alias to name2hex()|
|o||rgb($name, [,$delimiter]) - alias to name2rgb()|
rgb2hex($r, $g, $b [,$prefix]) - converts rgb value to hexadecimal string.
This method has nothing to do with the rgb.txt file, so none of the arguments
need to exist in the file.
hex2rgb(hex [,$delim]) - the opposite of rgb2hex(): takes a
hexadecimal representation of a color and returns a numeric list of Red,
Green and Blue. If optional $delim delimiter is present, it returns the
string of RGB colors delimited by the $delimiter. Characters like # and
0x in the beginning of the hexadecimal value will be ignored. Examples:
Note: hex2rgb() expects valid hexadecimal representation of a color in 6 character long string. If not, it might not work properly.
names([$pattern] - returns a list of all the names in the rgb.txt file.
If $pattern is given as the first argument, it will return only the names
matching the pattern. Example:
Following people contributed to this library with their patches and/or bug reports. (list is in chronological order)
o Marc-Olivier BERNARD <email@example.com> notified of the warnings that the library produced while warnings pragma enabled and improper parsed rgb values that contain single 0. This bug was fixed in 1.2 o Martin Herrmann <Martin-Herrmann@gmx.de> noticed a bug in rgb2hex() method which was failing if the blue value was a single 0. This problem is fixed in 1.3
Color::Rgb is a free software and can be modified and distributed under the same terms as Perl itself.
Color::Rgb is maintained by Sherzod B. Ruzmetov <firstname.lastname@example.org>.
Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 310: You forgot a =back before =head1
|perl v5.20.3||RGB (3)||2002-10-23|