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

# NSColorSampler

An object that displays the system’s color-sampling interface and returns the selected color to your app.

```
class NSColorSampler
```

## Overview

Create an [`NSColorSampler`](/documentation/AppKit/NSColorSampler) object when you want the user to select a color based on existing onscreen colors. When you call the [`show(selectionHandler:)`](/documentation/AppKit/NSColorSampler/show(selectionHandler:)) method, AppKit shows the system’s color sampler interface and reports the selected color back to the provided block.

## Topics

### Capturing a Color Sample

[`-  showSamplerWithSelectionHandler:`](/documentation/AppKit/NSColorSampler/show(selectionHandler:))

Displays the system color-sampling interface asynchronously and reports the selected color back to your app.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)