Keyboard shortcut to alternate between color schemes in iTerm2

iterm2

I am using the Solarized color scheme in iTerm2 and it comes with two themes: one with a light background for daytime hours and one with a dark background for nighttime hours.

I am currently switching between them by going to the iTerm2 preferences, clicking Profiles, then Colors, and finally selecting the theme from the Load Presets menu.

My question is: is there a way to bind this to a keyboard shortcut?

Best Answer

This works on iTerm2 (version, 3.0.8 through 3.0.13)

  1. In iTerm's preferences, select the keys tab.
  2. There's a table called key mappings
    • click on the + at the bottom of the table
  3. Choose a keyboard shortcut
  4. From the dropdown menu, choose the load color preset option
  5. You'll get another dropdown menu to choose the color preset you want

Keys Tab]([https://i.stack.imgur.com/oJ8p1.png)

It works across all panes and windows and its setting is persistent across sessions.

Related Question