Following a couple of recent postings on pdf-tools, here are a few customisations I've found handy.
For scanned pdfs,
The following sets up a variety of colour-filter modes (good for night-time viewing, or anytime really that you don't want your eyeballs blasted with blazing white light):
This automatically sets pdf-tools to display using the midnight mode amber filter.
You can return to the original/no-filter with "!" (i.e. S-1); set amber filter with "@" (i.e. S-2); set green filter with "#" (i.e. S-3); set the bluish original midnight mode colours with "$" (i.e. S-4). See below for screenshots of these different settings.
You also probably want to set the
For scanned pdfs,
'pdf-view-auto-slice-minor-mode
can be useful to turn on. You might bind it to something like s a
. It auto trims the borders for each page of the pdf as it encounters them.The following sets up a variety of colour-filter modes (good for night-time viewing, or anytime really that you don't want your eyeballs blasted with blazing white light):
;; midnite mode hook
(add-hook 'pdf-view-mode-hook (lambda ()
(pdf-view-midnight-minor-mode))) ; automatically turns on midnight-mode for pdfs
(setq pdf-view-midnight-colors '("#ff9900" . "#0a0a12" )) ; set the amber profile as default (see below)
(defun bms/pdf-no-filter ()
"View pdf without colour filter."
(interactive)
(pdf-view-midnight-minor-mode -1)
)
;; change midnite mode colours functions
(defun bms/pdf-midnite-original ()
"Set pdf-view-midnight-colors to original colours."
(interactive)
(setq pdf-view-midnight-colors '("#839496" . "#002b36" )) ; original values
(pdf-view-midnight-minor-mode)
)
(defun bms/pdf-midnite-amber ()
"Set pdf-view-midnight-colors to amber on dark slate blue."
(interactive)
(setq pdf-view-midnight-colors '("#ff9900" . "#0a0a12" )) ; amber
(pdf-view-midnight-minor-mode)
)
(defun bms/pdf-midnite-green ()
"Set pdf-view-midnight-colors to green on black."
(interactive)
(setq pdf-view-midnight-colors '("#00B800" . "#000000" )) ; green
(pdf-view-midnight-minor-mode)
)
(defun bms/pdf-midnite-colour-schemes ()
"Midnight mode colour schemes bound to keys"
(local-set-key (kbd "!") (quote bms/pdf-no-filter))
(local-set-key (kbd "@") (quote bms/pdf-midnite-amber))
(local-set-key (kbd "#") (quote bms/pdf-midnite-green))
(local-set-key (kbd "$") (quote bms/pdf-midnite-original))
)
(add-hook 'pdf-view-mode-hook 'bms/pdf-midnite-colour-schemes)
This automatically sets pdf-tools to display using the midnight mode amber filter.
You can return to the original/no-filter with "!" (i.e. S-1); set amber filter with "@" (i.e. S-2); set green filter with "#" (i.e. S-3); set the bluish original midnight mode colours with "$" (i.e. S-4). See below for screenshots of these different settings.
You also probably want to set the
pdf-annot-default-markup-annotation-properties
color to "#ff0000", as well as the pdf-annot-default-text-annotation-properties
color to "#ff0000". This is a colour that is actually visible in the midnight-modes. If you go with the default yellow for markup it will not be easily visible in any of these colour-filter modes.