How can I set exceptions to the 'invert' property in css?

314 Views Asked by At

I want to invert colors via the css property 'invert' (for dark mode), but at the same time I want to leave 5 specific color to stay the same, and other 5 specific colors - not to invert, but to transform into specifically set 5 colors. Images are also to be left untouched. What code should be used in this case?

1

There are 1 best solutions below

3
yherbawi On

Sadly you can't do so using invert css property.

invert takes 1 parameter which is the amount of inverse

invert(amount);

you can invert all elements except some specific elements, but you can't specify this by color.

check MDN invert() Specifications