True color support with (iTerm2 + tmux + Vim)

The terminal can be an effective workhorse for achieving a job. It is fast and agile and allows you to do get things done that would have taken you much more time than when you are limited to using the graphical user interface alone. The GUI, however, treated us with elegant visuals and a clear design that made working with it a comfortable experience that is easy on the eye. When working a lot in the terminal, one might want to borrow a piece of this visual experience in the form of an attractive true color terminal.

There is, however, some configuring to do to get a true color scheme working on a terminal emulator like iTerm, especially when combined with a terminal multiplexer like tmux.

Example of terminal with True Color color scheme

iTerm2 true color configuration

Open iTerm2 preferences and navigate to Profiles. There, select the appropriate profile or create one.

One might want to open a tmux session automatically, to do so, select in the General tab under Command ‘Login shell’ and enter the ‘Send text at start‘: ‘tmux new’. 

Under the tab Colors, a color preset can be chosen, like Solarized Dark.

Then, under the tab Terminal, make sure that the ‘Report Terminal Type’ is set to xterm-256color’.

iTerm2 Terminal configuration

tmux true color configuration

To help in configuring tmux and setting some appropriate defaults, the tmux plugin manager (tpm) can be used.

If not installed already, clone the manager to the tmux config directory:

Then, append to the .tmux.conf configuration file.

Note that in this case, a plugin for the Solarized theme has been included too. Furthermore, the terminal type configuration makes sure that the appropriate conventions for true color terminals are used. Note that the default terminal type is now ‘screen‘ instead of ‘xterm‘ and the original True Color support terminal type is passed through terminal-overrides.

Load the configuration: type [ctrl]+[b], then

or, restart tmux.

Vim true color configuration

Finally, Vim is to be configured. As with tmux, a plugin manager is preferred. For Vim a whole spectrum of managers is available which allow practically any package to be installed. In this case, Vundle is used.

If not installed already, install Vundle

Then, configure Vim’s ~/.vimrc appropriately. First, the Vundle required part:

Then, append to the list of plugins one to enable sensible defaults

And, optionally, the solarized color scheme.

Now, enable terminalguicolors and add Vim-specific sequences for RGB colors, set the colorscheme:

And finally, append to the end of the .vimrc


Save the file. To load it and install the plugins, execute in Vim: