tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: colorls in base



On Tue 19 Feb 2019 at 21:49:20 -0500, Thor Lancelot Simon wrote:
> I am *not* opposed to highlighting when ls (or vi, or...) is outputting
> to a terminal.  I *am* opposed to the use of hardwired colors as
> "highlights".  That practice is discriminatory against the color-blind
> and also punishes those who (horrors) have chosen some background color
> for their terminals from personal preference.
> 
> Among the worst offenders in this regard is vim, where on a properly
> color-calibrated monitor with the terminal emulator set to a true
> black background, dark blue is used for syntax highlighting, a blue
> so dark it's basically unreadable.

In Vim's defense, it does try to check the background colour of your
terminal. That is supported in several terminal programs, and certainly
xterm. Unfortunately, the required t_RB setting doesn't always seem to
be found from our termcap/terminfo. Vim also needs to have feature
+termresponse.

This can be fixed with a setting:
    
        set t_RB=^[]11;?^G
	set t_RF=^[]10;?^G

(type the Escape and BEL with a control-V before them)

But more unfortunately, terminal multiplexers such as screen or tmux
don't support it (and logically couldn't, since the backing terminal can
change at any time). 

So for reporting the background color manually, I made a pair of mappings:

	nmap Zl :set bg=light<CR>
	nmap Zd :set bg=dark<CR> 

When Vim knows if you have a dark or light background, it adjusts its
colour scheme. See :help 'bg'

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- "What good is a Ring of Power
\X/ rhialto/at/falu.nl      -- if you're unable...to Speak." - Agent Elrond

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index