I have found that reducing the opacity against a white background is a good way to find usable lighter and less saturated tints of a base color.

As an example take this picture of an orange color:


The lower row shows the variants. The percentages are the opacities.

Having a white background and reducing the opacity is good when I search good tints, but I like to use equivalent 100% opaque RGB colors in the final product.

How do I calculate or otherwise find the equivalent RGB numbers, when the RGB numbers of the base color and the opacity are already selected?

I have tried color picker, but in Illustrator it at least gives only the base color.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Ryan Jul 23 '18 at 14:57
  • @JonasPraem Do you find the recent edits to your question properly reflect what you were asking? If so I will reopen the question. Thank you! – curious Jul 23 '18 at 23:21
  • Yes the edits made is perfectly reflecting what I was looking for – Jonas Praem Jul 24 '18 at 7:34
  • 2
    Why is this question bring down voted? It is a perfectly valid question imho. – filip Jul 24 '18 at 12:26
  • 3
    The original question was written with a very strong developer POV. The question is now edited to be more understandable for designers, and more precise as well. I am a developer, not a designer - seems like I hit a language barrier. – Jonas Praem Jul 24 '18 at 13:02

Use formula Y=255 - P*(255-X) where X is a RGB number, P=opacity (0...1), Y=new RGB number which should give the same appearance with 100% opacity as X gives with 100p% opacity against white background.

The formula is the general opacity formula, only simplified for this special case - the partially transparent top layer is against pure white.

Note: the white background should be a white object, not the artboard white. White background object is color managed.

If you are in Illustrator and want to copy the color with the color picker, make a copy of the partially transparent object and rasterize it. Select white background in the rasterizing dialog. Now the color picker gives the color, no calculations are needed.

| improve this answer | |
  • 2
    Here is a python implementation to calculate this graphicdesign.stackexchange.com/questions/46867/… – joojaa Jul 24 '18 at 12:21
  • I have a follow up question about how to implement this in Sass, on stack overflow, if anyone is interested: question – Jonas Praem Jul 24 '18 at 12:29
  • RE: the special case (i.e. not white), doesn't this work for every case, since the formula is for one single channel, and one would need to do this for each channel? Or is the special case "the first 255" in the formula? – Yorik Jul 24 '18 at 13:59
  • 2
    @Yorik the general formula for 2 layer image is Y=p*T+(1-p)*B where p is the opacity 0...1 of the top layer, T= rgb number of top layer color, B is the rgb number of fully opaque bottom layer. Y is the rgb number of the equivalent fully opaque color. – user287001 Jul 24 '18 at 14:14
  • JavaScript implementation of the general formula (thanks @user287001): const afterOpacity = (fg,o,bg=[255,255,255]) => fg.map((colFg,idx)=>o*colFg+(1-o)*bg[idx]) where fg is the foreground colour as [r,g,b], o is the opacity (0...1) and bg is the background colour (defaults to white if omitted) E.g. afterOpacity([255,0,0],0.5) gives [255,127.5,127.5] – Chris M Nov 27 '19 at 14:25

I wrote a tool for this: https://github.com/igrmk/blec. For your specific case you may use it this way

blec white deadbeef

Last ef is the hex representation of an alpha channel. Or you may use it like this

blec white deadbe:0.75

Specifying the opacity as a decimal fraction.

Please note that the suggested formula Y = 255 - P * (255 - X) is not quite accurate due to a gamma correction. More accurate one would be Y = (255^G * (1 - P) + X^G * P) ^ (1 / G) where Y — resulting RGB component value, X — overlay RGB component value, P — its opacity, G — a value of a gamma. Most common value of a gamma is 2.2. The reason to include a gamma correction into the formula is to move components into linear space on calculating. Almost every RGB space that is used today interprets color components in a non-linear way in order to place more color information in 8 bits. Historically it was introduced to compensate a non-linearity of CRT displays.

Here is an example why a gamma correction is important for the blending. Let's take this red image


and this blue image


Let's take first one fully opaque and set an opacity of the second image equal to x-axis like this


Now let's blend them without a gamma correction (gamma = 1)


Let's enable a gamma correction and do the same (gamma = 2.2)


As you can see there is much more localized transition if we don't use a gamma correction. There are clearly darker colors in the center. If we use a gamma correction then the transition and the lightness become much more smooth.

Last gradient is built using a dithering.


The image contains pixels of just two colors but a probability of blue linearly increases from 0 in the left to 1 in the right. The result looks much closer to image with gamma = 2.2 in terms of lightness and transition colors. Try to look at it from a distance. And this is what you probably expect from blending two colors. We literally blend them by mixing like aquarelle in this example. So gamma is very important thing for blending especially when opacity is close to 0.5.

Let's finally compare the blending of opaque red and blue with alpha of 0.5 where the effect of a gamma correction is maximum.

gamma=1 gamma=2.2 dithering

First image does not use a gamma correction, the second one uses a gamma of 2.2, and the third one uses a dithering. As you can see the first one is very different to other two. So I advise to always use a gamma correction. If you use any decent image editor then most probably you are safe and a gamma correction is enabled by default.

Please note that to compare a dithering to a blending you need to look at images at 100% scale so that every single pixel of the image occupies exactly one pixel of a screen. This is almost never the case if you use a mobile phone. If you look at images at different scale probably you look at antialiased image. The antialiasing can lead to very inaccurate results because it doesn't use a gamma correction at the moment. I can confirm it for Chrome 83 on Android 10 and for the latest Safari on iOS 13. I guess it needs too much resources to do it right way. So it effectively decreases a gamma of a display to about 1.8 when you look at very contrast noisy images.

Please note also that not every display is calibrated well. If you feel like an image with gamma of 2.2 and an image with a dithering produce different colors I have a bad news for you. You can check a gamma of you monitor here http://web.mit.edu/jmorzins/www/gamma/adilger/gamma.html. However if you use a mobile device it is better to use an application because an antialiasing can lead to very inaccurate results.

Here is a code to get these pictures https://pastebin.com/fHYtWrMb.

| improve this answer | |
  • I guess you have at least one gear more than me. The stacking glass example is vague. Stacked against what? What is watched and where the light comes and goes? Gamma correction is in computers for on computer and display constructions based reasons, it's not in physical color materials, so glass do not make the formula clearer at all. – user287001 May 7 at 9:45
  • @user287001 Thank you for pointing it out. Glass example was really bad. There are too many physical factors to consider to clarify it. I think now it looks much better. – Igor Mikushkin May 7 at 18:44

No need to go to all this technical calculations. You can instead use the swatches pannel. You save your original color as a swatch with the Global option ticked.

enter image description here

You can then use the color panel and select the percentage you need. This is does not use transparency, it is opaque.

enter image description here

When you need to see the RGB or Hex code for your final tint, you can then press on the rgb icon on the color panel and your you can see the RGB and Hex values.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.