How to change colour scheme between *panes* inside iTerm2 + oh-the-zsh

itermzsh

I have seen a lot of solutions that allow changing of tab colour upon remote accessing into a server (see for example: https://gist.github.com/wadey/1140259 and many more).

What I want is to change the colour of the split pane. The workflow that I normally follow is:

  1. Open iTerm2
  2. Split panes and remote the right half into another server
  3. While keeping the left half on my local machine

I don't have quite the background of bash/zsh, is there a way to achieve this?

Best Answer

The easiest way of doing this is to install the "Shell Integration" tools, using this menu in iTerm:

iTerm2 Menu

Once you've done that you will have access to several iTerm-specific tools, including it2setcolor which lets you easily change the colors.

For example, I use this as part of my ssh alias for connecting to a remote server:

it2setcolor preset 'Solarized Light'

so whenever I ssh somewhere, iTerm automatically changes the 'Theme' to 'Solarized Light'.

(Run it2setcolor with no args to get a usage summary.)