Color on screen

Hey, I’m relevantly new to applescript and I’ve been trying to figure this out for a while with no luck so hopefully I can get some help here.

I am trying to run an action when the color on my screen or on a certain area of the screen changes. For example when the screen darkens I want a certain action to activate or better yet I want it to run a different script.

I want a script to be run when a game Im playing changes color.

Any help is greatly appreciated.