<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSColorList/write(toFile:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSColorList(im)writeToFile:"
  },
  "title" : "write(toFile:)"
}
-->

# write(toFile:)

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

```
func write(toFile path: String?) -> Bool
```

## Parameters

`path`

The path at which to save the color list. If `path` is a directory, the receiver is saved in a file named listname`.clr` in that directory (where listname is the name with which the receiver was initialized).

    If     `path`     includes a filename, this method saves the file under that name. If     `path`     is     `nil`    ,  the file is saved as listname    `.clr`     in the user’s private colorlists directory.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> upon success and <doc://com.apple.documentation/documentation/Swift/false> if the method fails to write the file.

## Discussion

---

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)