lsd-rs / lsd

The next gen ls command
Apache License 2.0
13.54k stars 439 forks source link

Missing colors after installing nerd-fonts #365

Closed tnorthcutt closed 3 years ago

tnorthcutt commented 4 years ago

I recently moved to a new machine, and as a result, icons were missing in the output of lsd (instead I saw a [?] icon).

Today I followed the instructions in this comment to install and configure nerd-fonts for iTerm2, which worked. However, now the color output of lsd is gone.

I tried uninstalling and reinstalling lsd (with brew uninstall lsd and brew install lsd), but that did not result in a change.

Current output:

CleanShot 2020-05-04 at 07 03 27@2x


iTerm2 settings:

CleanShot 2020-05-04 at 07 04 08@2x
meain commented 4 years ago

What are the values for $TERM and $LS_COLORS?

tnorthcutt commented 4 years ago

@meain $TERM is xterm-256color; echo $LS_COLORS produces no output

meain commented 4 years ago

Could you check if lsd --color always works?

tnorthcutt commented 4 years ago

@meain lsd --color always results in the same output as a regular ls (which is aliased to lsd): icons and bolding, but no colors.

meain commented 4 years ago

Hey, so far I don't have much of a clue as to what is happening. Could you give a few more details.

tnorthcutt commented 4 years ago

@meain Absolutely! I appreciate your attempts to help 😄

CleanShot 2020-05-07 at 08 15 35@2x
meain commented 4 years ago

I have a feeling that LS_COLORS might be set as blank(just spaces) string or something. Could you try doing unset LS_COLORS and run lsd after that.

If that works, awesome. Else, maybe try setting LS_COLORS to the one below and call lsd. If that works, I guess you can use this is a temporary workaround until we figure what is happening.

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:mi=00: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:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=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:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=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:*.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:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
devanshuDesai commented 4 years ago

Facing the exact same issue on 0.17.0. iTerm2 + Solarized Background + Zsh + Agnoster. For the record, colorls works perfectly fine on this configuration but exa doesn't.

meain commented 4 years ago

@devanshuDesai could you see if my previous comment fixes anything? https://github.com/Peltoche/lsd/issues/365#issuecomment-625297436

devanshuDesai commented 4 years ago

@meain Getting a "not found" error on my source ~/.zshrc when I try setting $LS_COLORS to your string

meain commented 4 years ago

Not sure how you got "not found" error. How are you setting LS_COLORS? Just in case, this is how you would do it. export LS_COLORS='rs=0.....9'

Also, did unset LS_COLORS && lsd work?

devanshuDesai commented 4 years ago

yes, that is exactly how I set it. And no unsetting did not work. EDIT: Never mind. I was accidently setting that value to $ZSH instead of $LS_COLORS. No, this did not resolve the issue

lcosmin commented 4 years ago

Happens here too, no LS_COLORS set. It seems to me that lsd uses a different shade of blue for folders (in my case, see screenshots) than the normal ls, and when switching to the solarized theme, that color gets clobbered.

So, I'd say the issue is a combination between lsd and the solarized theme.

Regular iTerm theme (dark background):

Screenshot 2020-05-11 at 08 23 49

Solarized theme:

Screenshot 2020-05-11 at 08 24 06
mixomat commented 4 years ago

@lcosmin yes, that seems to be the issue, I'm also using the iterm2 solarized dark theme, other themes work just fine

meain commented 4 years ago

The issue is that the default colors we are using is conflicting with the colorschemes you are using. At least in case of solarized it is muting the blue color that we are using for folders.

One thing that you could do is to change the value of dir in LS_COLORS. The default value is as mentioned https://github.com/Peltoche/lsd/issues/365#issuecomment-625297436. You could change the number to the right of di to change what color get applied for directories.

Kastakin commented 4 years ago

I sttumbled here having similar issue on a Linux machine working with zsh + oh-my-zsh:

I solved the issue with: DISABLE_LS_COLORS="true"

in my .zshrc file. It should be a commented line generated automatically during the oh-my-zsh installation process, uncomment it and you will be fine!

devanshuDesai commented 4 years ago

@Kastakin I tried disabling it. No luck.

ericmtzmtz commented 4 years ago

I sttumbled here having similar issue on a Linux machine working with zsh + oh-my-zsh:

I solved the issue with: DISABLE_LS_COLORS="true"

in my .zshrc file. It should be a commented line generated automatically during the oh-my-zsh installation process, uncomment it and you will be fine!

Hi, can you share your conf file? I tried with uncomment but don't work.

yangxyo commented 4 years ago

The issue is that the default colors we are using is conflicting with the colorschemes you are using. At least in case of solarized it is muting the blue color that we are using for folders.

One thing that you could do is to change the value of dir in LS_COLORS. The default value is as mentioned #365 (comment). You could change the number to the right of di to change what color get applied for directories.

I change the di to 4, the folders show blue.

It's none of solarized's business.

image

I try all of them, the results are the same.

Before I add LS_COLORS: image

It's really hard for me to change all of the numbers after rs=0:di=.... I hope this issue could be solved.

