<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBitmapImageRep/setColor(_:atX:y:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBitmapImageRep(im)setColor:atX:y:"
  },
  "title" : "setColor(_:atX:y:)"
}
-->

# setColor(_:atX:y:)

Changes the color of the pixel at the specified coordinates.

```
func setColor(_ color: NSColor, atX x: Int, y: Int)
```

## Parameters

`color`

A color object representing the color to be set.

`x`

The x-axis coordinate of the pixel.

`y`

The y-axis coordinate of the pixel.

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