/// <summary> /// Sets the passed color as BackColor for the Control, then sets either black or white as the ForeColor, depending on the lightness of the backColor. /// </summary> public static void SetBackColorAndAccordingForeColor(this Control control, System.Drawing.Color backColor) { control.BackColor = backColor; control.ForeColor = Utils.ForeColor(backColor); }