Setting the background colour of a sketch


How to define the background colour of your sketch

To view this as a 1 page worksheet click on the image below, or click on the .pdf link.

set bg colour.pdf

Type…

void setup() {

size(200, 100);

background(0,255,0);

}

The three numbers in the brackets are known as RGB numbers.

Each represent a value of a different colour, red green or blue respectively.

Processing uses this list of 3 numbers in brackets to define colours.

The numbers are always a value between 0 & 255.

The higher the number is, the more of that colour there is.

You can mix colours by combining different mixtures of RGB values.

Here are some examples to copy & paste..

Background(0,255,0); //= Green

background(0,0,0); //= Black

background(255,255,255); //= white

background(0,255,125); //= turquoise,

background(255,0,125); //= purple

Experiment by creating & running sketches of different sizes with different background colours.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: