zshprezto

Changing directory color with zsh + Prezto


I am using Prezto + zsh as my shell. I would like to change the color of directories when I ls my directory. For instance, here is what I currently have:

My crappy ls listing

Obviously, this is no fun, as I’m hardly able to read my directories because the blue is so dark. I’d like to change it to white or orange or something lighter.

This dark blue is specific only to directories. Files show up in a nice white text. Where and what settings must I find to change this?


Solution

  • The answer depends on your ls. BSD ls uses the environment variable LSCOLORS; coreutils ls uses LS_COLORS instead. See your man page.

    The utility module of Prezto uses dircolors (if available) to customize the colors of coreutils ls, which also comes with coreutils. So if you have coreutils, then you can use dircolors to provide actually human-readable color definitions. Read the man page of dircolors for details. Prezto reads from $HOME/.dir_colors by default, otherwise it just use the default colors defined by dircolors. You can of course specify other locations by editing on top of Prezto.

    For BSD ls, there's probably no utility comparable to dircolors, so one has to manually define LSCOLORS. See the ENVIRONMENT section of the man page on its format, which should be pretty clear. An example is LSCOLORS='exfxcxdxbxGxDxabagacad', used by Prezto by default. To have it take effect, put it in runcoms, after loading Prezto's utility module.