<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSRectFillListWithColors",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@F@NSRectFillListWithColors"
  },
  "title" : "NSRectFillListWithColors"
}
-->

# NSRectFillListWithColors

Fills the rectangles in the passed list with the passed list of colors.

```
extern void NSRectFillListWithColors(const NSRect *rects, NSColor * const*colors, NSInteger num);
```

## Parameters

`rects`

A pointer to an array of <doc://com.apple.documentation/documentation/Foundation/NSRect> structures representing the rectangles to fill.

`colors`

A pointer to an array of [`NSColor`](/documentation/AppKit/NSColor) objects. The number of color objects in this parameter must equal the number of rectangles in the `rects` parameter.

`num`

The number of rectangles in the `rects` parameter.

## Discussion

Takes a list of `num` rectangles and a matching list of color objects. The first rectangle is filled with the first color, the second rectangle with the second color, and so on. There must be an equal number of rectangles and color values. The rectangles are composited using the [`NSCompositeCopy`](/documentation/AppKit/NSCompositeCopy) operator and the order in which the rectangles are filled cannot be guaranteed; therefore, overlapping rectangles may not draw as expected. This function alters the current color of the current graphics state, setting it unpredictably to one of the values passed in `colors`.

For more information, see [`NSCompositingOperation`](/documentation/AppKit/NSCompositingOperation).

---

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)