sumatrapdf icon indicating copy to clipboard operation
sumatrapdf copied to clipboard

Toggle background color

Open Limro opened this issue 11 years ago • 11 comments

Greetings developers.

I know it's possible to set the background and foreground color of the documents, which is very useful, when I don't want to get blinded by the white light of standard PDF files. So I have a (almost) black background color and white foreground text, but this makes many figures and pictures with inverse colors. So I would like to have a toggle function, to switch between defined background and foreground settings.

Limro avatar Jan 30 '15 07:01 Limro

I support this. Could also be possible to give an option to detect images and not apply the inversion to them? And an option to only apply the color changes to black and white content (Foxit does this)?

crisalis avatar Feb 06 '15 20:02 crisalis

Hi, I was looking for option how to change color of background quickly and I have found that Sumatra is open source. I would like to solve this color issue. I'm glad that Sumatra is light-weight but I also think that an user-friendly posibility to switch colors will be well used. (There are more requests for solution of color inversion : http://forums.fofou.org/sumatrapdf/topic?id=3184694&comments=3 , http://forums.fofou.org/sumatrapdf/topic?id=3184675&comments=5 , and this topic )

Could we discuss preferred way how can I implement it? a) I would prefer slider next to Zoom In and Zoom Out button. It would set white background on one side and dark gray on another side. (but this functionality is preferred only by me, maybe). b) Add a button or option into menu. It will switch completely between two color schemes. Both color schemes could be defined by user. c) Add panel for updating color values instead of forcing user to change hexadecimal color codes in text file.

Ofcak

Ofcak avatar Mar 04 '15 22:03 Ofcak

Let's start with a keybinding. Pick some unused keybinding (ctrl-i ?, assuming it's unused). This should bring a window that allows modifying the colors. The changes should be immediately reflected in the ui. ESC should close the window. "Ok" accepts the changed colors. "Cancel" closes the window.

Now, the bigger question is: should this be a global or per-document setting?

kjk avatar Mar 04 '15 23:03 kjk

OK, it would be fine to add a checkbox for selection between global and per-document change application. But actually I'm not sure how difficult it will be in code, because I do not know how program works yet.

I will make that change for global at first as it is now. I will do it in next few weeks, I am little bit busy in these days.

Ofcak avatar Mar 07 '15 18:03 Ofcak

Hi, I'm sorry, I'm not able to do this feature. I don't have experiences with C++ and this is probably too huge project to start with it. I thought that it will be a simple modification, but I can't even find how and where are another windows defined. I asked my friend who works with Qt in C++, but he didn't find it as well. (He was looking for it for about 10 minutes) I thought that I will be able to do it after reading of some tutorial about HWND ... However I realized that modification by total C++ beginner could do more harm than good for Sumatra project.

So I'm sorry and I hope that project development didn't wait for my push.

btw. Can you say me, where the window "Options" is defined?

Ofcak avatar May 10 '15 22:05 Ofcak

No worries.

Settings window is defined in https://github.com/sumatrapdfreader/sumatrapdf/blob/master/src/SumatraPDF.rc#L220 and code for handling it is in https://github.com/sumatrapdfreader/sumatrapdf/blob/master/src/SumatraDialogs.cpp#L691

kjk avatar May 10 '15 22:05 kjk

I found a better solution for Windows. My setup is all black boarders and black start-up screen and total black in full-screen with white text.

Setting/Advanced Options, add line GradientColors to FixedPageUI then choose your hex color. Here is mine setup for all black and white.

MainWindowBackground = #000000
EscToExit = false
ReuseInstance = false
UseSysColors = false
RestoreSession = true

FixedPageUI [
	TextColor = #ffffff
	BackgroundColor = #000000
	SelectionColor = #f5fc0c
	WindowMargin = 2 4 2 4
	PageSpacing = 4 4
	GradientColors = #000000
]

https://i.stack.imgur.com/vMHOQ.png

JJenkx avatar Aug 31 '17 02:08 JJenkx

I made some improvements based on @JJenkx answer.

Text is readable in the startup menu Epub and mobi files are now color inverted too. There is now a color difference between the background an a pdf page.

MainWindowBackground = #333333
EscToExit = false
ReuseInstance = false
UseSysColors = false
RestoreSession = true

FixedPageUI [
	TextColor = #ffffff
	BackgroundColor = #000000
	SelectionColor = #f5fc0c
	WindowMargin = 2 4 2 4
	PageSpacing = 4 4
	GradientColors = #101010
]
EbookUI [
	FontName = Georgia
	FontSize = 12.5
	TextColor = #ffffff
	BackgroundColor = #101010
	UseFixedPageUI = false
]

timostrating avatar Sep 24 '17 14:09 timostrating

I'd like it if this was later upgrade to, while running, switchable themes #743, possibly even per open document, because colour inversion can still be glaring (e.g. White text), so is frankly an inadequate hack. Relying upon monitor display profiles and/or OS pallet colour varying software is also an inadequate hack because this can make some software visual interfaces hard to see.

More natural book, and some other complementary, colours, including window colours outside the book area, can be easier to read. Having to keep hand edit these pallets is pointless drudgery, especially when different documents can need slightly different colour pallets, including for the same file type.

rwperrott avatar Mar 01 '21 00:03 rwperrott

I too appreciate dark mode but have an issue with contrast of selected item in bookmarks as can be seen in:

image

My settings are:

MainWindowBackground = #80fff200
EscToExit = false
ReuseInstance = false
UseSysColors = false
RestoreSession = true
TabWidth = 300

FixedPageUI [
	TextColor = #eeeeee
	BackgroundColor = #303030
	SelectionColor = #f5fc0c
	WindowMargin = 2 4 2 4
	PageSpacing = 4 4
	GradientColors = #303030
]
EbookUI [
	FontName = Georgia
	FontSize = 12.5
	TextColor = #5f4b32
	BackgroundColor = #fbf0d9
	UseFixedPageUI = false
]

are there more TextColor settings that are not yet documented / in my config above?

skewty avatar Jun 16 '21 15:06 skewty

I am closing as in pre-release ShiftI now addresses the OP issue "toggle background color" all secondary issues related to theming and why the white text cant be seen on a white field (or dark on dark) are discussed as other issues.

GitHubRulesOK avatar Jul 17 '21 01:07 GitHubRulesOK