ThemeColor
Creates a theme color.
Syntax
expression.ThemeColor(name, tintAndShade);
expression - A variable that represents an Api class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| name | Optional | SchemeColorId | "tx1" | The theme color name. If the provided name is not supported, the 'tx1' color will be used. |
| tintAndShade | Optional | number | 0 | The luminance shift from -1 (the darkest shade) to 1 (the lightest tint). 0 keeps the theme color as it is. |
Returns
Example
Apply a theme color to paragraph text in a document.
// How do I color text using the document's theme palette in a document?
// Set the font color of a paragraph to one of the built-in theme accent colors in a document.
const doc = Api.GetDocument();
const color = Api.ThemeColor('accent6');
const paragraph = doc.GetElement(0);
paragraph.AddText('This text is in theme color.');
paragraph.SetColor(color);