Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to customise the colours #30

Open
T04435 opened this issue Feb 13, 2017 · 9 comments · May be fixed by #64
Open

I want to customise the colours #30

T04435 opened this issue Feb 13, 2017 · 9 comments · May be fixed by #64

Comments

@T04435
Copy link

T04435 commented Feb 13, 2017

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

@sevaho
Copy link

sevaho commented Feb 20, 2017

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-
Copy link

Billy- commented Jan 23, 2018

Would it be possible to do something like this?

Billy- added a commit to Billy-/agnoster-zsh-theme that referenced this issue Jan 23, 2018
This is basically porting [this PR](ohmyzsh/ohmyzsh#3434) over to this repo. Would fix agnoster#30.
@Billy- Billy- linked a pull request Jan 23, 2018 that will close this issue
@Billy-
Copy link

Billy- commented Jan 23, 2018

@mkamayd
Copy link

mkamayd commented Oct 1, 2018

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
Copy link

jacobgershon commented Feb 15, 2019

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 prompt_context 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
Copy link
Collaborator

apjanke commented Jan 3, 2020

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
Copy link

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

@lestofante
Copy link

lestofante commented Feb 4, 2022

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants