#801654 dircolors: Please support colors on TERM=screen.xterm-256color

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Josh Triplett
Date:
2024-08-22 16:12:02 UTC
Severity:
normal
#801654#3
Date:
2015-10-13 03:11:06 UTC
From:
To:
josh@jet:~$ TERM=screen.xterm-256color dircolors
LS_COLORS='';
export LS_COLORS
josh@jet:~$ TERM=screen dircolors
LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';
export LS_COLORS

screen in current unstable seems to set TERM to screen.xterm-256color if
running in a terminal with TERM=xterm-256color.  (With TERM=xterm,
screen uses TERM=screen, which dircolors supports.)

#801654#8
Date:
2015-10-13 11:48:12 UTC
From:
To:
http://invisible-island.net/ncurses/terminfo.ti.html#tic-screen-256color

I wonder should we add globbing support to TERM entries in dircolors?
I.E. add support for a general entry like:

  TERM *256color*

That would cater for all existing TERMs in Fedora's /etc/DIR_COLORS.256color
for example, and new entries following this common pattern.

Attached is a patch to do that.

#801654#13
Date:
2015-10-13 11:48:12 UTC
From:
To:
http://invisible-island.net/ncurses/terminfo.ti.html#tic-screen-256color

I wonder should we add globbing support to TERM entries in dircolors?
I.E. add support for a general entry like:

  TERM *256color*

That would cater for all existing TERMs in Fedora's /etc/DIR_COLORS.256color
for example, and new entries following this common pattern.

Attached is a patch to do that.

#801654#18
Date:
2015-10-13 14:43:51 UTC
From:
To:
Seems like a reasonable short-term measure, until dircolors can learn to
parse actual terminal definitions to see if they support color (at which
point it can stop maintaining its own list).

- Josh Triplett

#801654#23
Date:
2015-10-13 14:43:51 UTC
From:
To:
Seems like a reasonable short-term measure, until dircolors can learn to
parse actual terminal definitions to see if they support color (at which
point it can stop maintaining its own list).

- Josh Triplett

#801654#28
Date:
2018-01-14 02:14:41 UTC
From:
To:
Hi!
Instead of playing whack-a-mole with TERM strings, what about just assuming
color support?

The last terminal I've seen to not support colors was Windows 98's
telnet.exe, and even that ignored them silently instead of spewing crap.

Thus, it'd be appropriate to assume that an unknown terminal supports at
least 16 color mode.

We're close to be able to assume 256 color, too: even terminals which don't
support that tend to do a reasonable thing and approximate (linux, freebsd,
screen).  But dircolors doesn't yet use 256 color anywhere, so that's moot
for now.


So, please consider either:
* just dropping TERM detection code, or
* make it opt out rather than opt in, by looking for hypothetical TERM=dumb

Your detection code also assumes that vt100 supports color which it does
not.  But hey, any sightings of that TERM string come from misconfigured
getty (still the default?) rather than from actual museal hardware -- which
does ignore unknown but well-formed SGR codes anyway.


Meow!

#801654#33
Date:
2024-08-22 16:01:18 UTC
From:
To:
I encountered this report while checking to see if my issue would be a
potential duplicate. My request is to add 'foot' to the list of
terminals, and I imagine 'alacritty' would also be useful to add.

The OP is approaching 9 years old. I think this is a more maintainable
approach.