A sub domain of my site uses a cname record to point to a 3rd party resource. Support is limited. The only control I have over that resource is the style. On page load, it pulls in a stylesheet from the root of the main domain. Within that stylesheet, I can @import more stylesheets from my site, but referencing images, fonts etc from my site violates cross-domain policies and they won't load.
I want to implement a dark-mode option for the whole site and include this subdomain with the changes. What's the best way to achieve this?
Can I set a cookie or something that can be read by the CSS somehow?
Do I replace the whole stylesheet file when the user toggles dark-mode, and if so, how do I overcome server and browser caching?
I've even thought of having two different subdomains, but I know that won't work because the stylesheets for both would have to be named the same and located in the same place.
UPDATE: Thanks @Ryuno-Ki for this suggestion.
@media (prefers-color-scheme: dark)
is a good start. It will allow me to determine the user's own system's dark-mode settings and automatically apply CSS based on it. But I also want to provide the user a way to toggle it on the site as well (because). Can I manipulate this property from my main site in some way?