I have written a public domain color picker in JavaScript. As you requested, I've now added a feature that shows a color in the format RRGGBBAA, with hexadecimal components.
- Demo: http://peteroupc.github.com/colorpicker/ (Look at the example "Alpha Color Picker (RRGGBBAA format)".)
- Source code: https://github.com/peteroupc/colorpicker
To enable this feature, give the text boxes an ID starting with "rgbahex_", as in this example:
<input type="text" value="ff0000ff" name="c2" id="rgbahex_c2">
By doing so, the text box will be converted into a color picker. It will only work, though, if the input box appears in the HTML before the page is fully loaded. If you're creating color pickers at runtime, use the following JavaScript to set it up:
textbox.value="ff0000ff";
PDColorPicker.setColorPicker(textbox,{rgbahex:true});
setColorPicker
will also convert the text box to a color picker.
I've updated the color picker to add the colorformat AARRGGBB. Use argbhex
instead of rgbahex
in the examples above.
You can also start a text box's class name with "rgbahex_", "argbhex_", and so on, rather than the ID, to turn, to turn the text box into a color picker. I think this corresponds to the styleClass
attribute in your XML.