2

I have color config of my shell

PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'

how to use hex color code?

3 Answers 3

2

I do not believe that you can use hex color codes with zsh, or even with any shell. To my knowledge, standard Linux terminals can only display certain pre-defined colors. With that in mind, I doubt that hex color codes have been coded into zsh, or even could be, as that would force your terminal/tty to use non-standard colors, some of which it might not have the capability to use.

2

That's right you can't use hex colors. There are only 8 available colors:

30 - black
31 - red
32 - green
33 - yellow
34 - blue
35 - magenta
36 - cyan
37 - white

however you can change what colors these color names represent in you terminal preferences.

2

The other answers are incorrect. I'm using hex color codes in my zsh prompt. Try this (reference here):

PS1="%B%F{#50F862}%n@%m%f%b:%B%F{#625EF6}%~ %#%f%b "

So far as I can tell, it's not possible to use hex colors in the output, but you can in the prompt. I also haven't been able to get this hex-colored-prompt to work in a screen session, so I probably wouldn't encourage you to do this - but you can do it!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .