ShellColors is an Oh My Zsh plugin that automatically updates your terminal background color based
on the presence of a .shellcolor file in the current directory or one of its parent directories.
The plugin also provides a command interface to set, unset, and manage the .shellcolor file.
-
Clone the repository into the custom plugins directory of Oh My Zsh:
git clone https://github.com/SaltedBlowfish/zsh-shellcolor.git ~/.oh-my-zsh/custom/plugins/shellcolors -
Add
shellcolorsto the list of plugins in your.zshrcfile:plugins=(... shellcolors)
-
Reload your Zsh configuration or restart your terminal session:
source ~/.zshrc
The plugin automatically updates the terminal background when you change directories. It searches
for a .shellcolor file in the current directory and its parent directories; if none is found, it
uses the default color.
A command interface is provided via the shellcolor command:
-
Set a random color:
shellcolor set randomThis command generates a random low-saturation color, writes it to
.shellcolor, and updates the background. -
Set a specific color:
shellcolor set #RRGGBB
Replace
#RRGGBBwith your desired hexadecimal color code. -
Unset the custom color:
shellcolor unsetThis command removes the
.shellcolorfile and reverts to the default background. -
Add
.shellcolorto .gitignore:shellcolor gitignore
-
Reshim (refresh) the background:
shellcolor reshim
By default, the plugin uses black (#000000) as the default background color if no .shellcolor
file is found. To change this, set the DEFAULT_SHELLCOLOR environment variable in your .zshrc
file:
-
Open your
.zshrcfile:vim ~/.zshrc -
Add the following line with your desired default color:
export DEFAULT_SHELLCOLOR="#yourdefaultcolor"
-
Save the file and reload your Zsh configuration:
source ~/.zshrc
