<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSColorList",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSColorList"
  },
  "title" : "NSColorList"
}
-->

# NSColorList

An ordered list of color objects, identified by keys.

```
class NSColorList
```

## Overview

A color list manages a list of [`NSColor`](/documentation/AppKit/NSColor) objects, each of which has an associated name. The [`NSColorPanel`](/documentation/AppKit/NSColorPanel) list mode color picker uses instances of [`NSColorList`](/documentation/AppKit/NSColorList) to represent any lists of colors that come with the system, as well as any lists the user creates. An app can use a color list to manage document-specific color lists.

## Topics

### Creating Lists of Colors

[`-  initWithName:`](/documentation/AppKit/NSColorList/init(name:))

Initializes and returns a color list, registering it under the specified name if it isn’t in use already.

[`-  initWithName:fromFile:`](/documentation/AppKit/NSColorList/init(name:fromFile:))

Initializes and returns a color list from the specified file, registering it under the specified name if it isn’t in use already.

### Getting Lists of Colors

[`availableColorLists`](/documentation/AppKit/NSColorList/availableColorLists)

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

[`+  colorListNamed:`](/documentation/AppKit/NSColorList/init(named:))

Searches the available color lists array and returns the color list with the specified name.

### Getting Information About Lists of Colors

[`name`](/documentation/AppKit/NSColorList/name-swift.property)

The name of the color list.

[`Name`](/documentation/AppKit/NSColorList/Name-swift.typealias)

The name assigned to a color list.

[`editable`](/documentation/AppKit/NSColorList/isEditable)

A Boolean value that indicates whether the color list can be modified.

### Managing Colors By Key

[`allKeys`](/documentation/AppKit/NSColorList/allKeys)

An array of the keys by which the color objects are stored in the color list.

[`-  colorWithKey:`](/documentation/AppKit/NSColorList/color(withKey:))

Returns the color object associated with the specified key.

[`-  insertColor:key:atIndex:`](/documentation/AppKit/NSColorList/insertColor(_:key:at:))

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

[`-  removeColorWithKey:`](/documentation/AppKit/NSColorList/removeColor(withKey:))

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

[`-  setColor:forKey:`](/documentation/AppKit/NSColorList/setColor(_:forKey:))

Associates the specified color object with the specified key.

### Writing and Removing Color List Files

[`-  writeToURL:error:`](/documentation/AppKit/NSColorList/write(to:))

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

[`-  removeFile`](/documentation/AppKit/NSColorList/removeFile())

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

[`-  writeToFile:`](/documentation/AppKit/NSColorList/write(toFile:))

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

### Notifications

[`NSColorListDidChangeNotification`](/documentation/AppKit/NSColorList/didChangeNotification)

Posted whenever a color list changes.

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)