Welcome to the Monastery | |
PerlMonks |
RGB values and color nameby mdog (Pilgrim) |
on Aug 25, 2003 at 18:24 UTC ( [id://286445]=perlquestion: print w/replies, xml ) | Need Help?? |
mdog has asked for the wisdom of the Perl Monks concerning the following question:
Brethern -- Is there a way to pass an RGB value to a function/module/etc and get back a fairly simple color name? All I am looking to do is determine if a color is red, black, green, yellow, blue, etc (not mauve, terracotta, or taupe) based on it's RGB value. The RGB value is not something nice and round like 255,0,0 for red but 223,8,13 (which still looks really red). So I can't do a look up in rgb.txt because there isn't an entry for that color. I have tried using GD's and then turn that into an RGB colorset so I can do a look up of the color via: But for the example I gave for red above, it returns the exact same RGB numbers. Couldn't find any modules on CPAN that would do what I want or out on the Net. I figure this is a kind of subjective request ("does this look blue to you?") and that I'll probably have to write a routine that has a range of numbers that "equal" blue or red or whatever but am hoping this has already been done. Thanks, Matt
Back to
Seekers of Perl Wisdom
|
|