How to get the real color value after opacity

I use jquery and css to change the background color and the opacity of the menu item. However, I want the background color to be the actual css background color:

For instance:

css background color: #eabf60
real color after .70 opacity: #ECCD85

I believe this also depends a lot on the background behind the opaque element ...

Any ideas?

+3
source share
1 answer

AFAIK, there is no cross-browser way to get the color of a specific point after rendering.

So the only way is to simulate this. Get CSS background color plus transparency, and then go up through your parents until you find another background entry.

: RGB , CSS. , "", . 7- #ffee00, 24- ( 3 0 255). :

finalRed = parseInt (myRed * opacity + parentRed * ( 1. - opacity ));
+3

Source: https://habr.com/ru/post/1761946/


All Articles