If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

color(r, g, b, a*)

This function lets you store all three color components in a single variable. You can then pass that one variable to functions like background(), stroke(), and fill().
Parameters:
NameDescription
ramount of red, ranges from 0 to 255
gamount of green, ranges from 0 to 255
bamount of blue, ranges from 0 to 255
a(Optional) transparency, ranges from 0 to 255

Want to join the conversation?

No posts yet.