You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/28 14:39:50 UTC

[GitHub] [superset] ruijielou opened a new issue, #22241: addAlpha is not to be rgb(x,x,x)

ruijielou opened a new issue, #22241:
URL: https://github.com/apache/superset/issues/22241

   ```typescript
   export function addAlpha(color: string, opacity: number): string {
     // opacity value should be between 0 and 1.
     if (opacity > 1 || opacity < 0) {
       throw new Error(`The opacity should between 0 and 1, but got: ${opacity}`);
     }
     // the alpha value is between 00 - FF
     const alpha = `0${Math.round(opacity * 255)
       .toString(16)
       .toUpperCase()}`.slice(-2);
     return `${color}${alpha}`;
   }
   ```
   This method does not take rgb color conversion into account, which will lead to incorrect results, such as' rgb (209124178) 98 ';
   
   
   


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on issue #22241: addAlpha is not to be rgb(x,x,x)

Posted by GitBox <gi...@apache.org>.
rusackas commented on issue #22241:
URL: https://github.com/apache/superset/issues/22241#issuecomment-1347713319

   @ruijielou are there any implementations of this method that are resulting in a known issue? As far as I can see, this is used only with hex colors in the codebase right now. Unless this is a bug, I'd be more inclined to call this a feature request. Of course, it might not be rocket science to either support RGB(A) colors in this function, or add an extra color utility for `rgbToHex`, so you can `addAlpha(rgbToHex(someHex),someAlpha)`. Happy to discuss further, or re-open this if something is broken, but I'm going to politely close it for now in hopes that everything is working :D


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas closed issue #22241: addAlpha is not to be rgb(x,x,x)

Posted by GitBox <gi...@apache.org>.
rusackas closed issue #22241: addAlpha is not to be rgb(x,x,x)
URL: https://github.com/apache/superset/issues/22241


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ruijielou commented on issue #22241: addAlpha is not to be rgb(x,x,x)

Posted by GitBox <gi...@apache.org>.
ruijielou commented on issue #22241:
URL: https://github.com/apache/superset/issues/22241#issuecomment-1372246353

   Yes, I have tried to solve it with rgbToHex (someHex) method
   
   > @ruijielou are there any implementations of this method that are resulting in a known issue? As far as I can see, this is used only with hex colors in the codebase right now. Unless this is a bug, I'd be more inclined to call this a feature request. Of course, it might not be rocket science to either support RGB(A) colors in this function, or add an extra color utility for `rgbToHex`, so you can `addAlpha(rgbToHex(someHex),someAlpha)`. Happy to discuss further, or re-open this if something is broken, but I'm going to politely close it for now in hopes that everything is working :D
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org