Class

NSColorList

An ordered list of color objects, identified by keys.

Overview

An NSColorList object (known as a color list) manages a list of NSColor objects, each of which has an associated name. An NSColorPicker object uses a color list to 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 color list to manage document-specific color lists.

Topics

Creating a Color List

init(name: NSColorList.Name)

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

init?(name: NSColorList.Name, fromFile: String?)

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

Getting Color Lists

class var availableColorLists: [NSColorList]

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

init?(named: NSColorList.Name)

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

Getting Color List Properties

var name: NSColorList.Name?

The name of the receiver.

typealias NSColorList.Name

The name assigned to a color list.

var isEditable: Bool

A Boolean value indicating whether the receiver can be modified.

Managing Colors By Key

var allKeys: [NSColor.Name]

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

func color(withKey: NSColor.Name) -> NSColor?

Returns the NSColor object associated with the given key.

func insertColor(NSColor, key: NSColor.Name, at: Int)

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

func removeColor(withKey: NSColor.Name)

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

func setColor(NSColor, forKey: NSColor.Name)

Associates the specified NSColor object with the specified key.

Writing and Removing Color-List Files

func write(to: URL?)

Saves the color list to the file at the specified URL.

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?) -> Bool

Saves the color list to the file at the specified path.

Deprecated

Relationships

Inherits From

See Also

Colors

class NSColor

An object that stores color data and sometimes opacity (alpha value).

class NSColorSpace

An object that represents a custom color spaces.