You should consider shipping a combined css file that uses the prefers-color-scheme media query to show dark or light as appropriate!
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
Build sites to be standards compliant and accessible first, and then progressively enhance them using new browser features to give the user a better experience. It's absolutely the best way to build for the web.