<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderPassColorAttachmentDescriptor/clearColor",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLRenderPassColorAttachmentDescriptor(py)clearColor"
  },
  "title" : "clearColor"
}
-->

# clearColor

The color to use when clearing the color attachment.

```
var clearColor: MTLClearColor { get set }
```

## Discussion

If the [`loadAction`](/documentation/Metal/MTLRenderPassAttachmentDescriptor/loadAction) property of the attachment is set to [`MTLLoadAction.clear`](/documentation/Metal/MTLLoadAction/clear), then at the start of a render pass, the GPU fills the texture with the value stored in the [`clearColor`](/documentation/Metal/MTLRenderPassColorAttachmentDescriptor/clearColor) property. Otherwise, the GPU ignores the [`clearColor`](/documentation/Metal/MTLRenderPassColorAttachmentDescriptor/clearColor) property.

The [`clearColor`](/documentation/Metal/MTLRenderPassColorAttachmentDescriptor/clearColor) property represents a set of RGBA components. The default value is `(0.0, 0.0, 0.0, 1.0)` (black). Use the [`MTLClearColorMake(_:_:_:_:)`](/documentation/Metal/MTLClearColorMake(_:_:_:_:)) function to construct an [`MTLClearColor`](/documentation/Metal/MTLClearColor) value.

---

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)