2

As pointed out in Software to read PDFs with inverted colors (Windows), instead of having a very white on very black color scheme (which induces a very nasty contrast) it is often preferable to use a custom color scheme such as light grey on dark grey (which is much nicer on the eyes and reduces eyestrain when reading PDF documents on-screen).

When activating View > Inverted Colors in Evince, the programme will literally invert colors and generate the undesirable very white on very black color scheme. How can I configure Evince to instead replace colors with a light grey on dark grey color scheme?

(I know that Adobe Reader can do this, but I prefer using Evince in day-to-day usage.)

0

Change the background color of evince to the light greed and protect your eyes

Config the compile environment and dowload source

sudo apt source evince

Change the source to your color, such as the light green(R:199,G:237,B:204)

Edit the fuction ev_document_misc_invert_surface in file: libdocument/ev-document-misc.c at line 467

change cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); cairo_set_source_rgb (cr, 1., 1., 1.); to cairo_set_operator (cr, CAIRO_OPERATOR_DARKEN); cairo_set_source_rgb (cr, 0.8, 0.9098, 0.8117647);

Config and make and make install

cd evince ./configure --prefix=$YOUR-PLACE --enable-nls --disable-scrollkeeper --disable-dbus --disable-debug --disable-tests --disable-nautilus --disable-thumbnailer --disable-previewer --disable-comics --without-keyring --without-gconf --without-gtk-unix-print

Then make, and I get the error:

Making all in synctex make[3]: Entering directory '/home/luopeng/Downloads/evince-3.28.4/cut-n-paste/synctex' CC libsynctex_la-synctex_parser.lo CC libsynctex_la-synctex_parser_utils.lo synctex_parser_utils.c:106:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral] result += vfprintf(stderr, reason, arg); ^~~~~~ 1 error generated. Makefile:545: recipe for target 'libsynctex_la-synctex_parser_utils.lo' failed make[3]: *** [libsynctex_la-synctex_parser_utils.lo] Error 1

Of couse, fix it by:

pragma GCC diagnostic push pragma GCC diagnostic ignored "-Wformat-nonliteral" result = fprintf(stderr,"SyncTeX ERROR: "); result += vfprintf(stderr, reason, arg); result += fprintf(stderr,"\n"); pragma GCC diagnostic pop

In the version of ubuntu18.04, I found seveal errors as the above case and I fix them with the GCC ignored. (please add # before the pragma in the following code)

pragma GCC diagnostic push pragma GCC diagnostic ignored "-Wformat-nonliteral" the code where the errors occur pragma GCC diagnostic pop

Then change the config in /usr/share/applications/evince.desktop

chang Exec=$YOUR-Evince-PLACE/bin/evince %U

When click the view->Inverted Color, your background color will change to light green

Enjoy it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.