<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIColor/cgColor",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIColor(py)CGColor"
  },
  "title" : "cgColor"
}
-->

# cgColor

The Quartz color that corresponds to the color object.

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

## Discussion

The color object in this property doesn’t adapt automatically to Dark Mode changes. If you use it to set the color of interface elements, you must update that color yourself. You update that color when the [`userInterfaceStyle`](/documentation/UIKit/UITraitCollection/userInterfaceStyle) trait of the current trait collection changes.

For information on how to apply color information reliably, see [Supporting Dark Mode in your interface](/documentation/UIKit/supporting-dark-mode-in-your-interface).

---

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)