BOOL WINAPI SetWindowCompositionAttribute ( HWND hwnd, WINCOMPATTRDATA* pAttrData );
WCA_USEDARKMODECOLORS = 26
DWMAPI DwmSetWindowAttribute( HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute );
DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19(for Windows 10 versions before 2004) or
DWMWA_USE_IMMERSIVE_DARK_MODE = 20(for Windows 10 versions 2004 and later)
There are also the functions
AllowDarkModeForWindow(uxtheme.dll, #133) and
I have written a small tool that lets me enable or disable dark mode for (almost) any open window, which let me take screenshots of how WinSCP would look with a dark title bar (please see attached screenshots).
I hope that this is enough information to get you started and I look forward to hopefully seeing this feature implemented in the future!