Reputation: 1160
I've got this working great:
http://lauren.github.io/pick-a-color/
However I would like it to pass RGB values instead of Hex when a user clicks on a colour. I know how to parse the hex and convert to rgb, but i would rather skip this and use rgb directly from the page.
Any pointers would be fantastic!
Upvotes: 1
Views: 71
Reputation: 1012
According to the link you provided:
Accepts HEX, RGB, HSL, HSV, HSVA, and names, thanks to Brian Grinstead's amazing Tiny Color.
You can try it in the example widgets on the page, just input:
rgb(255,255,255)
Edit:
Looking deeper at their API, i feel that they are lacking in callback hooks for their plugin to really be useful for developers to incorporate into their projects. That having been said, you could make a new setting for the callback, and then call it in the internal callback for selecting a color / hiding the modal.
Short of modifying the source code or contributing to that project, you may look to another color picker. I've personally had really great luck with spectrum. It even has an option to set your preferred format.
The one thing that these libraries have in common, is they are built on top of Tiny Color. Depending on how much interaction you want with your color picker, you might decide to roll your own, or theme spectrum.
Upvotes: 1