Are your eyes getting tired of reading black text on a white background? Particularly if you read in a dark room? (Now a previous post describes how Evince, a freedom-respecting alternative to Adobe’s bloated PDF reader, can do this automatically with PDF files.)
To have your screen invert colors, all it requires is a one-line script once you download one small package! ). [I can only affirm this is so for those using Debian-based GNU/Linux distros (such as Ubuntu, Linux Mint, etc.).]
It can be done by opening your terminal and typing
xcalib -invert -alter
xcalib -i -a
Your computer may not have the xcalib package installed, and you may be prompted to install it with this code:
sudo apt-get install xcalib
[If you are curious, “sudo” invokes root/superuser/admin privileges, so you will need to use the root password. “apt-get” invokes the package installer that links to Ubuntu software repositories (so you can download it via the internet).]
Then, when it’s all done, try it out. Unfortunately, I cannot get a screenshot of this, as the screenshot does not take into account the inverted colors. Still, it worked for me and should work for you, too! Enjoy!
[UPDATE: For keyboard shortcuts, see below!]
[Author’s note: for more computer tips related to Ubuntu and other Debian-based GNU/Linux distros, check out my Computer Tips category on the right. See, for example, this post on PDF annotation and this post on how to convert JPEG files to PDF and vice versa.]
[Credit goes to the programmers, first, and secondly to the (anonymous) person who shared this information here. If you went to the site I linked, the “#!/bin/bash” should be unnecessary. But if the terminal tells you that your computer does not recognize the commands, try that. Basically, #!/bin/bash tells your computer to use the /bash script language (as opposed to C or other perl). I don’t know too much about it, but I think the default is /sh (shell) and is probably compatible already.]
Keyboard Shortcuts: If you want to assign a keyboard shortcut to invert screen colors, go to where you have Keyboard Shortcuts. Under Cinnamon, for example, you have to go to Keyboards first and then when it opens up, go to the Shortcuts tab and then go to Custom Shortcuts. Add a new shortcut (with the “+” button). The command should be “xcalib -i -a” or “/usr/bin/xcalib -i -a” (“/usr/bin” is where your computer stores your terminal commands in your file system).
Then assign a shortcut (click on “New Accelerator…”). One example is Ctrl+Alt+N (for negative). You can also use Ctrl+Alt+I (for invert). If the shortcut doesn’t work at first, you may have to log out or restart before your computer picks it up.”In Cinnamon, you may be able to get away with refreshing your computer by tying “Alt+F2” and then typing “r” for reset.
Setting Up An Alias (not as efficient as a keyboard shortcut): If you want to set up a permanent alias (textual shortcut), like use “neg” (short for negative) to invert screen colors, first open up the local document that loads instructions for your terminal. To do so, do
sudo gedit ~/.bashrc
sudo nano ~/.bashrc
If you don’t have “gedit” as your text editor, you probably have “pluma” instead (Linux Mint). So replace “gedit” with “pluma.” Otherwise, install “gedit” with “sudo apt-get install gedit.” (UPDATE 2013 Sept 16: “nano” also works well as an in-terminal editor . . . I did not even know of nano at the time of writing this post originally. Oh, and if this doesn’t work, type out the full address “sudo nano /home/user/.bashrc”)
Then, in your text editor, type this line of code
alias neg=’xcalib -invert -alter’
on the first line, save, and then exit.
(REVISED 2013 Sept 16): Then, when you return to the terminal, “update” your bash with your new .bashrc “instructions” file by typing
Then close your terminal session (using Ctrl+D or typing “exit”) and start a new one (or type “source ~/.bashrc” in terminal to refresh the terminal instructions). You should now be able to type “neg” instead of “xcalib …” to invert colors (though you can also just press the up arrow in terminal to use a previous terminal input).