Retrieves the color of the pixel at the specified x,y coordinates.
PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB]
The name of the variable in which to store the color ID in hexadecimal blue-green-red (BGR) format. For example, the color purple is defined 0x800080 because it has an intensity of 80 for its blue and red components but an intensity of 00 for its green component.
The X and Y coordinates of the pixel, which can be expressions. Coordinates are relative to the active window unless CoordMode was used to change that.
This parameter may contain zero or more of the following words. If more than one word is present, separate each from the next with a space (e.g.
Alt [v220.127.116.11+]: Uses an alternate method to retrieve the color, which should be used when the normal method produces invalid or inaccurate colors for a particular type of window. This method is about 10% slower than the normal method.
Slow [v18.104.22.168+]: Uses a more elaborate method to retrieve the color, which may work in certain full-screen applications when the other methods fail. This method is about three times slower than the normal method. Note: Slow takes precedence over Alt, so there is no need to specify Alt in this case.
RGB: Retrieves the color in RGB vs. BGR format. In other words, the red and the blue components are swapped. This is useful for retrieving colors compatible with WinSet, Gui, Progress, and SplashImage.
[v1.1.04+] This command is able to throw an exception on failure. For more information, see Runtime Errors.
ErrorLevel is set to 1 if there was a problem or 0 otherwise.
The pixel must be visible; in other words, it is not possible to retrieve the pixel color of a window hidden behind another window. By contrast, pixels beneath the mouse cursor can usually be detected. The exception to this is game cursors, which in most cases will hide any pixels beneath them.
Use Window Spy (available in tray icon menu) or the example at the bottom of this page to determine the colors currently on the screen.
PixelSearch, ImageSearch, CoordMode, MouseGetPos
^!z:: ; Control+Alt+Z hotkey. MouseGetPos, MouseX, MouseY PixelGetColor, color, %MouseX%, %MouseY% MsgBox The color at the current cursor position is %color%. return