Instance Method


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


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



The color to add to the color list.


The key with which to associate the color.


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


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.