I am trying to set a color prompt in ZSH ($TERM=xterm-256color), but it can only get 8 colors out: Only the bright version of the colors. This is only the case for prompt, while the other applications are able to display all the colors.

So, for prompt I get the same colors with:

PROMPT=' %B%F{9}❯%F{11}❯%F{10}❯%f%b '


PROMPT=' %B%F{1}❯%F{3}❯%F{2}❯%f%b '

What I see printed on the screen, contains the correct colors for the first statement, but the wrong ones for the second statement.

What is going wrong between my ZSH and iTerm (5.1.1 and 2.1.4 respectively)?

P.S. So, I found this script and I ran it. All 256 colors print correctly when I try the two print functions (foreground and background). But the prompt issue persists, which means PROMPT=' %B%F{009}❯%F{011}❯%F{010}❯%f%b ' results in the same output as PROMPT=' %B%F{1}❯%F{3}❯%F{2}❯%f%b ' (both output 009, 011 and 010), while printing colors beyond the first 16 results in the desired output. (e.g: PROMPT=' %B%F{160}❯%F{142}❯%F{064}❯%f%b '.

enter image description here


If you remove the bold font face you will see that the colors will go back to normal:

enter image description here

That is because iTerm2 renders bold characters brighter by default. Now, if you switch that option off, you will see that the bold characters will render in the right color as well.

enter image description here

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.