Name: backgroundColor

Type: property

Syntax: set the backgroundColor of <object> to {empty | <colorName> | <RGBColor>} 

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

Summary: Specifies an <object|object's> background color.

Synonyms: backColor,secondColor

Associations: stack,card,field,button,graphic,scrollbar,player,image

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
set the backgroundColor of last button to "white"

Example:
set the backgroundColor of graphic 2 to 128,128,128

Example:
set the backgroundColor of word thisWord of field "Help!" to "#808080"

Example:
get the effective backgroundColor of this card

Example:
-- Set the background color of a paragraph of text in a field
set the backgroundColor of line 1 of field 1 to red

Parameters:
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-style color consisting of a hash mark (#) followed by three hexadecimal numbers, one for each of red, green, and blue.

Description:
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 <highlight|highlighted> effect.

By default, the <backgroundColor> for all <object|objects> is empty.

Setting the <backgroundColor> of an <object> to empty allows the <backgroundColor> of the <object|object's> <owner(property)> 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>.

>*Cross-platform note:* On <Mac OS>, <OS X>, and <Windows|Windows systems>, if the <backgroundColor> of all <object|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(object)|button's> outline. If the button's <style> is "checkbox", the <backgroundColor> fills the checkbox. If the <button(object)|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.

>*Cross-platform note:* If the <lookAndFeel> is set to "Appearance Manager", standard and rectangle <button(object)|buttons> are drawn by the operating system if the <backgroundColor> and <backgroundPattern> of the <button(keyword)> is empty. (In this case, none of the <button(object)|button's> color <property|properties> have an effect except for the <foregroundColor> or <foregroundPattern>.) Otherwise, the <button(keyword)> is drawn by LiveCode. If the <lookAndFeel> is "Appearance Manager", <button menu|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(object)|field's> outline. If you set the <backgroundColor> of a <chunk> of a <field(keyword)>, only that <chunk> is affected. For example, to create a "highlighter pen" effect on a single <word(keyword)>, set the <word(glossary)|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(keyword)> background is white, instead of inheriting its <owner(glossary)|owner's> color.

* The <backgroundColor> of a <scrollbar> fills the arrow boxes at the ends of the <scrollbar>.

* The <backgroundColor> of a <graphic(keyword)> is displayed inside the <graphic(object)|graphic's> border if the <graphic(object)|graphic's> fill <property> is true. If the <graphic(object)|graphic's> fill is false, the setting of the <backgroundColor> has no effect.

* The <backgroundColor> of an <EPS|EPS object> fills the <object|object's> rectangle.

* The <backgroundColor> of an <image(keyword)> is the second color in the <image(object)|image's> <color palette>.

* The <backgroundColor> of a <player>, <audio clip>, or <video clip> has no effect.

The ability to use the system background color was introduced in version 1.1. In previous versions, if the <backgroundColor> of all <object|objects> in the <object hierarchy> was empty, a light gray color was used.

Changes:
The ability of standard buttons to have a <backgroundColor> under Appearance Manager was introduced in version 2.0. In previous versions, if the <lookAndFeel> was set to "Appearance Manager", the setting of the <backgroundColor> had no effect on standard <button|buttons>.

References: 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), image (keyword), effective (keyword), field (keyword), button (keyword), word (keyword), player (keyword), card (keyword), scrollbar (keyword), graphic (keyword), colorPalette (keyword), answer color (command), group (command), button (object), image (object), field (object), object (object), stack (object), graphic (object), video clip (glossary), property (glossary), foregroundPattern (glossary), tabbed button (glossary), highlight (glossary), stack window (glossary), object type (glossary), Mac OS (glossary), OS X (glossary), chunk (glossary), object hierarchy (glossary), color palette (glossary), button menu (glossary), keyword (glossary), audio clip (glossary), EPS (glossary), owner (glossary), lookAndFeel (glossary), Windows (glossary), word (glossary)

Tags: ui
