Reference hue()

hue()

Gets the hue value of a color.

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

Hue describes a color's position on the color wheel. By default, hue() returns a color's HSL hue in the range 0 to 360. If the colorMode() is set to HSB or HSL, it returns the hue value in the given mode.

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

Examples

Syntax

hue(color)

Parameters

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

Returns

Number: the hue value.

Related References