1

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
  • A "terminal" with a transparent background would be impractical as a hardware device; you are talking about some 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!
    – U. Windl
    Commented Jun 22, 2022 at 7:22

1 Answer 1

0

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 and more are redundant: you're unlikely to use anything but less underneath. The same applies to man (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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .