Class

NSColorList

An NSColorList object is an ordered list of NSColor objects, identified by keys. Instances of NSColorList, or more simply color lists, are used to manage named lists of NSColor instances. The NSColorPanel list mode color picker uses instances of NSColorList to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use NSColorList 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, fromFile: String?)

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

Getting Color Lists

class func availableColorLists()

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

init?(named: String)

Searches the array that’s returned by availableColorLists() and returns the color list with the given name.

Getting Color List Properties

var name: String?

The name of the receiver.

var isEditable: Bool

A Boolean value indicating whether the receiver can be modified.

Managing Colors By Key

var allKeys: [String]

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

func color(withKey: String)

Returns the NSColor object associated with the given key.

func insertColor(NSColor, key: String, at: Int)

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

func removeColor(withKey: String)

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

func setColor(NSColor, forKey: String)

Associates the specified NSColor object with the specified key.

Writing and Removing Color-List Files

func removeFile()

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(toFile: String?)

Saves the receiver to a file at the specified path.

Instance Methods

Relationships

Inherits From