Is that white color for the windows titlebar (and/or that top border) hardcoded or is there a registry setting for it?
It doesn't match with HKEY_CURRENT_USER\Control Panel\Colors\ActiveBorder (or ActiveTitle, WindowFrame etc), or anything in HKEY_CURRENT_USER\Control Panel\Desktop\Colors nor HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM.
i can set it to the activecolor by setting ColorPrevalence to 1 in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM.... but would like to be able to detect the color when that is not set.
The corresponding registry entry is AccentColorInactive
. The full path is:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM\AccentColorInactive
The AccentColorInactive
key contains a 32-bit DWORD
value specifying the color in ABGR (alpha-blue-green-red) format. (Note that this ABGR format is a different byte ordering than the ARGB format used by other keys, such as ColorizationColor
!) The AccentColorInactive
specifies the color that gets used to paint title bars on inactive windows when the ColorPrevalence
key is set to 1
(which turns on the showing of colors on title bars). You can change it in the Registry, and your changes will take effect immediately (no need to log out and back in again)—great for experimentation!
However, this key does not exist by default. It needs to be manually created by the user or some customization tool.
Therefore, if the key does not exist, you should fall back to assuming that inactive title bars have the default color, which is white. (Oddly, the default inactive title bar color is still white, even when you have the "Dark" mode enabled. This may or may not be a bug in Windows. If your app depends on this, you should watch out for it to change in future updates to Windows!)
Unfortunately, there is no documented API for this. None of the GetSysColor
, GetThemeSysColor
, and GetThemeColor
APIs return the correct value, and the WinRT UIColorType
enum only provides the "Accent" color, not the inactive accent color. Reading the registry appears to be your only option, until someone disassembles the OS code and finds an undocumented API to retrieve this information (akin to the DwmGetColorizationParameters
function, exported by ordinal #127
from DwmApi.dll, which was discovered and documented online some years back).