Created
August 1, 2015 17:19
-
-
Save sathishvj/51d9ebf05fb7947351df to your computer and use it in GitHub Desktop.
change profile/colors from the command line on iTerm2 on Mac OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function to change the profile on iTerm2. Finds the first profile that matches the partial string and assigns it. | |
# usage: prof jacki -> will set profile JackieBrown in this example | |
# usage: prof red -> will set profile RedSands in this example | |
function prof() { | |
# you have to add these profiles in your iTerm preferences. Create new profiles with the colors you like and add the profile names to the list here | |
avlblProfiles=( "Default" "Espresso" "Mac OSX Term" "JackieBrown" "Urple" "SeaShells" "RedSands" "Sundried" ) | |
profileName="" | |
for i in "${avlblProfiles[@]}" | |
do | |
#make lower case | |
lowi=`echo "$i" | tr '[:upper:]' '[:lower:]'` | |
low1=`echo "$1" | tr '[:upper:]' '[:lower:]'` | |
if [[ "$lowi" == *"$low1"* ]]; then | |
echo "Matched profile:" "$i" | |
profileName="$i" | |
break | |
fi | |
done | |
if [ -z "$profileName" ]; then | |
echo "Empty profile name match." | |
return | |
fi | |
echo -e "\033]50;SetProfile=$profileName\a" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment