rpatters1
rpatters1

Reputation: 456

Win32 Detect if my window is running in Dark Mode on Windows 10+

I would like my Win32 application to be able to detect if a window is actually running in Dark Mode. I know about this answer, which suggests reading a registry key for the user setting. That's fine, and it works for me. But many applications do not honor that setting.

I would like to find out which appearance my actual window has. My program is a 3rd-party plugin that runs inside an application I do not control. Currently that host application does not support Dark Mode on Windows, but a new version could potentially start supporting it. I would like to allow my program to detect if it does. I would also like to continue to support older versions of the app, without having to resort to a manual list of versions that do or don't support Dark Mode.

For readers that know something about macOS APIs, I am hoping to find something similar to the effectiveAppearance property on macOS views.

Upvotes: 0

Views: 459

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597205

Individual windows do not have light/dark modes, as far as the OS is concerned, so there is nothing you can query for that. A window doesn't report back to the OS whether or not it is honoring the user's display setting. If it honors the user's setting, it simply draws its UI using appropriate colorings as it deems fit. If it don't honor the user's setting, it simply draws itself using whatever normal/custom colors it wants.

Upvotes: 0

Related Questions