The light-dark function allows you to either pick the left color if the current theme of the element is light, or the right color if the current theme of the element is dark.
With the existing CSS, there is no alternative for this on the browsers that do not support this yet, so we need to do a fallback
for an okayish output. (just falling back to always using the white theme)
Note that both of those solutions do not work with changing the theme by adding color-scheme: dark or color-scheme: light on the current element. This is not something that would be possible to add using an autoprefixer, so it is out of scope for this project.
The light-dark function is fully supported under Firefox
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark
The
light-dark
function allows you to either pick the left color if the current theme of the element is light, or the right color if the current theme of the element is dark.With the existing CSS, there is no alternative for this on the browsers that do not support this yet, so we need to do a fallback
Having the following input css:
I would expect the following output:
for a goodish output, (instead of checking the elements theme, it checks the browser theme) or
for an okayish output. (just falling back to always using the white theme)
Note that both of those solutions do not work with changing the theme by adding
color-scheme: dark
orcolor-scheme: light
on the current element. This is not something that would be possible to add using an autoprefixer, so it is out of scope for this project.The
light-dark
function is fully supported under Firefox