setContainerBackgroundColor

The setContainerBackgroundColor function is used to configure the background color of the mini program.

Method signature

copy
/**
 * Set the griver container backgroundColor  using RGBA values.
 */
- (void)setContainerBackgroundColor:(NSInteger)red
                              green:(NSInteger)green
                               blue:(NSInteger)blue
                              alpha:(NSInteger)alpha;

Parameters

The following parameters specify the background color of the mini program.

Parameter

Data Type

Default value

Required

Description

red

NSInteger

0

Yes

Specifies the value of the red channel. The value range is between 0-255, including 0 and 255.

green

NSInteger

0

Yes

Specifies the value of the green channel. The value range is between 0-255, including 0 and 255.

blue

NSInteger

0

Yes

Specifies the value of the blue channel. The value range is between 0-255, including 0 and 255.

alpha

NSInteger

255

Yes

Specifies the value of the alpha channel.

The value range is between 0-255, including 0 and 255.

Note: Currently, this parameter does not support passing in customized values. If a value other than 255 is set, it is still set to 255.

Sample

copy
let param = GRVStartupParams()
param.setContainerBackgroundColor(255, green: 0, blue: 0, alpha: 255)

if let viewController = try? GRVAppContainerLaunch.sharedInstance().openApp(withUrl: url.absoluteString, startupParams: param) {
    let rootNav: UINavigationController? = nil //get the current UINavigationController
    rootNav?.pushViewController(viewController, animated: true)
}

User experience

Value

Screenshot

(255,0,0,255)

image.png