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

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

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

## Parameters

`name`

The name of the file for the color list (minus the `“.clr”` extension). Specify `@””` if you don’t want a name.

`path`

The full path to the file for the color list. A `nil` path indicates the color list should be initialized with no colors.

## Discussion

Note that this method does not add the color list to [`availableColorLists`](/documentation/AppKit/NSColorList/availableColorLists) until the color list is saved into the user’s path with [`write(toFile:)`](/documentation/AppKit/NSColorList/write(toFile:)) with a value of `nil`.

---

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)