Assuming iTerm has a profile named "Evening":
#!/bin/sh echo -e "\033]50;SetProfile=Evening\x7"
Or choose profile via argument:
# profile.sh: #!/bin/bash echo -e "\033]50;SetProfile=$1\x7" ./profile DarkMode
In Vim you can add command to change Vim color scheme and iTerm profile at the same time (assuming iTerm has a profile named "Dark"):
command Dark colorscheme solarized | set background=dark | silent !printf '\e]50;SetProfile=Dark\x7'