# Javascript: TXTextControl.getForeColor Method

> Gets the foreground color of the control which is the color of the document's text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.getForeColor Method
- **307 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/getforecolor-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/getforecolor-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/getforecolor-method/llms-full.txt

---

### Description

Gets the foreground color of the control which is the color of the document's text.

### Syntax

```javascript
<void> TXTextControl.getForeColor(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the set foreground color. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TXTextControl.getForeColor` in a practical document-editing workflow. It gets the foreground color of the control which is the color of the document's text.

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

TXTextControl.getForeColor(
    function(result) {
        console.log("get fore color result:", result);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.getFontUnderlineStyle Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/getfontunderlinestyle-method/llms-full.txt)
- **Next:** [Javascript: TXTextControl.getFormattingPrinter Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/getformattingprinter-method/llms-full.txt)
