HSV Adjustments

The following function can be used to do Hue, Saturation and Value adjustments on a colour input.

color hsvAdjust (color input; float hue, saturation, value;)
    color toHSV = ctransform("RGB", "HSV", input);
    toHSV *= color (hue, saturation, value);
    return ctransform ("HSV", "RGB", toHSV);

For example to de-saturate a colour input, you would use the following…

color myColour = (0.5, 0.2, 0.4);
myColour = hsvAdjust (myColour, 0, 0, 1);

Leave a Reply

Your email address will not be published. Required fields are marked *