---
title: "setAction(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolorpanel/setaction(_:)"
---

# setAction(_:)

Sets the color panel’s action message.

## Declaration

```swift
func setAction(_ selector: Selector?)
```

## Parameters

- `selector`: The action message.

## Discussion

Discussion 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 action is NULL by default.

## See Also

### Configuring the color panel

- [accessoryView](appkit/nscolorpanel/accessoryview.md)
- [isContinuous](appkit/nscolorpanel/iscontinuous.md)
- [setTarget(_:)](appkit/nscolorpanel/settarget(_:).md)
- [showsAlpha](appkit/nscolorpanel/showsalpha.md)
