Skip to content

Instantly share code, notes, and snippets.

@anthonyclarka2
Created August 8, 2017 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonyclarka2/de498daa23887147404818d89e8ec1f7 to your computer and use it in GitHub Desktop.
Save anthonyclarka2/de498daa23887147404818d89e8ec1f7 to your computer and use it in GitHub Desktop.
Solarized tab colours in iterm2
# Solarized colours
function tab_sol_yellow { set_iterm_title "$1"; tab_color 181 137 0; }
function tab_sol_orange { set_iterm_title "$1"; tab_color 203 75 22; }
function tab_sol_red { set_iterm_title "$1"; tab_color 220 50 47; }
function tab_sol_magenta { set_iterm_title "$1"; tab_color 211 54 130; }
function tab_sol_violet { set_iterm_title "$1"; tab_color 108 113 196; }
function tab_sol_blue { set_iterm_title "$1"; tab_color 38 139 210; }
function tab_sol_cyan { set_iterm_title "$1"; tab_color 42 161 152; }
function tab_sol_green { set_iterm_title "$1"; tab_color 133 153 0; }
# Taken from the ~/.iterm2_colours that can
# be called from one's ~/.bash_profile or similar.
# If you want to use the above functions by themselves rather than
# adding them to ~/.iterm2_colours, then you will need
# the below functions:
# Setting pre-defined tab colors with titles:
# tab_red "Rails Server"
# tab_orange "Rails Console"
# tab_blue "SQL Dev"
# tab_green "Tests"
title_help0()
{
echo "ERROR: No argument provided."
echo "Usage:"
echo " `basename -- $0` \"title\" to provide a new Terminal title."
}
title_help2()
{
echo "ERROR: Too many arguments provided."
echo "Usage:"
echo " `basename -- $0` \"title\" to provide a new Terminal title."
}
function set_iterm_title() {
if [ $# -eq 0 ]
then
title_help0;
elif [ $# -eq 1 ]
then
echo -ne "\033]0;$1\007"
elif [ $# -gt 1 ]
then
title_help2;
fi
}
alias title='set_iterm_title'
function titlepwd() {
set_iterm_title `pwd`
}
function tab_color() {
echo -n -e "\033]6;1;bg;red;brightness;$1\a"
echo -n -e "\033]6;1;bg;green;brightness;$2\a"
echo -n -e "\033]6;1;bg;blue;brightness;$3\a"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment