spectrum
spectrum copied to clipboard
Return rgba to original input when alpha channel is used
When you set preferredFormat eg. to "hex" then the colorpicker result in the original input field will always be in hex, even if showAlpha=true and the user selected an alpha less than 1. The colorpicker should return rgba instead (like the preview input field does).
Here is the difference: current master: http://jsfiddle.net/7sun5j3c/ pull request: http://jsfiddle.net/7sun5j3c/1/ You'll have to select a color with alpha < 1
+1
I think this makes sense, sorry for the delay. Will leave comments inline
Would you be able to add a new test for this? They can be run by loading test/index.html in a browser. We have an existing test for preferredFormat and tooltips: https://github.com/bgrins/spectrum/blob/master/test/tests.js#L501; so it could go near there but be a lot simpler.
$('<input />').spectrum({
preferredFormat: "hex",
}).spectrum("set", "rgba(255,0,0,.2)").val() // make sure this is rgba(255,0,0,.2)
$('<input />').spectrum({
preferredFormat: "hex",
}).spectrum("set", "rgba(255,0,0,1)").val() // make sure this is "#ff0000"
$('<input />').spectrum({
preferredFormat: "name",
}).spectrum("set", "rgba(0,0,0,0)").val() // make sure this is transparent
Any updates when release with this changes can be published?