-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ls: output has no colors on Alacritty #6722
Comments
Sure don't hesitate to submit a pr |
Amazing bug report! That would be a pretty good fix, but I wonder whether we even need that list? Might be interesting to investigate why that list was added. |
Almost the entire content of uucore/src/lib/features/colors.rs seems to derive directly from
I'm unable to write high quality Rust to implement a patch that is more faithful to the GNU implementation based on the above, so in the meantime I'll submit the simple PR I suggested earlier. |
Any value of TERM with glob pattern `alacritty*` will be matched. Fixes uutils#6722
Hi, its the same problem with OS: Void Linux x86_64 The solution should be the same as for |
Hi @lukeflo. I can update my PR for sure. However, I'm going to be pretty busy the next few days, so I can't do it right away. I'll tag you when I'm done so you can check if the fix works for you. |
@BuriedInTheGround Allright, that would be great. No need to hurry GNU coreutils still work fine 😉 |
Environment
alacritty
truecolor
Issue
The
ls
command never shows colored output whenTERM=alacritty
.Below is a screenshot comparing GNU coreutils 9.5 with uutils coreutils 0.0.27, both with option
--color=always
applied. Note how the output of the first is colored, while the latter is not.Screenshot (collapsed to save scroll space)
To further prove the point, here is a comparison of the output (of a slightly different command, to keep it smaller) of the two utilities when passed to
xxd
.Shell output (collapsed to save scroll space)
Moreover, enforcing
TERM=xterm-256color
(or any value likeTERM=xterm*
) shows a colored output, although colors are not the same as those of GNU coreutilsls
. See the screenshot below.Screenshot (collapsed to save scroll space)
Analysis
Premise: I am not very familiar with Rust (not yet, alas).
Looking around for a root cause in the codebase, I've identified that the extract_color function is responsible for getting the value of the
--color
option. The first thing the function does is invoking is_color_compatible_term which looks up if the value of$TERM
is in this list here. The list does not includealacritty
which indeed seems to be the root cause.To make a comparison, I quickly installed and tried also with Kitty. Since Kitty sets
TERM=xterm-kitty
, i.e. axterm*
type of value for$TERM
, the colors do indeed appear (because of this match in the list).Suggested solution
Since Alacritty do support colors (see its terminfo), I think it's totally safe, and desirable, to simply add
alacritty
to the list of compatible terminals. I clearly see that the list is taken directly fromdircolors --print-database
(or equivalent) but I do think it's fine to diverge in a sensible way like this. Actually, I'd suggest includingalacritty*
, instead of simplyalacritty
, so thatalacritty-direct
andalacritty+common
are also supported.If this simple change it's fine, I'll happily do a PR myself. Just let me know.
The text was updated successfully, but these errors were encountered: