Open In App

p5.js Color Complete Reference

Improve
Improve
Like Article
Like
Save
Share
Report

Create color and store it into variables of color datatype. The parameters of color are RGB or HSB value depending on the current colorMode() function.

Function

Description

alpha() It is used to extract the alpha value from a color or pixel array.
blue() It is used to extract the blue value from a color or pixel array.
brightness() It is used to extract the HSB brightness value from a color or pixel array.
color() It creates color and store it into variables.
green() It is used to extract the green value from a color or pixel array.
hue() It is used to extract the HSB and HSL hue value from a color or pixel array.
lerpColor() It is used to interpolate two colors to find a third color between them.
lightness() It is used to extract the HSL lightness value from a color or pixel array.
red() It is used to extract the red value from a color or pixel array.
saturation() It is used to extract the HSL and HSB saturation value from a color or pixel array.
background() It sets the color used for the background of the p5.js canvas.
clear() It is used to clear the pixels within a buffer.
fill() It is used to fill the color of the shapes.
noFill() It is used to disable the filling geometry.
noStroke() It removes the outline which is used to draw lines and borders around shapes.
stroke() It is used to draw the lines and border around the text and shapes.
erase() It subtracts all the drawings that would be done after the use of this function.
noErase() It is used to cancel the effects of the erase() function.

Last Updated : 11 Aug, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads