How to use the robotjs.getPixelColor function in robotjs

To help you get started, we’ve selected a few robotjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github csiqueirasilva / PoEController / src / game / modes / ARPG.js View on Github external
behaviors['ARPG.Fixed.OptionsMenu'] = function () {
	// check if possible to open menu (eg: if esc menu is not open)
	var color = robot.getPixelColor(parseInt(Window.width * 0.1421875), parseInt(Window.height * 0.89351851852));
	if (color > "777777") {
		Mode.change(OptionsMenu);
	}
};
github ivanseidel / IAMDinosaur / Scanner.js View on Github external
Scanner.scanUntil = function (start, delta, matchColor, inverted, iterLimit) {
  var color, current, iterations = 0;

  // (CLONE instead of using the real one)
  current = Scanner.makeInBounds([start[X], start[Y]]);

  if (delta[X] == 0 && delta[Y] == 0) {
    return null;
  }


  while (!Scanner.isOutOfBound(current)) {
    // Check current pixel
    color = robot.getPixelColor(current[X], current[Y]);

    if (!inverted && color.toString() == matchColor) {
      return current;
    }

    if (inverted && color.toString() != matchColor) {
      return current;
    }

    current[X] += delta[X];
    current[Y] += delta[Y];
    iterations++;

    if (iterations > iterLimit) {
      return null;
    }
github octalmage / pixelcolor / app.js View on Github external
timer = setInterval(function()
	{
		var mouse = robot.getMousePos();
		hex = robot.getPixelColor(mouse.x, mouse.y);
		$("#color").text(hex);
		$("body").css("background-color", "#" + hex);
	}, 200);
}
github ThePacielloGroup / CCAe / src / controllers / picker.js View on Github external
mouseEvent.on('move', (x, y) => {
          let posx, posy
          if (process.platform === 'win32' && ratio > 1) {
            posx = x / ratio
            posy = y / ratio
          } else {
            posx = x
            posy = y
          }
          let color = '#' + robot.getPixelColor(parseInt(x), parseInt(y))
          picker.getWindow().setPosition(parseInt(posx) - 100, parseInt(posy) - 50)
          picker.getWindow().webContents.send('updatePicker', color)
        })
github PrismarineJS / node-minecraft-wrap / lib / client_control.js View on Github external
const t=setInterval(() => {
            debug(robot.getPixelColor(width/2,height/2));
            if(robot.getPixelColor(width/2,height/2)!=="160f0a") {
              clearInterval(t);
              resolve();
            }
          },200);
          setTimeout(() => {
github Toinane / colorpicker / src / events / picker.js View on Github external
mouseEvent.on('move', (x, y) => {
      let color = '#' + robot.getPixelColor(parseInt(x), parseInt(y))
      picker.getWindow().setPosition(parseInt(x) - 50, parseInt(y) - 50)
      picker.getWindow().webContents.send('updatePicker', color)
      if (realtime) colorpicker.getWindow().webContents.send('previewColor', color)
    })
github csiqueirasilva / PoEController / src / game / SignatureDetectionWorker.js View on Github external
function DetectPixelSignature (SigCollection) {
	var sigDetected = false;
	var sig = null;
	
	for(var i = 0; i < SigCollection.length && !sigDetected; i++) {
		var testSig = SigCollection[i];
		var sigMatching = true;
		
		for(var j = 0; j < testSig.x.length && sigMatching; j++) {
			var c = testSig.x[j];
			var pixelAt = parseInt(robot.getPixelColor(c.x, testSig.y), 16);

			if(c.color !== pixelAt) {
				sigMatching = false;
			}
		}
		
		sigDetected = sigMatching;
	}
	
	if(sigDetected) {
		sig = SigCollection[i - 1];
	}
	
	return sig;
}
github PrismarineJS / node-minecraft-wrap / lib / client_control.js View on Github external
const t=setInterval(() => {
            debug(robot.getPixelColor(width/2,height/2));
            if(robot.getPixelColor(width/2,height/2)!=="160f0a") {
              clearInterval(t);
              resolve();
            }
          },200);
          setTimeout(() => {