bito-code-review[bot] commented on PR #40784:
URL: https://github.com/apache/superset/pull/40784#issuecomment-4633926179
<!-- Bito Reply -->
The suggestion to convert the alpha component of the color array from a
0–255 range to a 0–1 range for the CSS `rgba()` function is correct. Since CSS
`rgba()` expects alpha values between 0 and 1, using the raw 0–255 value will
cause semi-transparent colors to render as fully opaque. You should update the
color string construction to normalize the alpha component, defaulting to 1 if
it is missing.
**superset-frontend/plugins/preset-chart-deckgl/src/components/Legend.tsx**
```
const colorArray = v.color || [];
const r = colorArray[0];
const g = colorArray[1];
const b = colorArray[2];
const a = colorArray.length > 3 ? colorArray[3] / 255 : 1;
const color = `rgba(${r}, ${g}, ${b}, ${a})`;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]