0

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.

rpatters1
  • 382
  • 1
  • 11
  • Nothing related to dark mode is documented for classic desktop apps. – Anders Aug 16 '22 at 10:41
  • I've read in some threads that something for Dark Mode might be in the Win 11 SDK? But context is hard to pick up when scouring Google results. Perhaps I was mistaken. – rpatters1 Aug 16 '22 at 19:23
  • Let the application supply effective appearance API. The application may take effective appearance based on registry setting, [UISettings](https://learn.microsoft.com/en-us/uwp/api/Windows.UI.ViewManagement.UISettings?view=winrt-22621) or undocumented Win32 API. It's also hard to define Dark Mode for the application. – YangXiaoPo-MSFT Aug 17 '22 at 06:44

1 Answers1

0

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.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770