ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

How to set default colors for ColorPicker?

Open stefaneidelloth opened this issue 3 years ago • 2 comments

Is there already an argument that can be used to pass predefined colors to the ColorPicker?

image

https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#Color-picker

stefaneidelloth avatar Dec 17 '21 12:12 stefaneidelloth

Ipywidgets uses the color input HTML element for this. AFAICT it is not possible to fill those colors that you highlighted. I do see that chrome has added support for the the list attribute to use a datalist though, see http://jsfiddle.net/lotusgodkk/GCu2D/4045/ , but that is slightly different from what you are asking about (and not widely supported yet). Of course if someone made a contribution adding support for data-lists to the color picker, we would consider merging it 😃

vidartf avatar Dec 21 '21 15:12 vidartf

Thank you. As a reference, here is the related SO question on the presetColors attribute of the HTML element, linking to the already mentioned jsfiddle:

https://stackoverflow.com/questions/50908151/how-to-add-predefined-colors-to-input-type-color

And here is the corresponding Firefox issue:

https://bugzilla.mozilla.org/show_bug.cgi?id=960984

stefaneidelloth avatar Dec 21 '21 17:12 stefaneidelloth