I would like to know how to calculate a color that my display should show when combining the background and foreground colors..

Not sure how to describe, but say I have an foreground RGB value that is white, and a background RGB value that is black. I would like to add some transparency to the foreground color, so it should display a grey on the black background.

How to do this (for any foreground/background combination) ? There must be some algorithms but I don't find, or don't know what to search for.

An example, in Paint.NET I make a red background, and then I place a yellow pixel with an alpha value of 200. Then use the color picker tool to retrieve the color of the pixel I've just placed: