Terminal displays would usually allow an effect called Reverse Video, or Inverted Video etc. Using ANSI escapes this is SGR 7
. This effect swaps the foreground and background colours. (Wikipedia describes Reverse Video as performing a ones' complement on the brightness, which is not how I have seen it implemented. Maybe that was for older monochrome displays?)
Is there a way this effect can be implemented in CSS, such that it could be applied using a single class, without manually tracking the foreground and background colours of everything being output?
These do not do the effect I'm asking about:
filter: invert()
: swaps colours by hue, turning a blue background into a yellow background etc.mix-blend-mode: difference;
: uses the background colour to calculate new colours, but again doesn't actually swap them. I couldn't see any othermix-blend-mode
modes that do it either.
Is there some way to dynamically look up the foreground and set the background to it and vice versa within CSS, or is this just something that's impossible without some JS?