Class

NSColor​Panel

The NSColor​Panel class provides a standard user interface for selecting color in an application. It provides a number of standard color selection modes and, with the NSColor​Picking​Default and NSColor​Picking​Custom protocols, allows an application to add its own color selection modes. It allows the user to save swatches containing frequently used colors.

Symbols

Obtaining the Shared Color-Panel Object

class func shared()

Returns the shared NSColor​Panel instance, creating it if necessary.

class func shared​Color​Panel​Exists()

Returns a Boolean value indicating whether the NSColor​Panel has been created already.

Configuring the Color Panel

var is​Continuous:​ Bool

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

var mode:​ NSColor​Panel​Mode

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

func set​Action(Selector?)

Sets the color panel's action message.

func set​Target(Any?)

Sets the target of the receiver.

var shows​Alpha:​ Bool

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

Managing Color Lists

func attach​Color​List(NSColor​List)

Adds the list of NSColor objects specified to all the color pickers in the receiver that display color lists by invoking attach​Color​List(_:​) on all color pickers in the application.

func detach​Color​List(NSColor​List)

Removes the list of colors from all the color pickers in the receiver that display color lists by invoking detach​Color​List(_:​) on all color pickers in the application.

Setting Color Picker Modes

class func set​Picker​Mask(NSColor​Panel​Options)

Determines which color selection modes are available in an application’s NSColor​Panel.

class func set​Picker​Mode(NSColor​Panel​Mode)

Specifies the color panel’s initial picker.

Setting Color

class func drag​Color(NSColor, with:​ NSEvent, from:​ NSView)

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

var color:​ NSColor

The color of the receiver.

Getting Color Information

var alpha:​ CGFloat

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

Responding to a Color Change

func change​Color(Any?)

Sent to the first responder when the user selects a color in an NSColor​Panel object.

Constants

Color Picker Mode Masks

Used to specify in the set​Picker​Mask(_:​) class method which of the color modes the NSColor​Panel can use.

NSColor​Panel​Mode

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

Color Panel Modes

Specify the active color mode used when an application’s instance of NSColor​Panel is masked for more than one color mode.

Notifications

static let NSColor​Panel​Color​Did​Change:​ NSNotification.Name

Posted when the color of the NSColor​Panel is set, as when NSColor​Panel is invoked.

Relationships

Inherits From