Skip to main content

SetRoleColor

Sets the color for the specified role.

Syntax

expression.SetRoleColor(name, color);

expression - A variable that represents a ApiFormRoles class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nameRequiredstringThe role name.
colorRequiredstringThe role color.

Returns

boolean

Example

Change the color of role in a form document.

// How to set role color for a form roles?

// Set role color and display the result in a form document.

let doc = Api.GetDocument();
let roles = doc.GetFormRoles();
roles.Add("Customer");
roles.SetRoleColor("Customer", "#C6E0B3");
doc.InsertTextForm({
key: "Name",
role: "Customer",
placeholder: "Enter your name"
});