Working demo of HTML5 ambient light API
What is Ambient Light API? "events that provide information about the ambient light level, as measured by a device’s light sensor"
Check here for browser compatibility https://developer.mozilla.org/en-US/docs/Web/API/DeviceLightEvent#Browser_compatibility