yangxyo commented 4 years ago

https://github.com/ogham/exa/issues/116#issue-163981640

With current implementation, we cannot customize directory color scheme of exa. Let's parse $LS_COLORS environment variable (or $LSCOLORS on BSD) and use it in the output.

Reference:

Such as:

export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'

Or

https://github.com/trapd00r/LS_COLORS

I suggest writing something more in README.

meain commented 4 years ago

@yangxyo Selecting a colorscheme does not change the values of LS_COLORS. But there is a default list of values we use for lscolors which might have conflicting colors as solarized might use the same color that we use for folders for the background. I hope this makes things clearer.

Btw, you do not have to change all the values to the right of di. The fist value to the right of di will change the color of directory. Likewise the rest of it only needs to be changed if you have to change the colors of the other items. This is a good intro on LS_COLORS: http://www.bigsoft.co.uk/blog/2008/04/11/configuring-ls_colors.

You can set new LS_COLORS values by doing export LS_COLORS='....' in your bashrc or zshrc.

Also, here is another resource for generating lscolors: https://github.com/sharkdp/vivid

Here is an LS_COLORS value solarized: https://github.com/seebi/dircolors-solarized

SansGuidon commented 4 years ago

I face a similar issue, just after upgrading lsd from 0.16.0 to 0.17.0

meain commented 4 years ago

Related https://github.com/Peltoche/lsd/issues/404

foxale commented 4 years ago

I think there are many people that decided to go for this app not just for the sake of functionality it offers, but also because the coloring presented in the README was so appealing. It looks like the coloring is gone in 0.17.0 and 0.18.0, though.

Would it be possible to recreate the original default coloring as LS_COLORS variable and add to README? Any maybe even throw an explanation here and there for people upgrading from <0.16.0, that in order to have the colors back this and that needs to be manually set.

I guess this would resolve most of the related issues for many.

meain commented 4 years ago

@foxale That would be a good idea. Will add a way to reproduce the old colors using LSCOLORS in the readme.

foxale commented 3 years ago

For those who don't want to wait, here is an approx. of the old theme: LS_COLORS='di=38;5;33:ln=38;5;44:so=38;5;44:pi=38;5;44:bd=38;5;44:or=38;5;124:cd=38;5;172:ex=38;5;40:fi=38;5;184:no=38;5;245'

Preview: image

This is based on src/color.rs/get_light_theme_colour_map(), which was responsible for the default color scheme back in 0.16.0. I don't think it's actually used anywhere now.

There are still some differences between 0.18.0 with this LS_COLORS configuration and 0.16.0, which cannot be configured using LS_COLORS only, but were hardcoded in source code. For example, the permission settings are colored differently.

0.16.0: 0.16.0

0.18.0 with this LS_COLORS configuration: 0.18.0 with LS_COLORS

Couple of thoughts:

  1. All colors could be made configurable; LS_COLORS does not cover them all
  2. All colors not covered by LS_COLORS could default to 0.16.0's style for users convenience
  3. An --old_color_scheme flag that would switch color scheme to already available mapping generated in get_light_theme_colour_map() would be a nice touch
  4. README.md is outdated
zwpaper commented 3 years ago

hi @foxale , thanks so much for the LS_COLORS configuration, this can really be helpful.

as the opinions you mentioned,

  1. the README part, a PR for updating and adding this configuration is always welcome!
  2. the configuration part, I am working on the theme configuration currently, it's functional working, a PR will be fired in days.
robole commented 3 years ago

I encountered this issue today also.

I changed LS_COLORS in my .zshrc as per foxale's comment on 25 Nov 2020, and it fixed the colors for me.

A note in the README would save people a round-trip while issue #448 is in progress. Maybe reference the issue under FAQ/Colors until that's resolved?

meain commented 3 years ago

Resolution: https://github.com/Peltoche/lsd/issues/365#issuecomment-733095300

foxale commented 3 years ago

#365 (comment) provides only a temporary fix that doesn't cover all aspects of the problem. Shall we use separate github issues for the remaining 4 items pointed out in the discussed comment?

meain commented 3 years ago

Most of the color issues will be taken care of once we land https://github.com/Peltoche/lsd/pull/452 . I don't think --old-color-scheme is a good idea, but we can probably add your comment into an FAQ section in the readme.

pabloazurduy commented 2 years ago

hey everyone, quick question, there is no way of using themes in this env macos + iterm + zsh ? I tried with https://github.com/Peltoche/lsd/issues/365#issuecomment-733095300 and solved my problem, however, I would like to know if someone figured out how to use colors.theme from the .config file thanks! :)

my current approach install https://github.com/sharkdp/vivid add the following lines to ~/.zshrc (use the theme that you want from vivid

# color theme ls
# other themes in https://github.com/sharkdp/vivid
export LS_COLORS="$(vivid generate snazzy)"
meain commented 2 years ago

You cannot control the colors of files and folders with the theme, only the other blocks.

pabloazurduy commented 2 years ago

thanks @meain ! I thought that colors.theme changed everything! my bad.

Thanks again!