---
title: NSRectFillListWithColors
framework: appkit
role: symbol
role_heading: Function
path: appkit/nsrectfilllistwithcolors
---

# NSRectFillListWithColors

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

## Declaration

```occ
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 doc://com.apple.appkit/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

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 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.

## See Also

### Drawing Rectangles

- [NSFrameRect](appkit/nsframerect.md)
- [NSFrameRectWithWidth](appkit/nsframerectwithwidth.md)
- [NSFrameRectWithWidthUsingOperation](appkit/nsframerectwithwidthusingoperation.md)
- [NSEraseRect(_:)](appkit/nseraserect(_:).md)
- [NSRectFill](appkit/nsrectfill.md)
- [NSRectFillList](appkit/nsrectfilllist.md)
- [NSRectFillListUsingOperation](appkit/nsrectfilllistusingoperation.md)
- [NSRectFillListWithColorsUsingOperation](appkit/nsrectfilllistwithcolorsusingoperation.md)
- [NSRectFillListWithGrays](appkit/nsrectfilllistwithgrays.md)
- [NSRectFillUsingOperation](appkit/nsrectfillusingoperation.md)
- [NSDrawTiledRects(_:_:_:_:_:)](appkit/nsdrawtiledrects(_:_:_:_:_:).md)
- [NSDrawGroove(_:_:)](appkit/nsdrawgroove(_:_:).md)
- [NSHighlightRect](appkit/nshighlightrect.md)
