hue()
Gets the hue value of a color.
hue() extracts the hue value from a 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.
Examples

function setup()
size(100, 100)
noStroke()
colorMode(HSB, 255)
local c = color(0, 126, 255)
fill(c)
rect(15, 15, 35, 70)
value = hue(c) -- Sets 'value' to "0
fill(value)
rect(50,15,35,70)
describe("Two rectangles. The rectanle on the left is salmon pink and the one on the right is black.")
end

function setup()
size(100, 100)
background(200)
-- Use HSL color.
colorMode(HSL)
-- Create a color object.
local c = color(0, 50, 100)
-- Draw the left rectangle.
noStroke()
fill(c)
rect(15, 20, 35, 60)
-- Set 'hueValue' to 0.
local hueValue = hue(c)
-- Draw the right rectangle.
fill(hueValue)
rect(50, 20, 35, 60)
end

function setup()
size(100, 100)
background(200)
-- Use HSL color.
colorMode(HSL)
-- Create a color array.
local c = {0, 50, 100}
-- Draw the left rectangle.
noStroke()
fill(c)
rect(15, 20, 35, 60)
-- Set 'hueValue' to 0.
local hueValue = hue(c)
-- Draw the right rectangle.
fill(hueValue)
rect(50, 20, 35, 60)
end

function setup()
size(400, 400)
noStroke()
colorMode(HSB, 255)
local c = color(0, 126, 255)
fill(c)
rect(60, 80, 140, 240)
value = hue(c) -- Sets 'value' to "0
fill(value)
rect(200, 80, 140, 240)
end
Syntax
hue(color)
Parameters
| Parameter | |
|---|---|
| color | Color/Number/String. |