Skip to main content

SetBackgroundColor

Sets the background color to the current content control.

Syntax

expression.SetBackgroundColor(color);

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
colorOptionalApiColorThe background color.

Returns

boolean

Example

This example shows how to set the background color for the block-level container.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.SetBackgroundColor(Api.RGBA(0, 0, 255, 40));
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with a blue transparent background.");
doc.AddElement(0, blockLvlSdt);