Easiest way to invert colors on Ubuntu 18.04

What's the easiest way to invert colors on Ubuntu 18.04 Bionic Beaver on the display output?


Solution 1:

As DK Bose notes, you could use xcalib -invert -alter, but this will only affect your main monitor if you use more than one. Instead, you could try this program from Zoltan Padrah, which was appears to have been created specifically as a workaround for this problem.

git clone https://github.com/zoltanp/xrandr-invert-colors.git
cd xrandr-invert-colors
 # install dependency libxcb-randr0-dev :
sudo make deps-apt
make
sudo make install

... and run with /usr/local/bin/xrandr-invert-colors.

Note that the sudo make install step is optional; you could just run the xrandr-invert-colors.bin executable directly from the source dir.

Set a keyboard shortcut for this however you like (say, with Settings > Keyboard).

Since this works by adjusting the color output, it can be undone by, e.g., Ubuntu 18's built-in redshift/f.lux analog, which periodically readjusts your colors, so be sure that "Night Light" is disabled in Settings > Display.

Edit: In Ubuntu 19.04 and maybe 20 too, there's a Gnome Shell extension "InvertDE" which is a thin wrapper around xcalib that might be of use. Since I have my own xcalib script at this point, I'm not using it. Additionally, there's the extension "Invert Window Color" that applies to individual windows.

Edit five months later: I've reinstalled to 20.04, and found that @Xaser is indeed right, and xcalib by itself works for me. It might also be that I now have two equal-shape monitors. I'll be using that, or the "InvertDE" extension method for now, as the least custom. But will certainly leave the other stuff here.