EastDesire / jscolor

JavaScript color picker with opacity (alpha channel) and customizable palette. Single file of plain JS with no dependencies.

Home Page:http://jscolor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion

Brianuk9 opened this issue · comments

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 :(

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.