---
title: "write(to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolorlist/write(to:)"
---

# write(to:)

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

## Declaration

```swift
func write(to url: URL?) throws
```

## Parameters

- `url`: The URL at which to store the color list. The URL must specify either a directory or file in the file system. Specify nil to save the color list to the user’s ~/Library/Colors directory.

## Discussion

Discussion If url represents a directory, this method saves the color list in that directory in a file with the name .clr, where  is the value of the name property. If url represents a file, this method saves the color list using the name you provided.

## See Also

### Writing and Removing Color List Files

- [removeFile()](appkit/nscolorlist/removefile().md)
- [write(toFile:)](appkit/nscolorlist/write(tofile:).md)
