Color code generator

Color codes in RGB & Hex: Mix your own colour and generate the colour code. A nice little javascript app.

This may be used eg. as a colour selection control/plugin for a web-based app. The Javascript code features ways to manipulate hex-codes, extract color code from CSS, and convert from RGB to hex value.

Try it


The full source code is in the <head> section of this page. Use the "View Source" function of your browser to get it. You may want to get the inline styles as well as the javascript.


To use it, just call "showColorMixer()" where you want it to show up. Like this:


Note: The script should only be shown once per page because the code relies on CSS Element ID's. As a CSS Element ID is intended to identify one specific element on a page using the script twice on one page will not work as intended. If you want to use the script multiple times on one page you will need to modify it.

Version history

Version 3: current version (even smaller + js function names now in camelCase)

Version 2: js made smaller, still readable

Version 1: initial version


What? Free!