Instance Method

insertColor(_:key:at:)

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

Declaration

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

Parameters

color

The color to add to the color list.

key

The key with which to associate the color.

location

The location in the color list at which to place the specified color. Locations are numbered starting with 0.

Discussion

If the list already contains a color with the same key at a different location, it’s removed from the old location. This method posts didChangeNotification to the default notification center. It raises NSColorListNotEditableException if the color list isn’t editable.

See Also

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 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.