Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I’d love to know this as well :) – mikl Apr 22 '12 at 20:21
As a hack you could write an apple script and bind it to a key in iterm. In general I think if they're just those 2 you could define different profiles and just redefine one of the shortcut keys in iTerm to switch to that (you can use any menu item). – ranman Aug 16 '12 at 6:42
@ranman As far as I can tell, selecting a different profile from the menu item creates a new shell using that profile; it doesn't change the color scheme on your existing shells. Am I missing something? – toasterlovin Aug 16 '12 at 17:16

Note: This is not a complete solution, since it isn't entirely keyboard based, but it's the fastest method I have found to switch between color schemes. Hopefully others find it useful.

  1. Create a profile for each color scheme you want to use (iTerm -> Preferences -> Profiles)
  2. Switch between profiles in your current session (Command-I or View -> Edit Current Session)

One keyboard chord and one mouse click.

share|improve this answer

I found another solution from this site:

Declare a function in your .bashrc or .zshrc: it2prof() { echo -e "\033]50;SetProfile=$1\a" }

Then you can switch profile from CLI with it2prof ProfileName

share|improve this answer
Just realize that the article is based from this stackoverflow post: – ejel Jul 31 '15 at 6:52

Here's what I'm doing to solve this issue. This won't be a good solution if you don't use tmux or screen because it involves quitting and relaunching iTerm. In Preferences -> General there is a checkbox for "Load preferences from a custom folder or URL." Check that box and save your settings (make a copy of ~/.iterm). Then change to the other color scheme and save again. Then I made a script that toggles between the two. If you're using tmux, iTerm quitting and reopening is totally inconsequential so it works for me.

pkill iTerm
sleep 0.2
rm -r ~/.iterm

if [[ -z $SOLARIZED_TOGGLE ]]; then

if [ $SOLARIZED_TOGGLE = "1" ]; then
    cp -rf ~/.iterm_dark ~/.iterm
    cp -rf ~/.iterm_light ~/.iterm

env -i open -a iTerm
share|improve this answer

I found an apple script that toggle between solarized themes in this repository. I modified the script Toggle Solarized.applescript a bit to make it work on iTerm 2.9 and put it in an executable script for easy theme switching.

It's not perfect though because it doesn't modify your profile (after looking in the iTerm2 dictionary, you apparently can't do that with apple script). So the next time you open a tab, it won't keep the same color. But it does help.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .