Changing directory color with zsh + Prezto

13,073

Solution 1

Yeah, dark blue on black is unreadable.

Find the line in your ~/.bashrc or ~/.zshrc or other profile script that looks like this:

eval $(dircolors)

and change it to this:

eval $(dircolors -p | sed -e 's/DIR 01;34/DIR 01;36/' | dircolors /dev/stdin)

That changes blue ("01;34") to cyan ("01;36")

Alternatively, edit your terminal program's colour scheme and change the Dark Blue to a more readable colour.

Solution 2

I was able to fix this on my Mac OS X El Capitan by installing gnu coreutils

Install Homebrew

Then install coretuils

brew install coreutils

Then set PATH in your ~/.zshrc

export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
Share:
13,073

Related videos on Youtube

Cole Bittel
Author by

Cole Bittel

DevOps

Updated on September 18, 2022

Comments

  • Cole Bittel
    Cole Bittel over 1 year

    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?


    Attempted solutions:

    I tried adding

    eval $(dircolors -p | sed -e 's/DIR 01;34/DIR 01;36/' | dircolors /dev/stdin)
    

    to my zshrc, but am getting this error now when loading my prompts:

    Blockquote

    • Admin
      Admin over 8 years
      Is this on a Mac? Macs don't have GNU coreutils, so don't have /usr/bin/dircolors. See unix.stackexchange.com/questions/91937/…
    • Admin
      Admin over 8 years
      It is on a Mac, yes. I'm running El Capitan also. So your solution won't work for me, will it?
    • Admin
      Admin over 8 years
      not unless you install GNU coreutils. The link i posted has more info on setting ls colours on a Mac as well as info on installing coreutils.
  • Cole Bittel
    Cole Bittel over 8 years
    I don't have this line in my ~/.zshrc file. I would definitely mark this answer correct if you could illustrate further how to find this line.
  • Alessio
    Alessio over 8 years
    According to the zsh man page, zsh uses ~/.zshenv, ~/.zprofile, ~/.zshrc, ~/.zlogin and ~/.zlogout. System-wide zsh settings are in /etc/zsh/zshenv, /etc/zsh/zprofile, /etc/zsh/zshrc, /etc/zsh/zlogin, and /etc/zsh/zlogout. The zlogout files wont be setting dircolors, but any of the others might.
  • Alessio
    Alessio over 8 years
    It doesn't really matter which of those set it. If you add the eval $(dircolors -p | sed ... line to the end of ~/.zshrc it will override any earlier definition.
  • Cole Bittel
    Cole Bittel over 8 years
    I attempted this solution, but ran into an error. I've edited my question to reflect this attempt.
  • anh_ng8
    anh_ng8 almost 8 years
    Agreed. When Dark Blue is not readable, simply edit the terminal program to change it to a more readable color.
  • Alessio
    Alessio almost 8 years
    @anh_ng8 that works (which is why i mentioned it in my last paragraph above), but is a pain if you use multiple terminals on multiple systems - you have to change the config for all of them in tedious point-and-click dialog boxes (it's what i used to do before i got annoyed enough by it to read the dircolors man page and figure out how to fix it in my .bashrc). It's easier to just not let dircolors use dark-blue on black.