public static Color32 FromHSV(float hue, float saturation, float value, float alpha) { if (saturation == 0f) { return(new Color(value, value, value, alpha)); } float max = value < 0.5f ? value * (1f + saturation) : (value + saturation) - (value * saturation); float min = (value * 2f) - max; return(new Color32( ColorExtension.RGBChannelFromHue(min, max, hue + (1 / 3f)) * 255f, ColorExtension.RGBChannelFromHue(min, max, hue) * 255f, ColorExtension.RGBChannelFromHue(min, max, hue - (1 / 3f)) * 255f, alpha * 255f )); }