Forgot your password?
typodupeerror

Comment Find the ideal font color based on background (bg) (Score 1) 702

using System.Graphics.Drawing;

public Color IdealTextColor(Color bg)
{
        int nThreshold = 105;
        int bgDelta = Convert.ToInt32((bg.R * 0.299) + (bg.G * 0.587) + (bg.B * 0.114));
        Color foreColor = (255 - bgDelta nThreshold) ? Color.Black : Color.White;
        return foreColor;
}

Slashdot Top Deals

"Falling in love makes smoking pot all day look like the ultimate in restraint." -- Dave Sim, author of Cerebrus.

Working...