GNOME Bugzilla – Bug 321823
Inverted Colors Document View
Last modified: 2011-10-31 07:27:15 UTC
A new document view called "Invert" should be implemented so users can switch from white background to black background for example. use case: John has some black and white pdf documents that he has to read, he thinks it would be easier in the eyes if it had the colors inverted. (black background/white text instead of white background/black text)
I think we should consider this or at least consider using of theme colors.
*** Bug 123493 has been marked as a duplicate of this bug. ***
There is a need for this or something like it sines, there will always be users who will need false colours for accessibility reasons (and sometimes black on white can be harsh on even the best eyes).
I'd like to hear more comments about the a11y desire for this and if it is a needed feature ideas for how this could integrate in a sane way. Adding an 'Invert Colors' item in the menus is not particularly sane from my point of view, nothing to do with wording it properly just that the action is fairly odd.
it doesn't seem especially odd to me. It's quite common to use a laptop as an ebook reader. If you're going to read many pages of pdf, all white with black text, it can be hard on the eyes. Especially in a dim environment.
We can respect some ally gconf key or introduce our own
*** Bug 132183 has been marked as a duplicate of this bug. ***
I am all for this. This is the only thing Evince is missing, from what I can tell. As Maddox once pointed out, "I've chosen a black background for most of my text because it's easier on the eyes than staring at a white screen. Think about it: your monitor is not a piece of paper, no matter how hard you try to make it one. Staring at a white background while you read is like staring at a light bulb (don't believe me? Try turning off the lights next time you use a word processor). Would you stare at a light bulb for hours at a time? Not if you want to keep your vision." Kip
I totally agree. This is the only thing that is missing from evince. I hate having to stare at white backgrounds (aka light bulbs) all day long. This is now possible with Compiz, but it would be much better to have built-in support for color negation to be able to invert only the document, and also for systems where Compiz can not be installed. Kpdf has this feature and it works pretty well.
Evince is simple document viewer that views the documents the way they were intended. Marking WONTFIX for now.
It's an important problem, lets leave it open.
I'm sad to see that this was once marked as WONTFIX. This shouldn't be too hard to do. I wouldn't call this a bug either. More of a feature request. Once I had compiz-fusion installed and used to have the negative plugin (http://wiki.compiz-fusion.org/Plugins/Neg) loaded. I just don't want to install it again, for it has to grab all the screen to do those fancy effects, from which Negative is the only one I'm missing. And used to activate it just for reading PDFs and web pages. I am sure you can resolve the PDF part. For those that, like me, miss this feature, one can use xcalib to invert the whole X screen: xcalib -i -a
Okular has this feature, so does Adobe Reader. They work differently, but are usable. The idea also showed up at Debian and Ubuntu: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=423119 http://brainstorm.ubuntu.com/idea/11322/
Lack of this feature makes this program useless for reading documents.
(In reply to comment #14) > Lack of this feature makes this program useless for reading documents. This comment is not helpful at all. In fact, this attitude is highly annoying. Please keep any discussion constructive. Thanks.
I'm just telling the truth, ment no harm. I can use it to view documents, but I certainly cannot use it to read them. And I see this feature was requested long long time ago, and continues to be requested. So I think it means something. Peace.
As suggested in comment #12, in the mean time this can be used to invert the whole X screen: xcalib -i -a
Same for me, blank bg hurt my eyes when i am im a dark environment. I would love to see this feature added.
Hi, like many others, i can't read black text with a white background, it's just too painful. We need a option to change the background color, so Evince will be perfect! Maybe with a colors box "HSV" (hard to do? i don't know), or the choice between 10 fix colors ( variation of grey), or a empty option where you can put your hex color (i always read with #bfbfbf background). Thx
Agreed, this is a much needed feature for me. I end up using xpdf to use this feature.
Created attachment 139832 [details] Inverted output using CAIRO_OPERATOR_DIFFERENCE Hi, I'm experimenting a little bit about this feature. For the Cairo back end, I think we can use the new operator CAIRO_OPERATOR_DIFFERENCE. This operator is on the trunk version of Cairo, so there is enough time to write this feature before the operator is included in the stable version. I'd like to write a patch for this as soon as possible, though it means after my holidays :)
The version of Cairo that includes this new operator is 1.9.4, though it hasn't be released yet. The stable version of Cairo will be 1.10 and it seems it will be released this year (http://cairographics.org/roadmap/), but there isn't a date.
Just adding to the cc list. I too have been looking for a solution to this problem. It might be an accessibility issue for people with cataracts (before surgery, of course). In a couple of years I'll be able to say which is better for that. :(
Created attachment 141162 [details] [review] hardcode a paper color to PDF page. Here is a simple patch to hardcode a gray background for plain text.
I'm working on the bug #321823. By now I only have some dirty code to invert the output of the PDF cairo-backend. I suppose I have to extent this feature to the other backends. For the interface, I'm thinking about adding the option "Invert" in the View option from the menu and a new toobar button. Another option is to add a background color (some people suggested this and even there is a snippet for this --thanks Bug flys--). I could add this option on the View menu, and entry on gconf or open a different bug for this. Any advise or suggestion for this ?
By now, I don't invert the thumbnails, and I don't think if it is a good or bad to do that :)
(In reply to comment #25) > For the interface, I'm thinking about adding the option "Invert" in the View > option from the menu and a new toobar button. > > Another option is to add a background color (some people suggested this and > even there is a snippet for this --thanks Bug flys--). I could add this option > on the View menu, and entry on gconf or open a different bug for this. > > Any advise or suggestion for this ? Good to hear you're working on this. (I should add that I just switched from xpdf to evince because xpdf got very slow at scrolling. Reverse video is the one feature of xpdf that so far I really miss.) It seems to me that, if the option changes the background, then you need another option to change the foreground. Thus, I favor a simple reversal of black and white. I think that xpdf does not do anything with any other colors. That usually works.
Well, by now I'm for adding the reversed or inverted output to evince. I think this is the feature requested. The result is something like this: http://www.flickr.com/photos/jjmarin/3851821327/ It is posible to change only the background and left the rest unchanged (the effect is like printing on a non-white piece of paper). AFAIK changing the foreground and background is something different. This is like doing a black and white version with these new colors.
I'm working slowly on the patch. By now, I added inverted thumbails as well. http://www.flickr.com/photos/jjmarin/3862408179/ Now, I want to add an menu entry and a new button for the toolbar. Moreover, I have to extent this feature to other backends, apart from the pdf backend I'm working on.
Which name is better for this feature ? Invert Color Reverse Color Invert View Invert Output .... other Which place is better for this option in menu bar Edit (like the rotate options) View
Some progress on the patch: Added a new option on the Edit menu and a button on the toolbar for the new invert colors feature. Some screenshoots: http://www.flickr.com/photos/jjmarin/3905212838/ http://www.flickr.com/photos/jjmarin/3904428569/ Left: - Some cleanup - Fix the invert colors button and option behaviour status after loading - Extent to other backends - Add Cairo version checking - Self-review of code - Maintainers review
Keep up the good work Juanjo. Looking good.
Which backends are supposed to be officially supported ? I'd like to know which backends are supposed to be officially supported for adding the invert colors feature to these ones, at least. The impress seems to be unsupported ...
It depends on what you mean by supported. impress backend is unmaintained, but it's supported.
OK, thank you KaL. Anyway I managed myself to add the invert colors feature to all the backends :) It was pretty easy, but I think there is room for some improvement: I've created two functions for inverting colors: one for GdkPixBuf* and another for cairo_t*. Some backends render the pages converting GdkPixBuf* to cairo_surface_t*, son I can choose to make the inversion of colors before or after the conversion. Because I don't know which function for inverting colors is better, I'd like to measure the calls to this function to choose the best one? I was thinking about using calls to clock() before and after performing the color inversion. Any advice or suggestion about how to do that ?
(In reply to comment #30) > Which name is better for this feature ? > Invert Color > Reverse Color > Invert View > Invert Output > > .... other I'd say "Inverted Colors". > Which place is better for this option in menu bar > Edit (like the rotate options) > View I'd say "View", since "View -> Inverted Colors" exactly describes the propsed feature.
Wouter, thank you for replying. I took a look to the HIG. This is what I've got: The Edit menu contains items relating to editing both the document (clipboard handling, search and replace, and inserting special objects) and the user's preferences.[1] => So then I don't understand why rotate left and right are here (If rotate left/right and the inverted colors feature goes to the View menu, then, it seems overpopulated to me, but does not exceed the limit of 15 items as stated on the HIG) The View menu contains only items that affect the user's view of the current document. Do not place any items on the View menu that affect the the content of the current document. (Exception: View ▸ Reload may change the current contents if, for example, the document is a webpage that has been recently updated on the server). > I'd say "View", since "View -> Inverted Colors" exactly describes the propsed > feature. => So you're right. This feature affect the user's view Label menu items with verbs for commands and adjectives for settings, according to the rules in Section 8.3.2 ― Capitalization. [3] > I'd say "Inverted Colors". I think it is a command, because I guess settings must be on a Preference menu. Then Invert Colors is the one I think it's sensible, Any comment ? [1] http://library.gnome.org/devel/hig-book/stable/menus-standard.html.en [2] http://library.gnome.org/devel/hig-book/stable/menus-types.html.en [3] http://library.gnome.org/devel/hig-book/stable/menus.html.en
(In reply to comment #37) > Wouter, thank you for replying. I took a look to the HIG. This is what I've > got: > > The Edit menu contains items relating to editing both the document (clipboard > handling, search and replace, and inserting special objects) and the user's > preferences.[1] > > => So then I don't understand why rotate left and right are here See bug #320270
(In reply to comment #37) > > I'd say "Inverted Colors". > I think it is a command, because I guess settings must be on a Preference menu. > Then Invert Colors is the one I think it's sensible, Any comment ? I still think it should be "Inverted Colors", since you "View" the document with "Inverted Colors", just like you "View" the document as a "Presentation" or in "Dual" mode. My interpretation of: > The View menu contains only items that affect the user's view of the current > document. Do not place any items on the View menu that affect the the content > of the current document. (Exception: View ▸ Reload may change the current > contents if, for example, the document is a webpage that has been recently > updated on the server). ... is that only "Reload" is a command (and an exception), while neither of the other items in the menu are commands.
(In reply to comment #39) > I still think it should be "Inverted Colors", since you "View" the document > with "Inverted Colors", just like you "View" the document as a "Presentation" > or in "Dual" mode. You must be right, so I'm going to do that :) http://www.flickr.com/photos/jjmarin/3927425784/
Created attachment 145662 [details] [review] Add Inverted Colors features (fixes #321823) This is the patch I'm been working on. There has been a lot of changes on the Evince code since 2.27, so I've had to resolve several conflicts (new model, gvfs metadata, etc). It applies against the current master. It works for me, but I guess that there must errors on the code because I made too much changes on several file that I'm not totally sure. You don't need the latest Cairo to get it working, because there is an alternative way of inverting the colors using pixbuf (See code on ev-document-misc.c). You need some icons that I'll post on another attachments (I don't knoe if it's possible to make a patch with the new icons).
The icon I've choosen for this feature is the stock_filters-invert. This icon is used on the invert option on Gimpo. I'm not quite sure if we must add it on the code, but if so, AFAIK, it must be included here: data/icons/16x16/actions/stock_filters-invert.png data/icons/16x16/actions/stock_filters-invert.png
Created attachment 145671 [details] data/icons/16x16/actions/stock_filters-invert.png
Created attachment 145672 [details] data/icons/24x24/actions/stock_filters-invert.png
Created attachment 145706 [details] [review] Juanjo's patch cleaned up Just a cleaner patch based on Juanjo's. (whitespace, etc) When I get jhbuild on this pc I'll try to build this. I tried to build a package for 2.28 which would allow me to build a package for ubuntu karmic, but i failed miserably :D
Flavio, The patch only applies against the master branch. There are changes beetwen master and gnome-2.28 so this is the reason of the conflicts you've found. This patch is not intended for gnome-2.28 because it has a string to be translated and the translation for gnome-2.28 is frozen for addinf new strings. Anyway, if you really want a patch for gnome-2.28, I can do one for you, though I'm busy these days, so you will have to wait a little.
Following the comments on IRC, This patch inverts the images too. For not inverting the image, I think we need that poppler could return only text or only images. And maybe we need to separate background and foreground images (background should be inverted and the foreground ones shouldn't). The same applies for the other backends, IMHO. This patch basically calls a function to get cairo_surface_t or GdkPixbuf inverted, and we can do that on all the backends. It means two new functions on libdocument/ev-document-misc.c: cairo_surface_t *ev_document_misc_inverted_colors_surface (cairo_t *cr); void ev_document_misc_inverted_colors_pixbuf (GdkPixbuf *pixbuf); The main idea of this patch is make easier the reading of documents on the screen, and it can be considered as an accesibility feature. My comment about working on this for applying ASAP is because this patch is very sensitive to changes because it affects a lot of files: backend/comics/comics-document.c backend/djvu/djvu-document.c backend/dvi/dvi-document.c backend/impress/impress-document.c backend/pdf/ev-poppler.cc backend/pixbuf/pixbuf-document.c backend/ps/ev-spectre.c backend/tiff/tiff-document.c data/evince-toolbar.xml data/evince-ui.xml libdocument/ev-document-misc.c libdocument/ev-document-misc.h libdocument/ev-render-context.c libdocument/ev-render-context.h libview/ev-document-model.c libview/ev-document-model.h libview/ev-jobs.c libview/ev-jobs.h libview/ev-pixbuf-cache.c libview/ev-pixbuf-cache.h libview/ev-stock-icons.c libview/ev-stock-icons.h libview/ev-view-private.h libview/ev-view.c libview/ev-view.h shell/ev-sidebar-thumbnails.c shell/ev-sidebar-thumbnails.h shell/ev-window.c thumbnailer/evince-thumbnailer.c Several changes on the code (new model, gvfs metadata, etc) affected the patch, so I've tried to fix the conflicts the best I can, though I don't feel quite sure about the correctness of all the code. I could try to keep up the patch on sync with master, but if you can take a brief review for giving some direction or to start something new from the scratch it can help a lot ;)
It has now some conflicts with master, I'll fix ASAP
Created attachment 146614 [details] [review] Fix conflict of patch 145662 and some indentation issues.
Created attachment 148204 [details] [review] Add option for displaying with inverted colors. Icon borrowed from GIMP. Fixes bgo #321823 - Removes the inversion of colors from the backends and now it is implemented on ev-jobs.c. - Removes inverted-color information and operations from libdocument/ev-render- context.c/h - Fixes a memory leak Patch created with git-format-patch because the icon files, so please use git-apply for applying it.
Visually, the main diference with the previous version is that the thumbnails are totally inverted, including the frame and shadow. For example: http://www.flickr.com/photos/jjmarin/4115400873/
Review of attachment 148204 [details] [review]: Finally applied to git master with several modifications, thank you very much!
This feature is a good progress indeed , but i would love to have some themes or options other than black and white , something like dark yellow in greyish black . High contrast colors are difficult to read , and both the current options are very high contrast schemes. Some Ipad apps have this feature .
Like someone has posted below how about something like a real ebook look and feel , with some old books colors hardcoded ? I might be interested to work on this , though I am relatively new to programming.