saturation

Static saturation 

Source
pub static saturation: SaturationInternalType
Expand description

Extracts the saturation value from a color or pixel array.

Saturation is scaled differently in HSB and HSL. This function will return the HSB saturation when supplied with an HSB color object (or when supplied with a pixel array while the color mode is HSB), but will default to the HSL saturation otherwise.

Examples

noStroke();
colorMode(HSB, 255);
let c = color(0, 126, 255);
fill(c);
rect(15, 20, 35, 60);
let value = saturation(c); // Sets 'value' to 126
fill(value);
rect(50, 20, 35, 60);

Parameters

color p5.Color object, color components, or CSS color