ShellColors is an Oh My Zsh plugin that changes the terminal background color based on the presence of a .shellcolor
file in the current directory. This can help visually distinguish different projects or directories.
-
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
shellcolors
to the list of plugins in your.zshrc
file:plugins=(... shellcolors)
-
Reload your Zsh configuration or restart your terminal session:
source ~/.zshrc
-
Create a
.shellcolor
file in any directory where you want a custom background color. The file should contain a single line with the color code in the format#RRGGBB
.echo "#1a1a2e" > /path/to/your/project/.shellcolor
-
Navigate to the directory, and the terminal background color will change accordingly. When you navigate out of the directory, the background color will revert to the default color specified in the plugin.
By default, the plugin uses black (#000000
) as the default background color when no .shellcolor
file is found. You can change this default color by setting the DEFAULT_SHELLCOLOR
environment variable in your .zshrc
file.
-
Open your
.zshrc
file:vim ~/.zshrc
-
Add the following line to set your desired default background color:
export DEFAULT_SHELLCOLOR="#yourdefaultcolor"
-
Save the file and reload your Zsh configuration:
source ~/.zshrc
Create a .shellcolor
file in your project directory:
echo "#1a1a2e" > ~/Projects/my-project/.shellcolor
Here are some nice mellow colors to start with:
#1a1a2e <-- Soft Blue background
#1a2e1a <-- Soft Green background
#2e1a1a < -- Soft Red background