<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSColorPickingCustom/setColor(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSColorPickingCustom(im)setColor:"
  },
  "title" : "setColor(_:)"
}
-->

# setColor(_:)

Adjusts the receiver to make the specified color the currently selected color.

```
@MainActor func setColor(_ newColor: NSColor)
```

## Parameters

`newColor`

The color to set as the currently selected color.

## Discussion

This method is invoked on the current color picker each time `NSColorPanel`‘s [`color`](/documentation/AppKit/NSColorPanel/color) method is invoked. If `color` is actually different from the color picker’s color (as it would be if, for example, the user dragged a color into `NSColorPanel`‘s color well), this method could be used to update the color picker’s color to reflect the change.

## See Also

[`color`](/documentation/AppKit/NSColorPanel/color)

The color of the receiver.



---

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)