EastDesire / jscolor

JavaScript color picker with opacity (alpha channel) and customizable palette. Single file of plain JS with no dependencies.
http://jscolor.com
232 stars 72 forks source link

Suggestion #24

Closed Brianuk9 closed 3 years ago

Brianuk9 commented 3 years ago

It would be really useful if when in in HEX or RGB mode, the input was split (again) so that:

on the left you could the colour value - as you can now ;)

on the right your could type the alpha value

I know you can have a separate input for alpa value as it is now - but clicking on it closes the colour picker :(

EastDesire commented 3 years ago

Hi @Brianuk9, I was thinking how to make this work. I don't think it is worth splitting the input itself and can't imagine a good way to do it anyway. Instead, it might help to keep the color picker displayed while the text cursor is in its valueElement or alphaElement (your alpha input), but I'm not sure whether to go down this road.

The main purpose of alphaElement is to redirect the alpha value into a hidden input, so that it can be included in form data. The examples on the website have alpha it in a visible text input mainly to illustrate what's happening.

What you can do at the moment is to set the option format to value 'hexa' or 'rgba', so that the alpha value is part of the color code. Then if you wish to include it in the form data as well, you can set alphaElement to a hidden input field.