Reference green()

green()

Gets the green value of a color.

green() extracts the green value from a p5.Color object, an array of color components, or a CSS color string.

By default, green() returns a color's green value in the range 0 to 255. If the colorMode() is set to RGB, it returns the green value in the given range.

In p5.strands shader callbacks, green() operates on vec4 values and returns the green channel as a normalized value in the 0–1 range. colorMode() has no effect inside shader callbacks.

Examples

Syntax

green(color)

Parameters

color
p5.Color|Number[]|String: p5.Color object, array of color components, or CSS color string.

Returns

Number: the green value.

Related References