Tracing colours

yo,

was just wondering how one would go about tracing a background colour.

for example if the background colour was 0x000000 have an object fall, if it is 0xFF0000 have it not fall.

was thinking of dividing the screen into a grid but I don’t know how to trace colours,

cheers, Sam