# Javascript: TableOfContents.setHighlightColor Method

> Sets the highlight color for the table of contents.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TableOfContents.setHighlightColor Method
- **365 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tableofcontents/sethighlightcolor-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tableofcontents/sethighlightcolor-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tableofcontents/sethighlightcolor-method/llms-full.txt

---

### Description

Sets the highlight color for the table of contents.

### Syntax

```javascript
<void> TableOfContents.setHighlightColor(<string> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| value | The property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TableOfContents.setHighlightColor` in a practical document-editing workflow. It sets the highlight color for the table of contents.

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

function configureHighlightColor(tableOfContents) {
    tableOfContents.setHighlightColor(
        "#ffd54f",
        function() {
            console.log("set highlight color completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TableOfContents.setHasRightAlignedPageNumbers Method](https://docs.textcontrol.com/ds-server/reference/javascript/tableofcontents/sethasrightalignedpagenumbers-method/llms-full.txt)
- **Next:** [Javascript: TableOfContents.setHighlightMode Method](https://docs.textcontrol.com/ds-server/reference/javascript/tableofcontents/sethighlightmode-method/llms-full.txt)
