I usually set my terminal with transparent background. But, when I need to read a lot of text such as man
, less
, cat
, etc., I want my background color to be solid black. I can change the backgrounds of vim
and w3m
. How to change the backgrounds of $PAGER
, man
, less
, cat
, more
etc.? I'm on Debian-Buster
using zsh
shell with colored-man-page
plugin installed.
1 Answer
That's actually multiple questions, where some have no useful answer:
cat
"could" be wrapped in an alias (capturing some of its uses), to set a particular background color, but whatever it sends to the terminal can change that background.$PAGER
andmore
are redundant: you're unlikely to use anything butless
underneath. The same applies toman
(which uses$PAGER
).- For
less
... the basic problem is that it is designed to color the text on the screen, and is almost completely agnostic regarding the background color.
Referring to
there's some mention of foreground (text) and background color. However, those do not mention that the terminal responds to this (used for resetting the bold attribute):
me sgr0 turn off bold, blink and underline
by resetting colors as well. (It uses the same solution for resetting blink, but you are less likely to find that to be a problem). It does use a different string for resetting underline, so that part of me
's description does not apply.
To make less
use a particular color scheme, you would have to construct environment variables as suggested in this answer, fooling less
into setting the background color when it is turning off bold or blink.
xterm
(software terminal emulator)? Likewise you cannot set the background of a pager; you could set the background color of the terminal (independent from the pager being used). Please edit the question to be more clear!