Java tutorial
import java.awt.AWTException; import java.awt.Color; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Robot; public class Main { public static void main(String[] args) throws Exception { System.out.println(getPointerColor()); } public static Color getPointerColor() throws AWTException { Point coordinates = MouseInfo.getPointerInfo().getLocation(); Robot robot = new Robot(); return robot.getPixelColor((int) coordinates.getX(), (int) coordinates.getX()); } }