---
title: cgColor
framework: swiftui
role: symbol
role_heading: Instance Property
path: swiftui/color/cgcolor
---

# cgColor

A Core Graphics representation of the color, if available.

## Declaration

```swift
var cgColor: CGColor? { get }
```

## Discussion

Discussion You can get a CGColor instance from a constant SwiftUI color. This includes colors you create from a Core Graphics color, from RGB or HSB components, or from constant UIKit and AppKit colors. For a dynamic color, like one you load from an Asset Catalog using init(_:bundle:), or one you create from a dynamic UIKit or AppKit color, this property is nil. To evaluate all types of colors, use the resolve(in:) method.
