If you add this to the header tab of your theme component
<script type="text/discourse-plugin" version="0.8">
const themeSelector = require('discourse/lib/theme-selector');
const currentThemeId = themeSelector.currentThemeId();
document.body.dataset.themeId = currentThemeId;
</script>
It will add a data-theme-id attribute to the <body> tag which you can use like so
[data-theme-id="1"] {
// light theme CSS
}
[data-theme-id="2"] {
// dark theme CSS
}