<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/Key/textHighlightStyle",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSTextHighlightStyleAttributeName"
  },
  "title" : "textHighlightStyle"
}
-->

# textHighlightStyle

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

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

## Discussion

The value of this attribute is an [`NSAttributedString.TextHighlightStyle`](/documentation/Foundation/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`](/documentation/Foundation/NSAttributedString/TextHighlightStyle/default) highlight style applies the system highlight color to your text. To apply a different color, add the [`textHighlightColorScheme`](/documentation/Foundation/NSAttributedString/Key/textHighlightColorScheme) attribute to your text in addition to this one. Use the [`textHighlightColorScheme`](/documentation/Foundation/NSAttributedString/Key/textHighlightColorScheme) key to specify which highlight color you want.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)