How to conditionally (un)invert colors on inverted websites?

Some web pages tend to use inverted colour schemes, i.e. light text on dark background (or vice versa, if your system theme is “inverted”). Discussions about the pros and cons of this aside, the abrupt change from this to its inverse when switching tabs or windows is rather stressful to the eyes, so how can I automatically re-invert websites using this while preferably retaining as much of the original colours as possible?

The tool NegativeScreen does a pretty decent job at this (especially its “smart inversion”), but it is both triggered manually and applies globally and thus is not helpful on a multi-monitor system where one window is inverted and the other not.

Is there any way to achieve something similar via a conditional userstyle, greasemonkey script or even better an addon, such that only sites with inverted text-to-background colouring are un-inverted?

Ideally, the solution would automatically check a site’s CSS, compare a measure of text and background colour such as lightness and then swap that if adequate.

edit For clarification: I am not asking about simply inverting web page colours, I am asking about how to automatically do this only if the original theme is inverted to start with.

Answer

Attribution
Source : Link , Question Author : Tobias Kienzler , Answer Author : Community

Leave a Comment