The Short Answer
The effect of residual color is called a mate fringe. For example Photoshop has many tools to delete this most notably Layer → Matting → Defringe.... Other applications call this differently, but they all quite universally have tools for this.
Image 1: Some of the fringe removal tools in Adobe Photoshop
A Technical Description of the Problem
Basically the idea is that a alpha mask can be mathematically described as:
Cout = α * Cimage (1)
Where Cout is the out color and Cimage is the original color α is the alpha channel value. On pixels where 0 < α < 1 you have a pixel where the color is contaminated by both foreground an background color. If you happen to know the background color then you can derive from equation 1 that the contribution of the background is:
Cbg = (1 - α) * Cknown (2)
You can now proceed to delete that color from the foreground. You could simply subtract the color form the layer but you'd decontaminate the edge with black (which is what Photoshops remove black does). Removing black matte is simply,
Cunmult = Cblack/α , (3)
thus the total color of the pixel is:
Cfinal = (Cimage - (1 - α) * Cknown)/α . (4)
But what do you do if you dont know what the color is? Well you could make a guess as to the color by bleeding the non selected background into the subtraction plate Cknown, or bleed the foreground plate to alpha (this is what defringe does). There are fancier methods available.
Related explanations:
Can image transparency be calculated automatically from multiple non-transparent samples?, where I describe step by step how the subtraction could be done in a slightly more involved example.