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

# setTarget(_:)

Sets the target of the receiver.

```
func setTarget(_ target: Any?)
```

## Parameters

`target`

The target of the receiver. When you select a color in the color panel `NSColorPanel` sends its action to its target, provided that neither the action nor the target is `nil`. The target is `nil` by default.

## See Also

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

A standard user interface for selecting color in an app.



---

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)