19 lines
433 B
C#

using System;
using System.Drawing;
namespace UtilLib
{
public class Colors
{
public static Color FromHex(string hex)
{
if(!hex.StartsWith("#")) hex = "#" + hex;
return ColorTranslator.FromHtml(hex);
}
public static Color FromRGB(byte red, byte green, byte blue, int opacity)
{
return Color.FromArgb(opacity,red, green, blue);
}
}
}