Skip to content

Instantly share code, notes, and snippets.

@pengwynn
Created April 27, 2017 22:55
Show Gist options
  • Save pengwynn/5fb99f1a1c6a1112ef4b4fdaa35831d0 to your computer and use it in GitHub Desktop.
Save pengwynn/5fb99f1a1c6a1112ef4b4fdaa35831d0 to your computer and use it in GitHub Desktop.
#!/bin/sh
# base16-shell (https://github.com/chriskempson/base16-shell)
# Base16 Shell template by Chris Kempson (http://chriskempson.com)
# Nova scheme by Trevor Miller (https://trevordmiller.com)
# This script doesn't support linux console (use 'vconsole' template instead)
if [ "${TERM%%-*}" = 'linux' ]; then
return 2>/dev/null || exit 0
fi
color00="44/56/60" # Base 00 - Black
color01="DF/8C/8C" # Base 08 - Red
color02="A8/CE/93" # Base 0B - Green
color03="DA/DA/93" # Base 0A - Yellow
color04="83/AF/E5" # Base 0D - Blue
color05="9A/93/E1" # Base 0E - Magenta
color06="7F/C1/CA" # Base 0C - Cyan
color07="E6/EE/F3" # Base 05 - White
color08="89/9B/A6" # Base 03 - Bright Black
color09=$color01 # Base 08 - Bright Red
color10=$color02 # Base 0B - Bright Green
color11=$color03 # Base 0A - Bright Yellow
color12=$color04 # Base 0D - Bright Blue
color13=$color05 # Base 0E - Bright Magenta
color14=$color06 # Base 0C - Bright Cyan
color15="E6/EE/F3" # Base 07 - Bright White
color16="F2/C3/8F" # Base 09
color17="D1/8E/C2" # Base 0F
color18="55/68/73" # Base 01
color19="6A/7D/89" # Base 02
color20="C5/D4/DD" # Base 04
color21="E6/EE/F3" # Base 06
color_foreground="E6/EE/F3" # Base 05
color_background="44/56/60" # Base 00
color_cursor="E6/EE/F3" # Base 05
if [ -n "$TMUX" ]; then
# Tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
printf_template='\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\'
printf_template_var='\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\'
printf_template_custom='\033Ptmux;\033\033]%s%s\033\033\\\033\\'
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf_template='\033P\033]4;%d;rgb:%s\033\\'
printf_template_var='\033P\033]%d;rgb:%s\033\\'
printf_template_custom='\033P\033]%s%s\033\\'
else
printf_template='\033]4;%d;rgb:%s\033\\'
printf_template_var='\033]%d;rgb:%s\033\\'
printf_template_custom='\033]%s%s\033\\'
fi
# 16 color space
printf $printf_template 0 $color00
printf $printf_template 1 $color01
printf $printf_template 2 $color02
printf $printf_template 3 $color03
printf $printf_template 4 $color04
printf $printf_template 5 $color05
printf $printf_template 6 $color06
printf $printf_template 7 $color07
printf $printf_template 8 $color08
printf $printf_template 9 $color09
printf $printf_template 10 $color10
printf $printf_template 11 $color11
printf $printf_template 12 $color12
printf $printf_template 13 $color13
printf $printf_template 14 $color14
printf $printf_template 15 $color15
# 256 color space
printf $printf_template 16 $color16
printf $printf_template 17 $color17
printf $printf_template 18 $color18
printf $printf_template 19 $color19
printf $printf_template 20 $color20
printf $printf_template 21 $color21
# foreground / background / cursor color
if [ -n "$ITERM_SESSION_ID" ]; then
# iTerm2 proprietary escape codes
printf $printf_template_custom Pg E6EEF3 # forground
printf $printf_template_custom Ph 445660 # background
printf $printf_template_custom Pi E6EEF3 # bold color
printf $printf_template_custom Pj 6A7D89 # selection color
printf $printf_template_custom Pk E6EEF3 # selected text color
printf $printf_template_custom Pl E6EEF3 # cursor
printf $printf_template_custom Pm 445660 # cursor text
else
printf $printf_template_var 10 $color_foreground
if [ "$BASE16_SHELL_SET_BACKGROUND" != false ]; then
printf $printf_template_var 11 $color_background
if [ "${TERM%%-*}" = "rxvt" ]; then
printf $printf_template_var 708 $color_background # internal border (rxvt)
fi
fi
printf $printf_template_custom 12 ";7" # cursor (reverse video)
fi
# clean up
unset printf_template
unset printf_template_var
unset color00
unset color01
unset color02
unset color03
unset color04
unset color05
unset color06
unset color07
unset color08
unset color09
unset color10
unset color11
unset color12
unset color13
unset color14
unset color15
unset color16
unset color17
unset color18
unset color19
unset color20
unset color21
unset color_foreground
unset color_background
unset color_cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment