New feature request: Dark theme / Night mode


#1

Hi,
It would be great to have a “Night Mode” option available on top of any PDF doc, somewhere.
I believe that most people knew/saw similar feature in many other applications. Essentially the “Night Mode” switches a) background to dark color (very dark or even black), and b) font color to light color (grey 10%, white could be too bright).
This option is valid for 1) people who read a lot and 2) during presentation (the “.” view option works somehow odd or does not work for me).
I have not found such option in Sumatra PDF, i hope i did not miss anything.

Best Regards, Andrzej.


Thanks and feedback suggestions
#2

There are a number of previous discussions on the “old forum” see

http://forums.fofou.org/sumatrapdf/topic?id=3185334&comments=2

http://forums.fofou.org/sumatrapdf/topic?id=3185272&comments=1

http://forums.fofou.org/sumatrapdf/topic?id=3185219&comments=2


#3

Thank you for hints.
But these are kind of work-arounds.
I am voting here for a regular option.

BR. /A.


#4

I add to this request. It’s a shame that this reader doesn’t have such option.


#5

I concur! It would be most helpful :slight_smile:


#6

The best way to achieve a night mode would be to put in some preset colors for multiple themes. Common ones would be light (which is current standard), dark (which inverts colors), and an intermediate gray theme (ex. TextColor = #ffffff , BackgroundColor = #6e6e6e). This is just an opinion. An additional option would be to add a Custom where the user could input the hex values for desired colors. If someone were to put in bad color values so that nothing was visible, then they could reinstall or alter the Advanced Settings file.


#7

I’ve been using Sumatra for some years and am overjoyed at the speed and simplicity…Love IT :smile:

I would like to request what I think would be a simple feature. I would like to have two sets of colors in the advanced settings file. Which is current would be selectable by some menu or keyboard combination.

This would allow me to have a dark theme for easy on the eyes reading. And a “normal” theme for magazines etc.

Thanks
JohnRob


#8

@JohnRob
you can change SumatraPDF behaviour as you wish by having two shortcuts e.g. if you have one like the following
“C:\Program Files\SumatraPDF\SumatraPDF.exe” -set-color-range #000000 #f000f0
you can change colour drastically like this, NOTE that #F000F0 (they are zeros) = no green

or use another shortcut to drag files to that has a milder grey (RRGGBB are all equal)
“C:\Program Files\SumatraPDF\SumatraPDF.exe” -set-color-range #000000 #F0F0F0

Resist increasing the left hand values to more than the right since you will get an inverted colour effect (see how the heading colour is reversed from blue to orange)


#9

@GitHubRulesOK

Thank you for linking me to the older thread. I had looked back some posts and could not find a similar one. Apparently I did not look far enough.

And thanks for the suggestion, I’ll give it a try but I’m not sure it will be much better than just editing the settings file as I open pdf’s 99% of the time by double clicking them.

John


#10

@JohnRob
Actually back link was thanks to SumatraPeter

For your needs a similar issue was discussed on GitHub where I suggested running Find and replace text which should work in the background as you browse
see https://github.com/sumatrapdfreader/sumatrapdf/issues/1027

If you want to access internally from SumatraPDF menu you could add the two alternating values as Open in Dark Theme and Open in Light Theme like this

In this case you will need slight changes to the files, first find where your settings file is, portable users will usually keep it in the app folder, however most installations will keep it in the users AppData\Roaming folder like this

Place a copy of FART.EXE from https://emtunc.org/blog/03/2011/farting-the-easy-way-find-and-replace-text/
(note I have already done that in the picture above. Then in that folder make two files by cut and paste the following with notepad

@%~dp0fart.exe -i -q %~dp0SumatraPDF-settings.txt "BackgroundColor = #F8F0F8" "BackgroundColor = #F0F0C0"
@copy %~dp0SumatraPDF-settings.txt %~dp0SumatraPDF-settings.tmp
@copy %~dp0SumatraPDF-settings.tmp %~dp0SumatraPDF-settings.txt

NOTE that is THREE lines where the first line does all the work, just make sure the #values are not the same. save the first file as say DARK.CMD (actually it is sort of a parchment colour). The extra two copy lines may seem daft however although the one line works when called from outside SumatraPDF (as it sees an external change), we will be using them from inside and SumatraPDF does not see a change at that time however we need to trigger it as if it changed the settings file. NOTE only time will tell if this is a problem later.

for LIGHT.CMD we just need to reverse the two values and save it so it looks like this

@%~dp0fart.exe -i -q %~dp0SumatraPDF-settings.txt "BackgroundColor = #F0F0C0" "BackgroundColor = #F8F0F8"
@copy %~dp0SumatraPDF-settings.txt %~dp0SumatraPDF-settings.tmp
@copy %~dp0SumatraPDF-settings.tmp %~dp0SumatraPDF-settings.txt

It is important we use the same alternating value so it acts as a simple switch (you can change them but always change them in pairs and see later that the .TXT file has either one to start) OK now for the fun bit in SumatraPDF-settings.txt ensure you have

UseSysColors = false

Otherwise the system themes will override our custom settings then under FixedPageUI

change the background value to EITHER of the ones we are currently using for example
BackgroundColor = #F8F0F8

now find the ExternalViewers section and change it with the correct location above to look something like this

ExternalViewers [
	[
		CommandLine = "C:\Users\**_your name_**\AppData\Roaming\SumatraPDF\dark.cmd"
		Name = Dark Theme
		Filter = *.*
	]
	[
		CommandLine = "C:\Users\**_your name_**\AppData\Roaming\SumatraPDF\light.cmd"
		Name = Light Theme
		Filter = *.*
	]
]

If your really adventurous you can add other lines to each theme.CMD to change the
MainWindowBackground = #80fff280
TextColor = #000000
avoid changing it too much unless you want an inverted theme, also if you are using the pre-release you could change the GradientColors margin to suit like this

Untitled1

OR even flip e-pub user interface from true to false
if it all goes wrong simply delete the SumatraPDF-settings file and next time you will be back to a default setup (without a file history ) I did remind you to make a backup, somewhere else, didn’t I ?


#11

In prelease hex code i see have “darker” word.
Do it have a way to reenable it?


#12

I see nobody has mentioned the -invert-colors switch
just create a new shortcut

and use it when you want to use “dark mode”