Livecode Wiki

Specifies an object's background color.Syntax:

set the backgroundColor [of <chunk>] [of <line>] of <field> to {empty| <colorName> | <RGBColor>}


set the backgroundColor of last button to "white"
set the backgroundColor of graphic 2 to 128,128,128
set the backgroundColor of word thisWord of field "Help!" to "#808080"
get the effective backgroundColor of this card
-- Set the background color of a paragraph of text in a field
set the backgroundColor of line 1 of field 1 to red

Use the backgroundColor property to change the background of a window, or the color that fills an object, or to change the background color of text for a highlighted effect.

By default, the backgroundColor for all objects is empty.

Setting the backgroundColor of an object to empty allows the backgroundColor of the object's owner to show through. Use the effective keyword to find out what color is used for the object, even if its own backgroundColor is empty.

If an object's backgroundPattern is set, the pattern is shown instead of the color specified by backgroundColor. The setting of the backgroundColor property has different effects, depending on the object type:

  • The backgroundColor of a stack or card fills the entire stack window, as well as determining the backgroundColor of each object in the stack or card that does not have its own backgroundColor. On Mac OS, OS X, and Windows, if the backgroundColor of all objects in the object hierarchy is empty, the background color set by the system is used.
  • The backgroundColor of a group determines the backgroundColor of each object in the group that does not have its own backgroundColor.
  • The backgroundColor of a button fills the area inside the button's outline. If the button's style is "checkbox", the backgroundColor fills the checkbox. If the button's style is "radioButton", the backgroundColor has no effect. If the button(keyword) is a tabbed button, the backgroundColor fills the tab area and the frontmost tab, but does not affect the other tabs. If the lookAndFeel is set to "Appearance Manager", standard and rectangle buttons are drawn by the operating system if the backgroundColor and backgroundPattern of the button is empty. (In this case, none of the button's color properties have an effect except for the foregroundColor or foregroundPattern.) Otherwise, the button is drawn by LiveCode. If the lookAndFeel is "Appearance Manager", button menus whose menuMode is set to "option" or "comboBox" are always drawn by the operating system, and the setting of the backgroundColor does not affect them.
  • The backgroundColor of a field (keyword) fills the area inside the field's outline. If you set the backgroundColor of a chunk of a field, only that chunk is affected. For example, to create a "highlighter pen" effect on a single word, set the word's backgroundColor to yellow. If a chunk of text contains runs of text with more than one background color, the backgroundColor of that chunk reports "mixed". If a field's backgroundColor is empty and the lookAndFeel property is set to "Macintosh", "Appearance Manager", or "Windows 95", the field background is white, instead of inheriting its owner's color.
  • The backgroundColor of a scrollbar fills the arrow boxes at the ends of the scrollbar.
  • The backgroundColor of a graphic is displayed inside the graphic's border if the graphic's fill property is true. If the graphic's fill is false, the setting of the backgroundColor has no effect.
  • The backgroundColor of an EPS object fills the object's rectangle.
  • The backgroundColor of an image is the second color in the image's color palette.
  • The backgroundColor of a player, audio clip, or video clip has no effect.


  • colorName: Any standard color name.
  • rgbColor: Consists of three comma-separated integers between zero and 255,specifying the level of each of red, green, and blue; or an HTML-stylecolor consisting of a hash mark (#) followed by three hexadecimalnumbers, one for each of red, green, and blue.

See also: button (object),image (object),field (object),stack (object),graphic (object),leftIndent (property),topColor (property),borderWidth (property),vgrid (property),backgroundPattern (property),textAlign (property),dontWrap (property),formattedText (property),spaceAbove (property),menuMode (property),brushColor (property),listBehavior (property),listIndent (property),linkColor (property),hidden (property),textSize (property),firstIndent (property),tabstops (property),spaceBelow (property),listStyle (property),style (property),rightIndent (property),listDepth (property),hgrid (property),foregroundColor (property),linkHiliteColor (property),hScrollbar (property),owner (property),lookAndFeel (property),borderColor (property),formattedWidth (property),