---
title: NSColorSampler
framework: appkit
role: symbol
role_heading: Class
path: appkit/nscolorsampler
---

# NSColorSampler

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

## Declaration

```swift
class NSColorSampler
```

## Overview

Overview Create an NSColorSampler object when you want the user to select a color based on existing onscreen colors. When you call the 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

- [show(selectionHandler:)](appkit/nscolorsampler/show(selectionhandler:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
