<!--
{
  "availability" : [
    "iOS: 14.0.0 - 27.0.0",
    "iPadOS: 14.0.0 - 27.0.0",
    "macCatalyst: 14.0.0 - 27.0.0",
    "macOS: 11.0.0 - 27.0.0",
    "tvOS: 14.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 7.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Color/cgColor",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ColorV02cgC0So10CGColorRefaSgvp"
  },
  "title" : "cgColor"
}
-->

# cgColor

A Core Graphics representation of the color, if available.

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

## Discussion

You can get a
<doc://com.apple.documentation/documentation/CoreGraphics/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:)`](/documentation/SwiftUI/Color/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.

---

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)