Is it possible to write a media query or a CSS selector that would only apply when color-scheme
is dark.
:root {
/*Special CSS variable see: https://twitter.com/diegohaz/status/1529543787311144961*/
color-scheme: dark;
}
:root {
--blue-france: #f5f5fe;
}
/* Psudo code, I know it isn't possible to use var in selectors, I just hope there is a way around it in this perticulat usecase. */
:root:where(var(color-scheme)="dark") {
/* Overwrite default value */
--blue-france: #1b1b35;
}
/* Alternative psudo code, it works with prefers-color-scheme but not with color-scheme */
@media screen and (color-scheme: dark) {
:root {
--blue-france: #1b1b35;
}
}
I'm open to alternative solutions as long as it doesn't involve JavaScript or setting attributes on the <head />
or <body />
.