Skip to content
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

Directory color is too dark on Mac (allow users to define LS_COLORS) #1539

Closed
danilcha opened this issue Feb 1, 2018 · 8 comments
Closed

Comments

@danilcha
Copy link

danilcha commented Feb 1, 2018

Prezto is hardwired to use dark blue for directory color both for ls and for completion on Mac, which is barely visible on black terminal.

I can override LSCOLORS (for ls) by executing this after I load Prezto:

export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd" # ls colors like in Linux

It makes directory color light blue, and in general I like Linux colors better, e.g. green executables.

Unfortunately, I cannot do the same for LS_COLORS (for completion): redefining them before or after I load Prezto has no effect, probably because they are already copied to zstyle ':completion:*' list-colors.

You probably will not change your default colors to Linux, but maybe you could use the existing value of LS_COLORS if it was defined and not override it?

Update:

Found a way to override them:

export LSCOLORS='ExGxBxDxCxEgEdxbxgxcxd' # ls colors like in Linux
# used https://geoff.greer.fm/lscolors/ to convert them to LS_COLORS:
export LS_COLORS='di=1;34:ln=1;36:so=1;31:pi=1;33:ex=1;32:bd=1;34;46:cd=1;34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43' 
zstyle ':completion:*:default' list-colors "$LS_COLORS"
@danilcha danilcha changed the title Directory color is too dark Mac (allow users to define LS_COLORS) Directory color is too dark on Mac (allow users to define LS_COLORS) Feb 6, 2018
@sunoterra
Copy link

@danilcha

one may also specify custom ls color settings in the ~/.zlogin file. this file is sourced after all others (besides ~/.zlogout of course)

i like to use solarized colors. so, in my ~/.zlogin, i add a line after my pathing housework settings (e.g. see zprofile settings, which i put in ~/.zlogin), similar to one of the following:

eval "$(dircolors ~/.dircolors)" # coreutils
eval "$(gdircolors ~/.dircolors)" # macos with gnu coreutils

where ~/.dircolors contains a choice of color spec

sourcing these environment settings for non-login/interactive shells can be done from ~/.zshenv. choosing this route means one has to remember to update the example loading provided to look for and load ~/.zlogin instead of ~/.zprofile

@belak
Copy link
Collaborator

belak commented Feb 14, 2018

I've got an initial PR out which should allow users to set dircolors manually if they really want to. I'm not sure if I'm happy with the code, but it should work.

@sunoterra
Copy link

@belak that #1546 PR is an excellent start, for sures. i updated my setup to use the standard ~/.dir_colors named file instead of the ~/.dircolors file i was using.

this is my current colors config:

if [ ls --color -d . >/dev/null 2>&1 ]
then
  eval "$(gdircolors ${HOME}/.dir_colors)"
  zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
else
  LSCOLORS="gxfxbEaEBxxEhEhBaDaCaD"
  export LSCOLORS
  zstyle ':completion:*:default' list-colors ${(s.:.)LSCOLORS}
fi

do you think that compensation will have to be made for gnu coreutils built on macos via homebrew and/or macports? i.e. using gdircolors instead of dircolors.

@belak
Copy link
Collaborator

belak commented Feb 16, 2018

We traditionally haven't included support for gnu coreutils on osx, but it would be nice to see changes which add it.

@vinamelody
Copy link

Hi, I agree with @danilcha and recently started using this on catalina.
What is the updated way to do this on the latest version? Thanks in advanced

@belak
Copy link
Collaborator

belak commented Jun 14, 2020

If you set LSCOLORS (or LS_COLORS depending on the platform) before loading prezto in your zshrc, the settings should be respected.

@vinamelody
Copy link

thanks @belak for the tips ... i decided to go with replacing iTerm's blue color instead :)

@geonnave
Copy link

Adjusting the Minimum Contrast within Preferences ... -> Profiles -> Colors to the value 60 can also be a solution for this -- see https://stackoverflow.com/a/37822585.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants