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

Pádraig Brady P at draigBrady.com
Thu May 31 01:20:26 UTC 2012


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/...

>> 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

> 
>> However...
>>
>> 256 color doesn't work correctly on Linux virtual consoles.
>>
> 
> Totally true

Handled with the conditional above

>> 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.

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

>> So it's one of those borderline things that is unfortunately
>> dependent on the users environment, so I'd be wary about
>> changing this default.
> 
> I see no problem in setting the gnome-terminal (or konsole or whatever) to use 256 by default in a bleeding edge distro like Fedora. Again, we should change this settings when they do not work ;)

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

cheers,
Pádraig.


More information about the devel mailing list