# wx.setBackgroundColor(Object object)
Start from base library version 2.1.0. Please remaining backward compatible.
with Promise style call: Supported
Need page permissions: Mini Programs cannot call this interface from a plugin page, and plugins cannot call the interface from the plugins page
Mini Program plugin: Support, need to Mini Program base library version no less than 2.4.0
When used in Mini Programs plug-ins, can only be called from the page of the current plug-in
Dynamically set the background color of the window
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
backgroundColor | string | no | The background color of the window must be hexadecimal color value | |
backgroundColorTop | string | no | The background color of the top window must be a hexadecimal color value, and only iOS Support | |
backgroundColorBottom | string | no | The background color of the bottom window must be a hexadecimal color value, and only iOS Support | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# sample code
wx.setBackgroundColor({
backgroundColor: '#ffffff', // The background color of the window is white
})
wx.setBackgroundColor({
backgroundColorTop: '#ffffff', // The background color of the top window is white
backgroundColorBottom: '#ffffff', // The background color of the bottom window is white
})