For Qt you need to set QT_QPA_PLATFORMTHEME=xdgdesktopportal environment variable, and possibly install additional package depending on a distro.
Originally posted by @equeim in #617
I don't know how this works, but it just simply makes Qt apps follow COSMIC dark/light mode setting. So I wonder would it be better if the COSMIC session set this automatically for us?