processingColours in Processing


Introduction

This article will show you the various colours formats in Processing and the ways in which they can be used.

Syntax

  • color(r, g, b);
  • color(r, g, b, alpha);
  • color(gray);
  • color(gray, alpha);
  • color(h, s, l); //The mode must be HSB. You can change this using colorMode.

Parameters

ParametersDetails
rIs the red of the color when the mode is RGB.
gIs the green of the color when the mode is RGB.
bIs the blue of the color when the mode is RGB.
alphaIs the opacity of the color.
hThe hue of the color when the mode is HSB.
sThe saturation of the color when the mode is HSB.
lThe brightness/lightness of the color when the mode is HSB.
grayThe value between black (being 0) and white (being 255).

Remarks

Although it has not been mentioned in the official Processing documentation, there is a CMYK mode which you can use.