Check out the IOKit app and IORegistryExplorer.
In particular, you will need to search for IOKit for devices named "display" and you will get a node device from which you can retrieve data. Use the IORegistryExplorer application to find out which attributes are available from this object, and what data types they are, etc.
Jim dovey
source share