| Language \ Environment \ Comparison |

| Index

| The Processing 1.0 _ALPHA_ Reference is a work in progress. If you see any errors or have any comments, please write to: reas at groupc.net

Name |  | ### background()
Examples |  |
    background(51);
    background(255, 204, 0);
    void loop() {
      background(255, 204, 0);
      line(0, 0, mouseX, mouseY);
      line(100, 0, mouseX, mouseY);
      line(100, 100, mouseX, mouseY);
      line(0, 100, mouseX, mouseY);
    }
    BImage b;
    b = loadImage("laDefense.jpg");
    background(b);
Description |  | The background() function sets the color used for the background of the Processing window. The default background is light gray. In the loop() function, the background color is used to refresh the display window between frames. It is possible to load a JPG or GIF image as the background by loading an image which is the same size as the display window. The image must be in the data directory of the sketch for it to load properly.
Syntax |  |
    background(value1)
    background(value1, value2, value3)
    background(image)
Parameters |  |
value1 |  | int or float: red or hue value (depending on the current color mode)
value2 |  | int or float: green or saturation value (depending on the current color mode)
value3 |  | int or float: blue or brightness value (depending on the current color mode)
image |  | BImage: the name of a BImage the same size as the display window
Returns |  | None
Usage |  | Web & Application
Related |  | colorMode()

| © 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |