How do I change the color of the "~" characters that go along the edge of a Less command output.
And how to change the color "(END)" at the bottom?
LESS uses several environment variables to control colors based on termcap library. The list of variable is the following:
export LESS_TERMCAP_mb=$'\E[6m' # begin blinking export LESS_TERMCAP_md=$'\E[34m' # begin bold export LESS_TERMCAP_us=$'\E[4;32m' # begin underline export LESS_TERMCAP_so=$'\E[1;33;41m' # begin standout-mode - info box export LESS_TERMCAP_me=$'\E[0m' # end mode export LESS_TERMCAP_ue=$'\E[0m' # end underline export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
If you want to set different foreground color just change 3x to something else To change background change or add 4x, eg. to change color of "~" (tilde character) from your question to red foreground and green background set
With those variables you will colorize search patterns, prompt, and even manuals will be colorful (if you use less as PAGER).
You can also change other less behavior like prompt, try this one:
export LESS='-iR -j4 --shift 5 -P ?n?f%f .?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t'
Play with it, have fun.
Due to some bug in new groff version you may need to set
as well to change colors.
Note 2 (List of basic color codes)
Foreground: 30 - black 31 - red 32 - green 33 - yellow 34 - blue 35 - magenta 36 - cyan 37 - white Background: 40 - black 41 - red 42 - green 43 - yellow 44 - blue 45 - magenta 46 - cyan 47 - white More about color codes: http://en.wikipedia.org/wiki/ANSI_escape_code
less does not provide fine-tuning on the features which it displays, preferring to use video attributes such as bold and reverse (or standout):
~ character is printed with bold attribute, and only if the "twiddle" option is set ("Show tildes after end of file").
while you could modify the terminal capabilities used to draw bold text, the "END" is bracketed by standout/standend terminal capabilities.
For both of these,
less uses the same terminal capabilities for other reasons, e.g.,
bold is used when
less sees that a character overstrikes a cell containing the same character, e.g., AbackspaceA.
standout is used to highlight error messages.
That said, you can change the appearance of bold text by setting these two environment variables with suitable terminal escape sequences:
The terminfo(5) manual gives a clue what "md" and "me" mean, listing the termcap name in the third column:
enter_bold_mode bold md turn on bold (extra bright) mode exit_attribute_mode sgr0 me turn off all attributes
Likewise, standout and standend are
corresponding to this description:
enter_standout_mode smso so begin standout mode exit_standout_mode rmso se exit standout mode