Reference red()

red()

Gets the red value of a color.

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

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

Examples

Syntax

red(color)

Parameters

color

p5.Color object, array of color components, or CSS color string.

Notice any errors or typos? Please let us know. Please feel free to edit src/color/creating_reading.js and open a pull request!

Related References