PitPik / tinyColorPicker

Tiny jQuery color picker for mobile and desktop with alpha channel
http://www.dematte.at/tinyColorPicker/
MIT License
276 stars 77 forks source link

Using color names for an input value results in #NANNANNAN #60

Closed onet4 closed 8 years ago

onet4 commented 8 years ago

The input value becomes #NANNANNAN even when the name is defined in the colorNames option under the following conditions,

<input class="color" value="cyan" />
PitPik commented 8 years ago

Hi @onet4, well, tinyColorPicker can only work with HEX, rgb(a) and hsl(a). There is no way around this. What you can do is, use renderCallback to calculate the color name (from an array...) and display this value wherever you need to do so (also as value in a hidden input field). See demos for how to be able to use renderCallback.

In the demo you saw, where colorNames is defined as option, colorNames is actually only an optional option, not really used by colorPicker but used in renderCallback. You could use colorNames in this example also as an "external" variable...

Good luck and cheers