SetBackgroundColor
Sets the background color to the current form.
Inherited from ApiFormBase.SetBackgroundColor.
Syntax
expression.SetBackgroundColor(color);
expression - A variable that represents an ApiCheckBoxForm class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| color | Optional | ApiColor | The background color. |
Returns
boolean
Example
Apply a background color to checkbox forms in a document.
// How do I set the background color of a checkbox form in a document?
// Style multiple radio-button checkboxes with a matching fill color in a document.
let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true});
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Married");
checkBoxForm.SetBackgroundColor(Api.HexColor('#FF6F3D'));
paragraph.AddLineBreak();
checkBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true});
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Single");
checkBoxForm.SetBackgroundColor(Api.HexColor('#FF6F3D'));