Name

luminance — return luminance for a color name

Synopsis

GIFgraph::colour::_luminance(R, G, B)

This method will return the luminance of a color represented by the given RGB list. The luminance is represented as a floating point number in the range to 1, where is black and 1 is white. For example:

use GIFgraph::colour qw(:colours);
print _luminance(255, 105, 180);          # This is a dark pink

will give us a value of .558091470588235. You probably will never need to know a color’s luminance to this degree of precision, but it’s there if you need it.

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.