---
title: foregroundColor
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/key/foregroundcolor
---

# foregroundColor

The color of the text.

## Declaration

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

## Discussion

Discussion In macOS, the value of this attribute is an NSColor instance. In iOS, tvOS, watchOS, and Mac Catalyst, the value of this attribute is a UIColor instance. Use this attribute to specify the color of the text during rendering. If you don’t specify this attribute, the text renders in black.

## See Also

### Getting rendering attribute keys

- [backgroundColor](foundation/nsattributedstring/key/backgroundcolor.md)
- [baselineOffset](foundation/nsattributedstring/key/baselineoffset.md)
- [font](foundation/nsattributedstring/key/font.md)
- [glyphInfo](foundation/nsattributedstring/key/glyphinfo.md)
- [kern](foundation/nsattributedstring/key/kern.md)
- [ligature](foundation/nsattributedstring/key/ligature.md)
- [paragraphStyle](foundation/nsattributedstring/key/paragraphstyle.md)
- [strikethroughColor](foundation/nsattributedstring/key/strikethroughcolor.md)
- [strikethroughStyle](foundation/nsattributedstring/key/strikethroughstyle.md)
- [strokeColor](foundation/nsattributedstring/key/strokecolor.md)
- [strokeWidth](foundation/nsattributedstring/key/strokewidth.md)
- [superscript](foundation/nsattributedstring/key/superscript.md)
- [tracking](foundation/nsattributedstring/key/tracking.md)
- [underlineColor](foundation/nsattributedstring/key/underlinecolor.md)
- [underlineStyle](foundation/nsattributedstring/key/underlinestyle.md)
