1

I'm trying to use colors in oh-my-zsh themes. It works fine on my home computer (ubuntu), but in a work computer (Scientific Linux i.e. Enterprise linux) the prompt colors are actually spelled out. For example, my prompt using the blinks theme looks like this (note this ISN'T the code, this is what appears as my prompt, except for my username and computername which I've replaced).

{black}{green}USRENAME{blue}@{cyan}COMPUTERNAME{green}
{yellow}{black}~{green} {black}{blue}±{black} %                       
!{cyan}1128

To see what the blinks prompt should look like, you can look at the oh-my-zsh themes page.

1

Most likely the version of zsh you are using is from before the %F color escape sequence was added. This means that, in addition to not coloring the prompt correctly, it will leave the arguments to this sequence lying around. To solve this you should replace the current theme file with this:

function _prompt_char() {
  if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
    echo "±%{%b%}"
  else
    echo ' '
  fi
}

ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%b%B%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" *%{%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

PROMPT='%{%b%}
%{%B%}%n%{%B%}@%{%B%}%m%{%B%} %{%b%}%~%{%B%}$(git_prompt_info)%E%{%b%}
%{%}$(_prompt_char)%{%} %#%{%b%} '

RPROMPT='!%{%B%}%!%{%b%}'
  • This works, thanks! However, the prompt is still (essentially) monochrome. Different shades of blue/gray. Is there a way to get the nice contrasting yellow colors in the original Blinks theme? – Caleb Aug 11 '12 at 14:17

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.