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

"If John Madden steps outside on February 2, looks down, and doesn't see his feet, we'll have 6 more weeks of Pro football." -- Chuck Newcombe

Working...