Skip to content

ColorPicker widget doesn't display an alpha of 0 correctly #1046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bwarne opened this issue Jun 5, 2020 · 1 comment
Closed

ColorPicker widget doesn't display an alpha of 0 correctly #1046

bwarne opened this issue Jun 5, 2020 · 1 comment

Comments

@bwarne
Copy link

bwarne commented Jun 5, 2020

Setting the alpha of the ColorPicker widget to 0 correctly updates the alpha in the Plotly chart, but is shown as alpha of 100% in the Color Picker widget.

Currently the render() method of ColorPicker is stripping the alpha component when encoding selectedColor to a string and the alpha is 0.

This appears to be causing problems with the react-color CustomPicker which interprets an rgbString lacking an explicit alpha as having an alpha set to 100%. I'm not sure what the benefit is of removing the explicit alpha value but this issue appears to be fixed by changing the line to selectedColor._a !== 1 so that the string encodes the alpha unless it is set to 1 or alternatively by always encoding the alpha by replacing lines 79-82 with const rgbString = selectedColor.toRgbString();.

The attached image shows the result of setting the alpha to 0, which the widget displays as 100, but is rendered as alpha 0 in the chart.
image

@dmt0
Copy link
Contributor

dmt0 commented Oct 7, 2020

Not sure why alpha was pinned to 0, it might've been because plotly.js didn't properly support alpha: plotly/plotly.js#4120. That has been fixed now, so doing simply const rgbString = selectedColor.toRgbString(); doesn't seem to cause any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants