Skip to content

Change your terminal background when cd'ing into directories with this zsh plugin.

License

Notifications You must be signed in to change notification settings

SaltedBlowfish/zsh-shellcolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

zsh-shellcolors

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.

2024-06-17 16 18 23

Installation

  1. 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
  2. Add shellcolors to the list of plugins in your .zshrc file:

    plugins=(... shellcolors)
  3. Reload your Zsh configuration or restart your terminal session:

    source ~/.zshrc

Usage

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 random

    This command generates a random low-saturation color, writes it to .shellcolor, and updates the background.

  • Set a specific color:

    shellcolor set #RRGGBB

    Replace #RRGGBB with your desired hexadecimal color code.

  • Unset the custom color:

    shellcolor unset

    This command removes the .shellcolor file and reverts to the default background.

  • Add .shellcolor to .gitignore:

    shellcolor gitignore
  • Reshim (refresh) the background:

    shellcolor reshim

Configuration

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:

  1. Open your .zshrc file:

    vim ~/.zshrc
  2. Add the following line with your desired default color:

    export DEFAULT_SHELLCOLOR="#yourdefaultcolor"
  3. Save the file and reload your Zsh configuration:

    source ~/.zshrc

About

Change your terminal background when cd'ing into directories with this zsh plugin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages