Skip to main content

HexColor

Creates a color from a HEX string.

Syntax

expression.HexColor(hexString);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
hexStringRequiredstringNo description provided.

Returns

ApiColor

Example

This example shows how to create a hex color and use it as a font color.

const doc = Api.GetDocument();
const color = Api.HexColor('#DECADE');
const paragraph = doc.GetElement(0);
paragraph.AddText('This text is in hex color.');
paragraph.SetColor(color);