How to make the automatic dark theme the same as the selected dark theme?

Yes the header is indeed set via the custom CSS of each theme. Is there any way to identify that the current color palette is dark or light?

I tried the following:

@media (prefers-color-scheme: dark) {
  .d-header {
    background-image: url(https://imgur.com/LdcvIcp.png); /* Dark background image */
  }
}

But that didn’t work while the dark color palette was active, and just to be sure I tried the same with @media (prefers-color-scheme: light) and it works. So it seems that the dark color palette identifies itself as a light color scheme somehow? Any other way to know that the current color palette is the dark one?

I looked at the HTML and search for “dark” but nothing useful came up. I was hoping there could be a top selector like .is-dark-theme that would tell me that.