background([value])
Class: Menu. Method inherited from UIComponent.
Description:
Sets or gets the background color of the component.
Accepts three formats:
- RGB hex (e.g.
"#FF0000") - RGBA hex with alpha (e.g.
"#FF000050") - The string
"transparent"(equivalent to"#00000000")
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
string |
Background color in supported formats. Panel and Window components also accept gradient, image position and other info like in CSS. If omitted, returns the current value. |
Returns:
Returns this when setting value, or the current background color string when getting.
Type: this | string
Examples:
component.background("#FF0000"); // Red background
component.background("#00FF0080"); // Semi-transparent green
component.background("transparent"); // Fully transparent
// For Panel and Window components the background value can be a string that contains a mixture of background color,
// image, linear-gradient, radial-gradient, like in CSS in web browsers. Some features may not be supported though.
panel.background("#FF000055 url(images/bg.png) center no-repeat opacity=0.6 10px 15px linear-gradient(#DDDDDD55, #F8F8F855 10%) / auto);
panel.background("url(data:image/png;base64,As8fE4fdt1r.....)")); // supports base64 encoded image string
