mirror of
https://github.com/Code-Artist/ToggleSwitch.git
synced 2024-12-26 15:49:41 +00:00
17 lines
470 B
C#
17 lines
470 B
C#
using System.Drawing;
|
|
|
|
namespace JCS
|
|
{
|
|
public static class GraphicsExtensionMethods
|
|
{
|
|
public static Color ToGrayScale(this Color originalColor)
|
|
{
|
|
if (originalColor.Equals(Color.Transparent))
|
|
return originalColor;
|
|
|
|
int grayScale = (int)((originalColor.R * .299) + (originalColor.G * .587) + (originalColor.B * .114));
|
|
return Color.FromArgb(grayScale, grayScale, grayScale);
|
|
}
|
|
}
|
|
}
|