Is there a function to detect light and respond to light and shade?

Hello, I want to make something like Vising that detects light and gives the character a state change.
Is there a function or other way to detect light?