Colour Name to RGB/Hex/HSL/HSV etc
I have come across this great function/command. Colour to RGB, you can do this:
col2开发者_StackOverflow中文版rgb("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
The canonical CSS color names originated in X11 and the intersection of the sets - along with their RGB values can be - found at Wikipedia.
A more easily parsed list can be found in various rgb.txt files scattered over the web, but these are likely the X11 set not the CSS set.
added: Given an RGB value you can compute nearby colors by HSL conversion. Color palettes - sets of colors that go well together - are an art not a science, Google 'em.
Why don't you use the ccs Color names. W3c webstandard --> CSS3/SVG Farben
精彩评论