Colour Name to RGB/Hex/HSL/HSV etc

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2010-04-04T01:20:23Z Indexed on 2010/04/04 1:23 UTC
Read the original article Hit count: 693

Filed under:
|
|
|
|

Hello all,

I have come across this great function/command. Colour to RGB, you can do this:

col2rgb("peachpuff")
//returns hex

It will return one hex value. I want to extend this using Perl, Python or PHP but I want to be able to pass in, for example, "yellow" and the function returns all types of yellows - their hex/rgb/?/etc value.

I already have a quick solution implemented, which involves mapping colour names to hex values but now I want to get more precise and use some formulas etc to determine what's what.

However, as usual, I don't have a clue on how to do this! So I appreciate any implementation advice on how to do this.

Thanks all

© Stack Overflow or respective owner

Related posts about rgb

Related posts about color