Bug 1830318 - Remove 256 colors from DIR_COLORS
Summary: Remove 256 colors from DIR_COLORS
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-01 15:19 UTC by Allan Day
Modified: 2020-10-06 13:47 UTC (History)
14 users (show)

Fixed In Version: coreutils-8.32-12.fc34 coreutils-8.32-12.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-08-17 12:18:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Allan Day 2020-05-01 15:19:53 UTC
Description of problem:

The colours used by ls don't follow those defined in the Terminal palette settings. As a result, they sometimes have legibility issues due to low contrast. They are also inconsistent with the colors used throughout the desktop.

This, as I understand it, is because ls is using the 256 color palette, rather than the terminal-provided 16 color palette.

The gnome-terminal developers have actually been working on improving the legibility of the 16 color palette, but these improvements are being ignored by ls.

If you rm /etc/DIR_COLORS.256color, the 16 color palette is used instead of the 256 color palette.

Version-Release number of selected component (if applicable):

8.31-9.fc31 (not really relevant though)

How reproducible:

Every time

Steps to Reproduce:

Run ls in a location that will give you a variety of colors (say, /usr/libexec). 

Actual results:

The colors don't follow those configured in the terminal.

Expected results:

The colours match those configured in the terminal.

Comment 1 Kamil Dudka 2020-05-04 15:00:05 UTC
You do not need to change anything in /etc .  This can be tweaked per user (via dot files in $HOME) or per session (via environment variables).  Moreover it is enabled only if the terminal claims to support 256color sequences.  See the logic in coreutils-colorls.sh:

    https://src.fedoraproject.org/rpms/coreutils/blob/2f7b3e0a/f/coreutils-colorls.sh

The 256color support was introduced upon a user request 12 years ago:

    bug #429121

I do not use it myself and must admit that I do not remember any Fedora users asking about it anytime recently.  So it either works well enough, or it is not widely used any more.

Comment 2 Pádraig Brady 2020-05-04 15:37:53 UTC
I think 256 color is used by default.
I changed Fedora to use 256 color terminals by default years ago:
https://fedoraproject.org/wiki/Features/256_Color_Terminals

I see that central config mechanism was changed a while back:
https://fedoraproject.org/wiki/Changes/Drop_256term.sh

Now it seems left to each terminal to set TERM.
I think since gnome-terminal 3.16 (vte 0.40) it sets TERM=xterm-256color by default,
and I've confirmed my TERM=xterm-256color with gnome-terminal-3.36.1.1-1.fc32.x86_64

Comment 3 Kamil Dudka 2020-05-04 15:54:06 UTC
To be clear, I was speaking about the 256color support in coreutils and the palette specified in /etc/DIR_COLORS.256color .  It is a file maintained downstream-only in Fedora.  As far as I know, there is no equivalent file upstream.  I do not know whether other Linux distros use something similar.  But if they do, we are not synchronizing the palette with them in any way.

Comment 4 Matthias Clasen 2020-08-05 17:32:26 UTC
The concrete request here is to stop that. Don't ship /etc/DIR_COLORS.256color as a downstream, Fedora-only thing.

Comment 5 Kamil Dudka 2020-08-05 21:25:07 UTC
No objections from me.  Dropping it means one less thing to maintain.  On the other hand, Red Hat Bugzilla is not the right place to discuss this.  Please take the discussion to the appropriate channels.  Once I see there is an agreement on this I will be happy to implement the proposed change.

Comment 6 Neal Gompa 2020-08-06 11:02:55 UTC
Why not fix GNOME Terminal to handle 256 colors? Konsole *finally* did this a little while back...

Comment 7 Matthias Clasen 2020-08-06 11:12:31 UTC
(In reply to Kamil Dudka from comment #3)
> To be clear, I was speaking about the 256color support in coreutils and the
> palette specified in /etc/DIR_COLORS.256color .  It is a file maintained
> downstream-only in Fedora.  As far as I know, there is no equivalent file
> upstream.  I do not know whether other Linux distros use something similar. 
> But if they do, we are not synchronizing the palette with them in any way.

What do you think is the right place to discuss a change to the Fedora coreutils package, if not the coreutils bugzilla ?

Comment 8 Matthias Clasen 2020-08-06 11:14:16 UTC
(In reply to Kamil Dudka from comment #5)
> No objections from me.  Dropping it means one less thing to maintain.  On
> the other hand, Red Hat Bugzilla is not the right place to discuss this. 
> Please take the discussion to the appropriate channels.  Once I see there is
> an agreement on this I will be happy to implement the proposed change.

Even if gnome-terminal let you select 256 color palettes, we still want ls to use the palette that the terminal provides, not one that it found somewhere on the filesystem.

Comment 9 Kamil Dudka 2020-08-06 16:22:46 UTC
(In reply to Matthias Clasen from comment #7)
> What do you think is the right place to discuss a change to the Fedora
> coreutils package, if not the coreutils bugzilla ?

You can see that not many people joined the discussion when this feature was initially proposed in bug #429121.  The coreutils bugzilla is a reliable channel to reach downstream maintainers of coreutils, but not so much to reach maintainers of affected packages, or even end users.  Allan has raised the topic on fedora-devel mailing list, which I believe will help us to get some feedback.

Comment 10 Debarshi Ray 2020-08-06 19:03:10 UTC
> Why not fix GNOME Terminal to handle 256 colors?
> Konsole *finally* did this a little while back...

I don't know what you exactly mean by "handle 256 colors". We are talking about terminals, so everything has 4 heads and 3 tails. :)

VTE, which is the terminal emulator used by GNOME Terminal and all GTK-based terminal applications, has supported 256 colour palettes for more than half a decade at least. Since December 2014, it has been setting the TERM environment variable to "xterm-256color" by default:
https://gitlab.gnome.org/GNOME/vte/-/commit/82a8b0697dd948fa488b5a51ee7391deb35d49be

However, supporting 256 colours doesn't mean that it's easy to tweak all of them. Most (all?) terminal colour palettes in the wild only specify a 16 colour palette, and most (all?) terminal emulators set the remaining 240 colours to the exact same values.

This means that, in practice, we can only change the 16 colour palette. So, if 'ls' is using the 256 colour palette, then we have no way to tweak the remaining 240 colours in the palette.

Hence for the sake of sanity, we want 'ls' to only use the 16 colour palette on Fedora Workstation, because it's something that we can actually tweak and configure.

Comment 11 Allan Day 2020-08-10 08:47:45 UTC
So far, no objections on the fedara-devel thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/SKO7BKFOB2WTIHFQT73A6QSGOCO4R6TZ/

Comment 12 Kamil Dudka 2020-08-17 11:26:17 UTC
dist-git commit: https://src.fedoraproject.org/rpms/coreutils/c/441f1d75

Comment 13 Debarshi Ray 2020-08-17 12:49:14 UTC
Thanks, Kamil!

Comment 14 Allan Day 2020-08-17 13:18:31 UTC
Yes, thank you!

Comment 15 Kamil Dudka 2020-08-17 13:46:39 UTC
No problem.  Thank you for helping me to make the package easier to maintain ;-)

Comment 16 Kamil Dudka 2020-10-02 08:17:23 UTC
The fix for this bug caused unexpected user experience degradation:

    bug #1884264

I have proposed a Fedora 33 Release Note which suggests a solution:

    https://pagure.io/fedora-docs/release-notes/issue/557

Comment 17 Debarshi Ray 2020-10-06 13:47:57 UTC
Thanks for doing that, Kamil!


Note You need to log in before you can comment on or make changes to this bug.