DS Server

Javascript: Selection.setForeColor Method

Method|Introduced in 26.0

Description

Sets the selection's foreground color.

Syntax

<void> Selection.setForeColor(<string> foreColor, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
foreColor

The selection's foreground color.

callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates Selection.setForeColor in a practical document-editing workflow. It sets the selection's foreground color.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.selection.setForeColor(
    "#ffd54f",
    function() {
        console.log("set fore color completed.");
    },
    onTxError
);