My web application has a dark theme and light theme. How should I decide which one should be enabled for first-time visitors?
These days, it's not too hard to detect what the user's already chosen. This takes the burden of deciding off of you, and is likely to make a smoother experience for the user in general. (For example, when I'm using my OS and Creative Cloud apps in dark theme, then open the browser and get a face full of bright light, it's less fun.)
Here's a screenshot of how StackOverflow does it. They have a third option for "system setting", which is chosen by default. This mirrors pretty well the experience of many apps on phones, which were a little ahead of the curve on dark/light themes, I think.
If you must choose one or the other for some reason, I love sibert's suggestion in a comment of using the more accessible one using a measuring tool.