public static RGB HSLtoRGB(HSL hsl) { var temp1 = hsl.Luminosity < 0.5 ? hsl.Luminosity * (1.0 + hsl.Saturation) : hsl.Luminosity + hsl.Saturation - hsl.Luminosity * hsl.Saturation; var temp2 = 2.0 * hsl.Luminosity - temp1; var hue_rel = hsl.Hue / 360; var R = mod((hue_rel + 0.333), 1.0); var G = hue_rel; var B = mod((hue_rel - 0.333), 1.0); R = ConvertChannel(R, temp1, temp2); G = ConvertChannel(G, temp1, temp2); B = ConvertChannel(B, temp1, temp2); return(new RGB( Convert.ToByte(R * 255), Convert.ToByte(G * 255), Convert.ToByte(B * 255))); }
public static Color HSLtoColor(HSL hsl) { return(RGBtoColor(HSLtoRGB(hsl))); }