This is an image processing / computer vision task, which can be done in Python, as well as numerous other languages.
You need to make sure though that you can capture the screen and process the image with a high enough frequency for your needs.
You need to make sure though that you can capture the screen and process the image with a high enough frequency for your needs.