# searchColor

Find pixels matching a color.

```js
searchColor(options)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `options.color` | number | RGB integer, such as 0xFF0000. |
| `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]; locations are {x,y} in native pixels.

## Example

```js
const [hits, error] = searchColor({color: 0xFF0000, count: 1, tolerance: 8});
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)
