saturation()#

Extracts the saturation value from a color.

Examples#

example picture for saturation()
1def setup():
2    py5.no_stroke()
3    py5.color_mode(py5.HSB, 255)
4    c = py5.color(0, 126, 255)
5    py5.fill(c)
6    py5.rect(15, 20, 35, 60)
7    value = py5.saturation(c)  # sets 'value' to 126
8    py5.fill(value)
9    py5.rect(50, 20, 35, 60)

Description#

Extracts the saturation value from a color.

Underlying Processing method: saturation

Syntax#

saturation(rgb: int, /) -> float

Parameters#

  • rgb: int - any value of the color datatype

Updated on November 12, 2021 11:30:58am UTC