Sprite Lab Documentation

set background color 
Category:World

Sets the background of the display area to a solid color. 70 colors are available in the default color block, or a random color can be specified.

Examples

Example 1

When more than one background is used together in a sequence, the last background set will be the one that is used. In this example, the background will not switch from red to blue; when it is run, the background will go straight to blue.

Example 2

The background starts white in Sprite Lab, but it can be changed to any color.

The background starts white in Sprite Lab, but it can be changed to any color. 

Syntax

setBackground

Parameters

NameTypeRequired?Description
color

The color to be used as the background

Tips

  • Pay attention to the order of the backgrounds set. When more than one background is used together in a sequence, the last background set will be the one that is used. Background images and colors cannot both occur at the same time.

Found a bug in the documentation? Let us know at support@code.org.