public static Color WithSaturation(this Color col, float saturation) { float4 v = col.ToFloat4(); float3 hsv = RGBtoHSV(v.xyz); hsv.y = saturation; v.xyz = HSVtoRGB(hsv); return(v.ToColor()); }
public static Color WithLightness(this Color col, float lightness) { float4 f4 = col.ToFloat4(); float3 hsl = RGBtoHSL(f4.xyz); hsl.z = lightness; f4.xyz = HSLtoRGB(hsl); return(f4.ToColor()); }