---
title: textHighlightStyle
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/key/texthighlightstyle
---

# textHighlightStyle

An attribute that adds a highlight color to the text to emphasize it.

## Declaration

```swift
static let textHighlightStyle: NSAttributedString.Key
```

## Discussion

Discussion The value of this attribute is an NSAttributedString.TextHighlightStyle structure. The default value of this attribute is nil, which does not add a highlight to the text. A highlight adds a background color behind the text, and adjusts the color of the text itself to contrast appropriately. The default highlight style applies the system highlight color to your text. To apply a different color, add the textHighlightColorScheme attribute to your text in addition to this one. Use the textHighlightColorScheme key to specify which highlight color you want.

## See Also

### Getting text attribute keys

- [cursor](foundation/nsattributedstring/key/cursor.md)
- [link](foundation/nsattributedstring/key/link.md)
- [markedClauseSegment](foundation/nsattributedstring/key/markedclausesegment.md)
- [replacementIndex](foundation/nsattributedstring/key/replacementindex.md)
- [shadow](foundation/nsattributedstring/key/shadow.md)
- [spellingState](foundation/nsattributedstring/key/spellingstate.md)
- [suggestionHighlight](foundation/nsattributedstring/key/suggestionhighlight.md)
- [textAlternatives](foundation/nsattributedstring/key/textalternatives.md)
- [textEffect](foundation/nsattributedstring/key/texteffect.md)
- [textHighlightColorScheme](foundation/nsattributedstring/key/texthighlightcolorscheme.md)
- [textItemTag](foundation/nsattributedstring/key/textitemtag.md)
- [toolTip](foundation/nsattributedstring/key/tooltip.md)
