SBIN2010 commented on code in PR #42053:
URL: https://github.com/apache/superset/pull/42053#discussion_r3677895450
##########
superset-frontend/packages/superset-ui-core/src/color/utils.ts:
##########
@@ -120,3 +121,30 @@ export function rgbToHex(red: number, green: number, blue:
number) {
return `#${r}${g}${b}`;
}
+
+export function rgbaToHex(rgb: RGBColor): string {
+ const { r, g, b, a = 1 } = rgb;
+ const toHex = (value: number) => {
+ const hex = Math.round(value).toString(16);
+ return hex.length === 1 ? `0${hex}` : hex;
+ };
+ const hexColor = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
+ if (a !== 1) {
+ return `${hexColor}${toHex(Math.round(a * 255))}`;
+ }
+ return hexColor;
+}
Review Comment:
Added to
[560425f](https://github.com/apache/superset/pull/42053/commits/560425f10f275a5de293affbdb7da8863a575033)
--
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]