plotly / dash-daq

Control components for Dash
MIT License
141 stars 40 forks source link

Issue adjusting value of ColorPicker object through callback #159

Closed TCherici closed 3 years ago

TCherici commented 3 years ago

When trying to set the rgb values of a ColorPicker object through a callback in python, the result is always off.

For example, if I try to set its value to {'rgb': {'r': 255, 'g': 242, 'b': 229, 'a': 1}}, it gets assigned the following values instead: image

The g and b values are swapped, and the r value is set to 1. No clue why that happens.

I haven't yet fully figured out the cause of the issue, but I reckon it has something to do with the ColorPicker javascript object having its color attribute being (erroneously?) named rbg instead of rgb.

ryanvolpi commented 3 years ago

I can confirm, I am having similar difficulties. See also the example in the dash plotly documentation. The color picker is given parameter value=dict(rgb=dict(r=255, g=0, b=0, a=0) but the resulting color selection is RGBA(0,0,0,1).

image

Karan-S-Mittal commented 3 years ago

here's a preview of the change

https://user-images.githubusercontent.com/41485085/138561966-968629e3-fe22-4799-8775-8b0933c10585.mov

.

TCherici commented 3 years ago

Thanks for fixing!