2

I use on-my-zsh, how to change the path color?

enter image description here

here is my config file content in the following

export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="alanpeabody"
plugins=(git)
source $ZSH/oh-my-zsh.sh
jiker
  • 339
  • 1
  • 4
  • 7
  • Maybe you can find the answer [here](https://stackoverflow.com/questions/689765/how-can-i-change-the-color-of-my-prompt-in-zsh-different-from-normal-text) – Adhi Ardiansyah Dec 02 '21 at 02:32
  • 1
    By loading a certain theme, you agree to use that theme's coloring. If you want to have different colors, modify the theme (or make a copy of the theme, and modify the copy). If you are mostly concerned about readability, in your concrete case I would change the background colour of your Terminal to one which goes better with your theme than a black one. – user1934428 Dec 02 '21 at 12:01
  • It's also pretty trivial to create your own oh-my-zsh theme. You can see the source (look in the repository you cloned, or [here on github](https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/alanpeabody.zsh-theme)). If you don't like the blue, you can change it to something else (specifically check line 3). – simont Dec 03 '21 at 12:56

1 Answers1

1

First option: Create a custom theme based on your current theme and change the color of the relevant field

cp ~/.oh-my-zsh/themes/alanpeabody.zsh-theme ~/.oh-my-zsh/themes/alanpeabody-custom.zsh-theme

Change zsh terminal theme to your custom theme - edit ~/.zshrc and change ZSH_THEME="alanpeabody" to

ZSH_THEME="alanpeabody-custom"

Edit ~/.oh-my-zsh/themes/alanpeabody-custom.zsh-theme in order to change the color of the current working directory value, just change the blue value to one of the available color names: black, red, green, yellow, blue, magenta, cyan, white of the line below

local pwd='%{$fg[blue]%}%~%{$reset_color%}'

Second option: Copy ~/.oh-my-zsh/themes/alanpeabody.zsh-theme content to the bottom of your ~/.zshrc and edit the line mention above

Changes takes effect when opening a new terminal session or by running

source ~/.zshrc
Eladio
  • 369
  • 1
  • 5