Couldn't we enable 256 colors by default on TERM?

Marc Deop i Argemí marc at marcdeop.com
Thu May 31 10:09:43 UTC 2012


On Thursday 31 May 2012 02:20:26 Pádraig Brady wrote:
> On 05/30/2012 04:16 PM, Marc Deop wrote:
> > On Wednesday 30 May 2012 10:04:49 Pádraig Brady wrote:
> >> I've some notes about 256 colors here:
> >> http://www.pixelbeat.org/docs/terminal_colours/#256
> >>
> > 
> > That information is mostly fine. There are some errors though (you say you set your TERM variable in your .bashrc...)
> 
> Yes. If you follow the link to my .bashrc it further clarifies that
> to handle all cases, the variable should be set earlier in ~/.profile
> or system wide in /etc/profile.d/...
> 

Still wrong in my opinion. This should be set by your terminal emulator (be it konsole, gnome-terminal or whatever) and not in your personal environment. You would end up having to check for *a lot* of things

> >> If you restrict yourself to local xterms
> >> (of most varieties) you're fine.
> >>
> > 
> > Nowadays you'll be fine almost everywhere. Your system should not set the TERM variable to "xterm" or whatever if you are in a virtual terminal (that would happen if you set your TERM variable in your .bashrc for example...)
> 
> Well that also happens if set in /etc/profile etc.
> What you need to do I think is guard like:
> 
> $ cat /etc/profile.d/256color.sh
> [ "$TERM" = 'xterm' ] && TERM=xterm-256color; export TERM

What happens with "urxvt" or "eterm" terminals?

As said above, .profile or .bashrc or whatever is not a good place to set this things

> 
> > 
> >> However...
> >>
> >> 256 color doesn't work correctly on Linux virtual consoles.
> >>
> > 
> > Totally true
> 
> Handled with the conditional above

That works for VT that use xterm as TERM environment but... what of other ones?

> 
> >> Also since your $TERM is propagated to remote systems
> >> when you ssh, if they don't support that you'll have issues.
> >> For example sshing to debian systems (I've not tried newer releases)
> >> will be problematic unless a package in installed there.
> >> Also if I ssh to solaris then I need to reset TERM to "xterm"
> >> for man pages to work correctly etc.
> > 
> > IMHO this should be the other way around: for old systems where the 256 don't work you should manually set your TERM variable to something that would work and not the other way around
> 
> This could be contentious.
> 
> However I notice (from searching the web) is that Mac OS X
> Terminal's default $TERM value is xterm-256color since Lion 10.7.
> 
> What I'd do (I will do if you prefer) is to propose the feature at:
> https://fedoraproject.org/wiki/Releases/18/FeatureList
> That will both provide a todo list and allow voting on acceptance.
>

That sounds reasonable, +1 for me here! :)
 
> Also in the release notes we should have notes for workarounds
> for older systems where you would have issues.
> I notice ncurses-term is still 'standard' rather than 'required' in debian.
> Perhaps we could log a request for that to change?
> Note that package is 6.6MB installed so maybe the 256 color support
> could be merged back to ncurses-base ?
> 
> I just tried ubuntu 12.04 there and it also doesn't install ncurses-term.
> I did the following to double check:
>   $ TERM=xterm-256colors man ls
>   WARNING: terminal is not fully functional
> 

You made a spelling mistake there, try again without the "s": xterm-256color
 
> There is still further issues to consider locally.
> screen and vim settings would need to be tweaked also as per:
> http://www.robmeerman.co.uk/unix/256colours

Vim would work just not with all the colors. We could set an environment configuration enabling 256 colors by default as well, couldn't we?

As for screen... I don't even remember how to set it, I would need to do some research  on it


Great discussion Pádraig :)

Thanks!


More information about the devel mailing list