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.
Install Homebrew — The missing package manager for OS X
Add the "tap":
brew tap TimZehta/tap
brew install painted-iterm
- iTerm2 > Preferences > Appearance: Enable "Show Border around window"
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
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 HostName prod-firewall.example.com User admin LocalCommand painted-ansi 1 Host dev-server HostName dev-server.example.com User admin LocalCommand painted-label DEV Host * PermitLocalCommand yes
painted-label example requires the
.bashrc configuration below (so
PAINTED_CONFIG varible is available).
.bashrc excerpt configures a traffic light environment scheme
used at many shops:
export TERM=xterm-256color # Label Match Pattern ANSI Color export PAINTED_CONFIG=' 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 ' source .painted_iterm_include.sh
.painted_iterm_include.sh must exist on the
Helper Functions and Scripts
- paints window color based on ANSI color code.
- paints window color based on configured label (requires export of
- paints window color based on R G B values.
- shows 256 ANSI color codes.
- shows currently configured paint scheme (outputs formatted
.bashrcis configured correctly)
- Proprietary Escape Codes - Documentation - iTerm2
- 256 Terminal colors and their 24bit equivalent (or similar)
- OS X