Skip to content
Dynamically colored windows based on hostname, IP, or SSH configuration
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


painted-iterm allows you to configure the color of your iTerm2 windows based on the hostname, IP, or SSH configuration. This allows you to color code your windows to help prevent errors. It supports 256 colors.


  1. Install Homebrew -- The missing package manager for macOS
  2. Add the "tap":
    brew tap TimidRobot/tap
  3. Install painted-iterm:
    brew install painted-iterm
  4. iTerm2 > Preferences > Appearance: Enable "Show Border around window"

SSH Configuration

The SSH configuration is the easiest way to configure iTerm2 window colors. It is also the only way to do so for appliances that don't have a bash shell. The SSH configuration is most commonly done only locally in ~/.ssh/config.

The following example paints the iTerm2 window color of prod-firewall bright red and paints the iTerm2 window color of dev-server green:

Host prod-firewall
    User admin
    LocalCommand painted-ansi 1

Host dev-server
    User admin
    LocalCommand painted-label DEV

Host *
    PermitLocalCommand yes

The painted-label example requires the .bashrc configuration below (so that the PAINTED_CONFIG varible is available).

.bashrc Configuration

The following .bashrc excerpt configures a traffic light environment scheme used at many shops:

export TERM=xterm-256color

# Label             Match Pattern                               ANSI Color
Laptop              ^lappy$                                     8
Bastions            ^bastion                                    52
Office              ^192\.168\.0\.                              18
DMZ                 ^10\.10\.10\.                               202
PROD                ^10\.10\.20\.                               1
DEV                 ^10\.10\.30\.|^10\.33\.33\.                 28
last_default        .                                           11

The configured .bashrc and must exist on the remote host.

Helper Functions and Scripts

  • painted-ansi: paints window color based on ANSI color code.
  • painted-label: paints window color based on configured label (requires export of PAINTED_CONFIG).
  • painted-rgb: paints window color based on R G B values.
  • painted-colors: shows 256 ANSI color codes.
  • painted-config: shows currently configured paint scheme (outputs formatted PAINTED_CONFIG provided your .bashrc is configured correctly)


screenshot of painted-colors output screenshot of painted-config output




You can’t perform that action at this time.