public static Color GetColorFromHSL(double hue, double saturation, double luminosity)
{
double r = 0, g = 0, b = 0;
if (luminosity != 0)
{
if (saturation == 0)
r = g = b = luminosity;
else
{
double temp2 = _GetTemp2(hue, saturation, luminosity);
double temp1 = 2.0f * luminosity - temp2;
r = _GetColorComponent(temp1, temp2, hue + 1.0f / 3.0f);
g = _GetColorComponent(temp1, temp2, hue);
b = _GetColorComponent(temp1, temp2, hue - 1.0f / 3.0f);
}
}
return Color.FromArgb((int)(255 * r), (int)(255 * g), (int)(255 * b));
}
private static double _GetColorComponent(double temp1, double temp2, double temp3)