Ready-to-use Code ExampleRegionAssetColorSnap

Click Color in Region

Searches for a specific color value within a defined area and clicks the location if found. Asset.color() defines the target color, and mScore controls similarity sensitivity. Color is specified in HEX format.

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.

-- Belirli alanda renge tikla / Click color in region
-- Parametreler: hedef renk HEX, mScore (0.0-1.0)

local hedefRenk = "#FF4444"
local mScore = 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(hedefRenk):mScore(mScore))

if match then
  toast("Renk bulundu: " .. match:getX() .. ", " .. match:getY())
  quickTap(match)
  wait(300)
else
  toast("Renk bulunamadi")
end

Implementation and Adaptation Notes

  • Before running, replace sample values such as image names, text, colors, coordinates, and file paths with your own macro values.
  • For examples that use Region or coordinates, retest the target area on different resolutions and DPI values.
  • Tune mScore, timeout, and scan rate in a test macro first, then move the verified values into the production macro.
  • Avoid overly wide Region areas; a tighter area scans faster and reduces false matches.