caiogondim / bullet-train.zsh

:bullettrain_side: An oh-my-zsh shell theme based on the Powerline Vim plugin
MIT License
2.82k stars 383 forks source link

How to change color of '$' #144

Open bharadwaj-raju opened 8 years ago

bharadwaj-raju commented 8 years ago

How do I change the color of the $ prompt?

I've tried using color escape codes in the BULLETTRAIN_PROMPT_CHAR variable but then the $ becomes invisible.

echoing the same text gives the $ in the proper color.

tunnckoCore commented 8 years ago

:+1: it's not only the color, we can't set anything to BULLETTRAIN_PROMPT_CHAR, i tried to set custom text or another segment, nothing works. It is just just empty when set anything different than $.

bharadwaj-raju commented 8 years ago

@tunnckoCore Strange, custom text works for me:

if [ -n "${BULLETTRAIN_PROMPT_CHAR+1}" ]; then
    BULLETTRAIN_PROMPT_CHAR="λ"
fi

Just near the start.

tunnckoCore commented 8 years ago

Hm. Maybe. I tried with direct assign BULLETTRAIN_PROMPT_CHAR=" foo "

bharadwaj-raju commented 8 years ago

@tunnckoCore Are you setting it in your .zshrc? I suppose you have to set it in ~/.oh-my-zsh/themes/bullet-train.zsh-theme

tunnckoCore commented 8 years ago

@bharadwaj-raju the whole idea for that variables are to control themes out of theme files.

bharadwaj-raju commented 8 years ago

@tunnckoCore Hmm. This seems to do it outside the theme source:

source ~/.path/to/bullet-train.zsh-theme  # do not use the 'plugins' or 'ZSH_THEME' of oh-my-zsh

if [ -n "${BULLETTRAIN_PROMPT_CHAR+1}" ]; then
    BULLETTRAIN_PROMPT_CHAR="λ"
fi
tunnckoCore commented 8 years ago

Don't see sense and value on your example. oh-my-zsh is already loaded the things in anyway.

In anyway, i stopped using ohz and this theme already.

bharadwaj-raju commented 8 years ago

i stopped using ohz

I've switched to prezto and get a fresh set of issues... time to change theme.

luiscobot commented 8 years ago

I am trying to change the prompt, with this code in .zshrc BULLETTRAIN_PROMPT_CHAR="»" but all I have is an invisible prompt what do I am it wrong?

revolter commented 8 years ago

@unluisco, Maybe the terminal app you're using can't render that character properly?

bharadwaj-raju commented 8 years ago

Yes @unluisco, try pasting it into the prompt (or anywhere, say cat) and see if it shows up.

luiscobot commented 8 years ago

now the prompt work fine, thanks

caiogondim commented 8 years ago

Amazing! Can we close the issue?

revolter commented 8 years ago

I've switched to prezto and get a fresh set of issues... time to change theme.

It looks like it's invalid now, as @bharadwaj-raju, the original reporter moved on. And @unluisco's problem was different from this issue.

ChristianVermeulen commented 7 years ago

@unluisco what was your fix? My prompt char is not showing either, not even if I use plain text.....

revolter commented 7 years ago

@ChristianVermeulen, Could you post the part of your .zshrc that fiddles with "Bullet Train"?

stevensonmt commented 7 years ago

@ChristianVermeulen make sure you put the character inside parenthesis and double quotes like so: (">>").

To answer the original question, though. You set the color code with %{FG[color]%} where color is a 3 digit color code (found by running spectrum_ls in zsh terminal). You can also use fg[color] where color is text like "red". Here is mine: BULLETTRAIN_PROMPT_CHAR=("%{$fg[red]%}>>")

dawikur commented 7 years ago

Maybe we should introduce new variable, something like BULLETTRAIN_PROMPT_COLOR ?

jakemayeux commented 7 years ago

My prompt character always renders correctly but I still cannot change the color

Even when I do: BULLETTRAIN_PROMPT_CHAR=("%{$fg[red]%}>>")

The prompt shows as just ">>" but it is still green

revolter commented 7 years ago

Show us your .zshrc

stevensonmt commented 7 years ago

I have to periodically reload .zshrc for some reason for the color to stick. So in the terminal just do . <pathto/.zshrc>