# findColors

Find a pattern of color anchors.

```js
findColors(options)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `options.colors` | array | [{color,x,y}, ...] or [[color,x,y], ...]; first offset must be (0,0). Remaining offsets are relative. |
| `options.count` | number | Maximum matches; default 10, 0 = all. |
| `options.region` | object \| array | Optional {x,y,width,height} or [x,y,width,height] in native pixels. |
| `options.tolerance` | number | Per-channel difference 0..255; default 0. |
| `options.rightToLeft, options.bottomToTop` | boolean | Optional scan directions; default false. |
| `options.debug` | boolean | Optional saved debug image; default false. |

## Returns

[locations, null] or [null, errorString]. [] means no match.

## Example

```js
const [hits, error] = findColors({colors: [[0xFF0000, 0, 0], [0xFFFFFF, 10, 0]], count: 1});
if (error) throw new Error(error);
console.log(hits);
```

[All JavaScript APIs](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
