Skip to main content

Get Color RGB at Point (screen.get_color_rgb)

Declaration​

r, g, b = screen.get_color_rgb(x, y)

Parameters​

  • x, y
    Integer. Target coordinates.

Returns​

  • r, g, b
    Integer. The R/G/B components of the point, range 0~255.

Description​

Get the color at a screen coordinate and split it into R/G/B components.
Coordinate parameters follow the coordinate system initialized via screen.init.

Example​

local r, g, b = screen.get_color_rgb(512, 133)
if r==0xff and g==0xff and b==0xff then
sys.alert("Point 512,133 is pure white")
end

Note: Uses sys.alert