Copyable Example Code
You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.
-- Click a color inside a region
-- targetColor: HEX color; score: similarity threshold from 0 to 1
local targetColor = "#FF4444"
local score = 0.85
local x, y, w, h = 100, 300, 900, 600
Snap.screenRefresh()
local region = Region(x, y, w, h)
local match = region:find(Asset.color(targetColor):mScore(score))
if match then
toast("Color found at " .. match:getX() .. ", " .. match:getY())
click(match)
wait(300)
else
toast("Color not found")
end