Change the background color of command line in zsh when I change the prompt theme

20,605

For example, I changed in ~/.oh-my-zsh/themes/example.zsh-theme file the line:

PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "

with the line:

PROMPT="%{$bg[cyan]%}%{$fg[red]%}%n%{$reset_color%}%{$bg[cyan]%}@%{$fg[red]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%{$bg[cyan]%}%% "

And look what happened:

zsh

So, I suggest you to play in the same manner with which theme do you wish from ~/.oh-my-zsh/themes directory.

Share:
20,605

Related videos on Youtube

Jatin
Author by

Jatin

SOreadytohelp

Updated on September 18, 2022

Comments

  • Jatin
    Jatin over 1 year

    I installed the zsh package.

    Also, I downloaded the oh-my-zsh framework to customize zsh. When I change theme name in .zshrc file to one of the themes given here, it changes the color/type of prompt among other things but the background color stays the same. I want the background color to change to the ones given on that theme wiki page.

    So, how do I do change the background color automatically to the ones on that page whenever I change my theme?

  • thom_nic
    thom_nic over 7 years
    Note unless you set RPROMPT='%{$reset_color%}' any command output to the terminal will also carry that background color. I guess it depends on whether you want all lines to have the same color or if you just want the prompt line to have a different color. (Personally I wanted to keep my terminal's default BG color but change the prompt line.)