How to find the color “A” that would look exactly the same as 100% opacity color “B” when it is at 90% opacity?

So I have color “B” at 100% opacity.
I need a way of finding the color “A” that looks exactly the same as the above when it is at 90% opacity.

Assume that background is pure white but I don’t think that matters as long as it’s the same color on both instances.

How can this be done?


Result of normal alpha blending is:

Cout = α * CFG+(1-α) * CBG

where CFG is the foreground color and CBG is the background color and α is the opacity. Thus you want to solve A from equation:

B = 0.9 * A + (1-0.9) * CBG

Which after manipulation is:

A = (B – 0.1 * CBG) / 0.9

further assuming white color the formula per color channel is:

A = (B – 0.1) / 0.9

While this is the general answer, there is a big caveat associated with this calculation. This does not account for any color management. So you might need to convert the color to linear and then back to the original color space to do this calculation. There is also a second consideration to think about: The color you may need to use can exit the displayable gamut of your system.

Source : Link , Question Author : Help Leecher , Answer Author : joojaa

Leave a Comment