Class

NSColor​List

An NSColor​List object is an ordered list of NSColor objects, identified by keys. Instances of NSColor​List, or more simply color lists, are used to manage named lists of NSColor instances. The NSColor​Panel list mode color picker uses instances of NSColor​List to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use NSColor​List to manage document-specific color lists.

Symbols

Initializing an NSColorList Object

init(name:​ String)

Initializes and returns the receiver, registering it under the given name if it isn’t in use already.

init?(name:​ String, from​File:​ String?)

Initializes and returns the receiver, registering it under the given name if it isn’t in use already.

Getting Color Lists

class func available​Color​Lists()

Returns an array of all color lists found in the standard color list directories.

init?(named:​ String)

Searches the array that’s returned by available​Color​Lists() and returns the color list with the given name.

Getting Color List Properties

var name:​ String?

The name of the receiver.

var is​Editable:​ Bool

A Boolean value indicating whether the receiver can be modified.

Managing Colors By Key

var all​Keys:​ [String]

An array of the keys by which the NSColor objects are stored in the receiver.

func color(with​Key:​ String)

Returns the NSColor object associated with the given key.

func insert​Color(NSColor, key:​ String, at:​ Int)

Inserts the specified color at the specified location in the receiver.

func remove​Color(with​Key:​ String)

Removes the color associated with the specified key from the receiver.

func set​Color(NSColor, for​Key:​ String)

Associates the specified NSColor object with the specified key.

Writing and Removing Color-List Files

func remove​File()

Removes the file from which the list was created, if the file is in a standard search path and owned by the user.

func write(to​File:​ String?)

Saves the receiver to a file at the specified path.

Instance Methods

Relationships

Inherits From