# Javascript: Selection.getTextBackColor Method

> Gets the background color of the selected text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 26.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: Selection.getTextBackColor Method
- **307 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/gettextbackcolor-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/gettextbackcolor-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/gettextbackcolor-method/llms-full.txt

---

### Description

Gets the background color of the selected text.

### Syntax

```javascript
<void> Selection.getTextBackColor(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the background color of the selected text either as a hex value or an HTML color name. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Selection.getTextBackColor` in a practical document-editing workflow. It gets the background color of the selected text.

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

TXTextControl.selection.getTextBackColor(
    function(result) {
        console.log("get text back color result:", result);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.getText Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/gettext-method/llms-full.txt)
- **Next:** [Javascript: Selection.getUnderline Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/getunderline-method/llms-full.txt)
