I am using the CSS ::selection construct. Say my text is written in black over a white background, but for some elements that are written in blue, green, or red, for example. I would like this to be selected, the color and background color of the text are exchanged: Plain text hurts white on black, red text is white on red, etc.
Of course, I know how to do this by introducing specific rules for each type of text that I have. But I wonder if there is a simple way to do this automatically, that is, I donβt need to think about all the possible types of texts that I have.
source share