I wanted to make custom colors for the ls command with zsh, but I find that all the previous answers to this do not work for me.

I tried all these options:

Option 1)

#export LS_COLORS
#zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

Option 2)

#export LS_COLORS
#zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

Option 3)

#zstyle ':completiom:*' list-colors 'di=1:fi=96:*.m=31:*.py=32:*.txt=36:*.out=35'

Option 4)

#zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'

but all result of the ls command are displayed as if no color option was turned on.

The only thing that seems to work to change the colors at all is this:

export CLICOLOR=1

which I found from another answer somewhere that I can't find. However, what I want is to use my own custom colors indicated by:



  • For completness I also saw someone suggest to use gls but I had issues brew installing it so I gave up on that. Sorry can't find the link to that anymore.

Cross posted:

  • 1
    If you actually mentioned that you were using MacOS, answerers would not be off on wild goose chases with the Z shell, but would no doubt be providing short and to the point explanations of why a variable named LS_COLORS has no effect with BSD ls. They might even have pointed you in the direction of unix.stackexchange.com/a/137340/5132 where someone with a familiar name worked out the right variable names to use. (-: – JdeBP Nov 14 '19 at 16:48

You might be missing zsh/complist module. Try zmodload zsh/complist.

Besides, if you want to have the ls colored output – which isn't something directly related to Zsh – then you should do: eval $(dircolors -b …path to the custom dircolors definitions…). Or use Zplugin and do:

zplugin wait"0c" lucid \
 atload'zstyle ":completion:*" list-colors "${(s.:.)LS_COLORS}";' for \

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.