Search code examples
c#windows-10desktop-duplication

Get status of night light mode in Windows 10


I am using the desktop duplication api to grab the screen content and as it turns out, the new night light mode ('Nachtmodus' in German) is not applied in the grabbed screen content.

How do I read (if possible directly in c#) the night mode status (enabled, color shift amount)?

or

How can I tell Windows to give me the color shifted image using the desktop duplication api?

Basically, I want to know the state of what is configured inside these red boxes:

Night light settings (German)


Background: I am working on an ambilight implementation and if the night light mode is enabled, the color shift is not reflected in the LEDs around my screen and so the colors are off between screen content and 'around screen'.


Solution

  • You can check the output of

    GetDeviceGammaRamp
    

    Function from the Win API. Compare the output to Night Light ON and OFF and you should detect it.

    Or you can try to monitor this Reg key for changes

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$$windows.data.bluelightreduction.settings\Current