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

# removeColor(withKey:)

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

```
func removeColor(withKey key: NSColor.Name)
```

## Parameters

`key`

The key for which to remove the color.

## Discussion

This method does nothing if the receiver doesn’t contain the key. This method posts [`didChangeNotification`](/documentation/AppKit/NSColorList/didChangeNotification) to the default notification center. It raises `NSColorListNotEditableException` if the receiver is not editable.

---

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)