Colormap Source Code

Hextractor: Show me your style

This PHP colormapping code was originally written for use in Hextractor, a tool for web designers and developers to generate an HTML color palette from CSS. After Hextractor was finished I thought this class may be useful to others as well so I've made the source available here under the terms of the MIT license.

Upon further thought, I also ported it to Ruby and James Bennett has written his own in Python.

These cwColorMap classes contain a mapping of the full list of 147 HTML named colors to their hexadecimal equivilants, as well as methods to convert colors in hexadecimal, RGB, or these named colors, into any other of these three formats. You are free to use this code in your own application, for any purpose whatsoever. Include credit and a link back to Corvid Works if you wish, but this is not required.

Download

James Bennett's Python version is called webcolors and is available from the Python package repository and is released under the BSD license.