Class

NSColorPanel

A standard user interface for selecting color in an app.

Declaration

@interface NSColorPanel : NSPanel

Overview

NSColorPanel provides a number of standard color selection modes and, with the NSColorPickingDefault and 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 Object

sharedColorPanel

Returns the shared NSColorPanel instance, creating it if necessary.

sharedColorPanelExists

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

Setting Color Picker Modes

+ setPickerMode:

Specifies the color panel’s initial picker.

mode

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

NSColorPanelMode

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

+ setPickerMask:

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

NSColorPanelOptions

The color modes that are enabled for a color panel.

Configuring the Color Panel

accessoryView

The accessory view.

continuous

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

- setAction:

Sets the color panel's action message.

- setTarget:

Sets the target of the receiver.

showsAlpha

A Boolean value indicating whether or not the receiver shows alpha values and an opacity slider.

Managing Color Lists

- attachColorList:

Adds the list of NSColor objects specified to all the color pickers in the receiver that display color lists by invoking attachColorList: on all color pickers in the application.

- detachColorList:

Removes the list of colors from all the color pickers in the receiver that display color lists by invoking detachColorList: on all color pickers in the application.

Setting Color

+ dragColor:withEvent:fromView:

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

color

The color of the receiver.

Getting Transparency Information

alpha

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

Responding to a Color Change

- changeColor:

Sent to the first responder when the user selects a color in an NSColorPanel object.

Deprecated
NSColorPanelColorDidChangeNotification

Posted when the color of the NSColorPanel is set, as when NSColorPanel is invoked.

Relationships

Inherits From

See Also

Color Panels

NSColorPickingCustom

A set of methods that provides a way to add color pickers—custom user interfaces for color selection—to an app’s color panel.

NSColorPickingDefault

A set of methods that provides basic behavior for a color picker.

NSColorPicker

An abstract superclass that implements the NSColorPickingDefault protocol.