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

# NSColorPanel

A standard user interface for selecting color in an app.

```
class NSColorPanel
```

## Overview

[`NSColorPanel`](/documentation/AppKit/NSColorPanel) provides a number of standard color selection modes and, with the [`NSColorPickingDefault`](/documentation/AppKit/NSColorPickingDefault) and [`NSColorPickingCustom`](/documentation/AppKit/NSColorPickingCustom) protocols, allows an app to add its own color selection modes. It also allows the user to save swatches containing frequently used colors.

## Topics

### Obtaining the shared color panel

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

Returns the shared `NSColorPanel` instance, creating it if necessary.

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

Returns  a Boolean value indicating whether the `NSColorPanel` has been created already.

### Setting color picker modes

[`setPickerMode(_:)`](/documentation/AppKit/NSColorPanel/setPickerMode(_:))

Specifies the color panel’s initial picker.

[`mode`](/documentation/AppKit/NSColorPanel/mode-swift.property)

The mode of the receiver the mode is one of the modes allowed by the color mask.

[`NSColorPanel.Mode`](/documentation/AppKit/NSColorPanel/Mode-swift.enum)

A type defined for the `enum` constants specifying color panel modes.

[`setPickerMask(_:)`](/documentation/AppKit/NSColorPanel/setPickerMask(_:))

Determines which color selection modes are available in an application’s `NSColorPanel`.

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

The color modes that are enabled for a color panel.

### Configuring the color panel

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

The accessory view.

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

A Boolean value indicating whether the receiver continuously sends the action message to the target.

[`setAction(_:)`](/documentation/AppKit/NSColorPanel/setAction(_:))

Sets the color panel’s action message.

[`setTarget(_:)`](/documentation/AppKit/NSColorPanel/setTarget(_:))

Sets the target of the receiver.

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

A Boolean value that indicates whether the receiver shows alpha values and an opacity slider.

### Managing color lists

[`attachColorList(_:)`](/documentation/AppKit/NSColorPanel/attachColorList(_:))

Adds the list of `NSColor` objects specified to all the color pickers in the receiver that display color lists by invoking [`attachColorList(_:)`](/documentation/AppKit/NSColorPanel/attachColorList(_:)) on all color pickers in the application.

[`detachColorList(_:)`](/documentation/AppKit/NSColorPanel/detachColorList(_:))

Removes the list of colors from all the color pickers in the receiver that display color lists by invoking [`detachColorList(_:)`](/documentation/AppKit/NSColorPanel/detachColorList(_:)) on all color pickers in the application.

### Setting color

[`dragColor(_:with:from:)`](/documentation/AppKit/NSColorPanel/dragColor(_:with:from:))

Drags a color into a destination view from the specified source view.

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

The color of the receiver.

### Supporting high dynamic range (HDR) colors

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

The maximum linear exposure that can be set on a color picked in the color panel. Defaults to 1 and ignores any value less than 1. If set to a value >= 2, the color picked by the panel may have a linear exposure applied to it.

### Getting transparency information

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

The receiver’s current alpha value based on its opacity slider.

### Responding to a color change

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

  <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/changeColor:>

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

Posted when the color of the `NSColorPanel` is set, as when [`NSColorPanel`](/documentation/AppKit/NSColorPanel) is invoked.



---

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)