Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Light/Dark theme (Day/Night mode)

I concur! It would be most helpful :slight_smile:

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.

2 Likes

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

1 Like

@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)

2 Likes

@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

@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 ?

3 Likes

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

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

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

3 Likes

i know that v.3.2.10638 have dark mode in menu that work good.
I not undstand why is abandoned.

1 Like

The reason it was disabled was: the person who was working on it didn’t complete the work so it wasn’t done and there’s no one to complete the work.

It is a pity that nobody has taken care of it.
I think many users appreciate this feature.
However this function worked very well and could go as it was.

Is it possible to add a dark mode to this Windows software? To change how pages look like, adding a black background and white text? This is already possible in the Kindle app for iOS.

There are no easy to switch predefined settings for dark mode in SumatraPDF. However, you can change settings on your own - just go to Advanced Options in Settings menu and provide new values for TextColor, BackgroundColor and SelectionColor in FixedPageUI and EbookUI sections.

1 Like

Perfect this works well! Thank you Usher

Perfect thank you! This is good enough for me. And quicker

I love this program, and I hate adobe reader. but I spend hrs overnight on the pc so a Night Mode would be very useful for me and many I think.

There is a basic type of “night” mode achieved by using either an old shortcut that includes -invert-colors as shown above by ianas

OR you can change the values manually in the Advanced settings

However beware either way will also invert colours of images so people have blue faces etc.

A formal request has been raised some time ago to improve that odd behavior but no one has found the time to make such a change

Thus it is best to have two startup settings one for night reading just text and another for normal reading with images

@GitHubRulesOK

Thank you that worked for me, using windows 10 64bit.

Can someone point me to the commit which corresponds to this release? I’m not usually a C++ developer but this needs to be done.

That comment was about a very old experimental developer version that if I recollect attempted to modify the shade of tabs to lighter or darker same as UseSysColors it removed much of the user settings and replaced them with 3 options and suffered more problems / created more interface artifact issues than -invert-colours or keeping the advanced user settings.

You could look through the old code in https://github.com/sumatrapdfreader/sumatrapdf/blob/106404f68b2bed7192338304ea038de0042cd8bb/src/Theme.cpp and attempt to add back to a current version to see how it (mis)behaves.
image