Match Color Point
Check if all specified color points exist in the specified region of device screenshot, supports similarity threshold settings. Returns true if all colors are found, otherwise throws an error indicating which colors were not found.
Interface Description
Interface Type
matchColorPointParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| deviceId | string | Yes | Device ID |
| colors | array | Yes | Color array, format: `[color |
| rect | array | No | Search area [x1, y1, x2, y2], default full screen |
Return Value
On Success:
javascript
true // All colors found in specified regionOn Failure:
javascript
nullFeature Description
Color Format
Each element in the color array has the format: "color|threshold"
- Color: 6-digit hexadecimal color value, e.g.,
"FFFFFF" - Threshold: Similarity threshold, range 0-1, similarity =
round((1 - threshold) * 255), same for all three channels
Search Area
The rect parameter defines the search area:
- Format:
[x1, y1, x2, y2]
Use Cases
Case 1: Verify UI State
Check if system modal exists:
javascript
const _hasSysModal = await apiInvoke('matchColorPoint', {
deviceId: 'P72578581E07',
colors: ["FFFFFF|0.8", "222222|0.9", "1074EC|0.9"],
rect: [200, 300, 400, 350]
});💡 Tip
- Unlike
findMultiColor,matchColorPointdoes not return specific coordinates, only verifies if colors exist - Suitable for UI state verification, conditional checks, and similar scenarios