agnoster / agnoster-zsh-theme

A ZSH theme designed to disclose information contextually, with a powerline aesthetic
3.95k stars 583 forks source link

I want to customise the colours #30

Open T04435 opened 7 years ago

T04435 commented 7 years ago

COUld you guys please, give a direction on how to change them thanks.

sevaho commented 7 years ago

There are different ways in customizing your colors and depends on what setup you have.

The way I changed colors is I am using termite terminal and here you can specify colors like:

# black
color0  = #303030
color8  = #50524E

# red
color1  = #F34F4F
color9  = #993E3E

and now you can change the colors in your agnoster.zsh-theme file like:

prompt_context() {
  local user=`whoami`

  if [[ "$user" != "root" || -n "$SSH_CONNECTION" ]]; then
    prompt_segment blue white " %(!.%{%F{black}%}.)$user "
  else
    prompt_segment red black " %(!.%{%F{black}%}.) $user "
  fi
}

So red will match with #F34F4F (color1).

Hope this helps a bit.

EDIT:

I just found out that you can use 256 colors, for this your terminal needs to understand 256 colors.

So what you can do is just specify a 256 color in the .zsh-theme file like:

prompt_context() {
  local user=`whoami`

  if [[ "$user" != "root" || -n "$SSH_CONNECTION" ]]; then
    prompt_segment 234 54 " %(!.%{%F{black}%}.)$user "
  else
    prompt_segment 12 65 " %(!.%{%F{black}%}.) $user "
  fi
}
Billy- commented 6 years ago

Would it be possible to do something like this?

Billy- commented 6 years ago
mkamayd commented 5 years ago

Just changing the color value from a color picker (Preference/Profile/Colors) is already working and it is very convenient as it give you real time update.

jacobgershon commented 5 years ago

Maybe you want to cd to the theme folder:

cd ~/.oh-my-zsh/themes 

Then, open file to custom colors:

nano agnoster.zsh-theme

Comment the _promptcontext to make dir become shorter.

## Main prompt
build_prompt() {
  RETVAL=$?
  prompt_status
  prompt_virtualenv
  ## prompt_context
  prompt_dir
  prompt_git
  prompt_bzr
  prompt_hg
  prompt_end
}

At the last, find what you want to change. For example, I'll change background color of dir (from blue to red):

# Dir: current working directory
prompt_dir() {
  prompt_segment red $CURRENT_FG '%~'
}
apjanke commented 4 years ago

Agnoster is designed for use specifically with the "Solarized" color palette, which defines a specific mapping of terminal palette ANSI colors to specific RGB values. And also recommends particular uses for those tones.

I.e., this is how you're supposed to use them:

So, @sevaho and @mkamayd, you're not really supposed to change your terminal color settings like that; you're supposed to set your ANSI Color palette to Solarized and leave it there.

Within that Solarized recommendation, though, there's leeway for which particular content/background/accent colors you're using for what role. And maybe people want to customize that?

What @Billy- links to (the OMZ fork of Agnoster) is a reasonable way to do this, IMHO. It rearranges the roles of the Solarized colors, without changing the mapping of the palette colors to RGB values. This has the advantage that you could change the color role mapping in your ~/.zshrc config file, and then it would work in all terminals that you had configured to use Solarized.

paulschreiber commented 2 years ago

Importing https://github.com/tomislav/osx-terminal.app-colors-solarized made my Terminal much more readable.

lestofante commented 2 years ago

@apjanke AFAIK the solution from @Billy- make possible to have different color based on different user or other conditional, like having a red bad for root. In my case with many ssh machine connected, it helps a lot as color are way more immediate than reading the host name.

Waxoussou commented 1 month ago

Using Ubuntu, set agnoser theme but after setting powerline, i lost color on my prompt : image Does anyone have encounter that issue ?