|
| 1 | +#!/usr/bin/env sh |
| 2 | +# tinted-shell (https://github.com/tinted-theming/tinted-shell) |
| 3 | +# Scheme name: Mountain |
| 4 | +# Scheme author: Stefan Weigl-Bosker (https://github.com/sweiglbosker), based on Mountain Theme (https://github.com/mountain-theme/Mountain) |
| 5 | +# Template author: Tinted Theming (https://github.com/tinted-theming) |
| 6 | +export BASE24_THEME="mountain" |
| 7 | + |
| 8 | +color00="0f/0f/0f" # Base 00 - Black |
| 9 | +color01="ac/8a/8c" # Base 08 - Red |
| 10 | +color02="8a/ac/8b" # Base 0B - Green |
| 11 | +color03="ac/a9/8a" # Base 0A - Yellow |
| 12 | +color04="8f/8a/ac" # Base 0D - Blue |
| 13 | +color05="ac/8a/ac" # Base 0E - Magenta |
| 14 | +color06="8a/ab/ac" # Base 0C - Cyan |
| 15 | +color07="e7/e7/e7" # Base 06 - White |
| 16 | +color08="26/26/26" # Base 02 - Bright Black |
| 17 | +color09="c4/9e/a0" # Base 12 - Bright Red |
| 18 | +color10="9e/c4/9f" # Base 14 - Bright Green |
| 19 | +color11="c4/c1/9e" # Base 13 - Bright Yellow |
| 20 | +color12="a3/9e/c4" # Base 16 - Bright Blue |
| 21 | +color13="c4/9e/c4" # Base 17 - Bright Magenta |
| 22 | +color14="9e/c3/c4" # Base 15 - Bright Cyan |
| 23 | +color15="f0/f0/f0" # Base 07 - Bright White |
| 24 | +color16="c6/a6/79" # Base 09 |
| 25 | +color17="ac/8a/8c" # Base 0F |
| 26 | +color18="19/19/19" # Base 01 |
| 27 | +color19="26/26/26" # Base 02 |
| 28 | +color20="4c/4c/4c" # Base 04 |
| 29 | +color21="e7/e7/e7" # Base 06 |
| 30 | +color_foreground="ca/ca/ca" # Base 05 |
| 31 | +color_background="0f/0f/0f" # Base 00 |
| 32 | + |
| 33 | + |
| 34 | +if [ -z "$TTY" ] && ! TTY=$(tty); then |
| 35 | + put_template() { true; } |
| 36 | + put_template_var() { true; } |
| 37 | + put_template_custom() { true; } |
| 38 | +elif [ -n "$TMUX" ] || [ "${TERM%%[-.]*}" = "tmux" ]; then |
| 39 | + # Tell tmux to pass the escape sequences through |
| 40 | + # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) |
| 41 | + put_template() { printf '\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\' "$@" > "$TTY"; } |
| 42 | + put_template_var() { printf '\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\' "$@" > "$TTY"; } |
| 43 | + put_template_custom() { printf '\033Ptmux;\033\033]%s%s\033\033\\\033\\' "$@" > "$TTY"; } |
| 44 | +elif [ "${TERM%%[-.]*}" = "screen" ]; then |
| 45 | + # GNU screen (screen, screen-256color, screen-256color-bce) |
| 46 | + put_template() { printf '\033P\033]4;%d;rgb:%s\007\033\\' "$@" > "$TTY"; } |
| 47 | + put_template_var() { printf '\033P\033]%d;rgb:%s\007\033\\' "$@" > "$TTY"; } |
| 48 | + put_template_custom() { printf '\033P\033]%s%s\007\033\\' "$@" > "$TTY"; } |
| 49 | +elif [ "${TERM%%-*}" = "linux" ]; then |
| 50 | + put_template() { [ "$1" -lt 16 ] && printf "\e]P%x%s" "$1" "$(echo "$2" | sed 's/\///g')" > "$TTY"; } |
| 51 | + put_template_var() { true; } |
| 52 | + put_template_custom() { true; } |
| 53 | +else |
| 54 | + put_template() { printf '\033]4;%d;rgb:%s\033\\' "$@" > "$TTY"; } |
| 55 | + put_template_var() { printf '\033]%d;rgb:%s\033\\' "$@" > "$TTY"; } |
| 56 | + put_template_custom() { printf '\033]%s%s\033\\' "$@" > "$TTY"; } |
| 57 | +fi |
| 58 | + |
| 59 | +# 16 color space |
| 60 | +put_template 0 "$color00" |
| 61 | +put_template 1 "$color01" |
| 62 | +put_template 2 "$color02" |
| 63 | +put_template 3 "$color03" |
| 64 | +put_template 4 "$color04" |
| 65 | +put_template 5 "$color05" |
| 66 | +put_template 6 "$color06" |
| 67 | +put_template 7 "$color07" |
| 68 | +put_template 8 "$color08" |
| 69 | +put_template 9 "$color09" |
| 70 | +put_template 10 "$color10" |
| 71 | +put_template 11 "$color11" |
| 72 | +put_template 12 "$color12" |
| 73 | +put_template 13 "$color13" |
| 74 | +put_template 14 "$color14" |
| 75 | +put_template 15 "$color15" |
| 76 | + |
| 77 | +# foreground / background / cursor color |
| 78 | +if [ -n "$ITERM_SESSION_ID" ]; then |
| 79 | + # iTerm2 proprietary escape codes |
| 80 | + put_template_custom Pg cacaca # foreground |
| 81 | + put_template_custom Ph 0f0f0f # background |
| 82 | + put_template_custom Pi cacaca # bold color |
| 83 | + put_template_custom Pj 262626 # selection color |
| 84 | + put_template_custom Pk cacaca # selected text color |
| 85 | + put_template_custom Pl cacaca # cursor |
| 86 | + put_template_custom Pm 0f0f0f # cursor text |
| 87 | +else |
| 88 | + put_template_var 10 "$color_foreground" |
| 89 | + if [ "$BASE24_SHELL_SET_BACKGROUND" != false ]; then |
| 90 | + put_template_var 11 "$color_background" |
| 91 | + if [ "${TERM%%-*}" = "rxvt" ]; then |
| 92 | + put_template_var 708 "$color_background" # internal border (rxvt) |
| 93 | + fi |
| 94 | + fi |
| 95 | + put_template_custom 12 ";7" # cursor (reverse video) |
| 96 | +fi |
| 97 | + |
| 98 | +# clean up |
| 99 | +unset put_template |
| 100 | +unset put_template_var |
| 101 | +unset put_template_custom |
| 102 | +unset color00 |
| 103 | +unset color01 |
| 104 | +unset color02 |
| 105 | +unset color03 |
| 106 | +unset color04 |
| 107 | +unset color05 |
| 108 | +unset color06 |
| 109 | +unset color07 |
| 110 | +unset color08 |
| 111 | +unset color09 |
| 112 | +unset color10 |
| 113 | +unset color11 |
| 114 | +unset color12 |
| 115 | +unset color13 |
| 116 | +unset color14 |
| 117 | +unset color16 |
| 118 | +unset color17 |
| 119 | +unset color18 |
| 120 | +unset color19 |
| 121 | +unset color20 |
| 122 | +unset color21 |
| 123 | +unset color15 |
| 124 | +unset color_foreground |
| 125 | +unset color_background |
| 126 | + |
| 127 | +# Optionally export variables |
| 128 | +if [ -n "$TINTED_SHELL_ENABLE_BASE24_VARS" ]; then |
| 129 | + export BASE24_COLOR_00_HEX="0f0f0f" |
| 130 | + export BASE24_COLOR_01_HEX="191919" |
| 131 | + export BASE24_COLOR_02_HEX="262626" |
| 132 | + export BASE24_COLOR_03_HEX="393939" |
| 133 | + export BASE24_COLOR_04_HEX="4c4c4c" |
| 134 | + export BASE24_COLOR_05_HEX="cacaca" |
| 135 | + export BASE24_COLOR_06_HEX="e7e7e7" |
| 136 | + export BASE24_COLOR_07_HEX="f0f0f0" |
| 137 | + export BASE24_COLOR_08_HEX="ac8a8c" |
| 138 | + export BASE24_COLOR_09_HEX="c6a679" |
| 139 | + export BASE24_COLOR_0A_HEX="aca98a" |
| 140 | + export BASE24_COLOR_0B_HEX="8aac8b" |
| 141 | + export BASE24_COLOR_0C_HEX="8aabac" |
| 142 | + export BASE24_COLOR_0D_HEX="8f8aac" |
| 143 | + export BASE24_COLOR_0E_HEX="ac8aac" |
| 144 | + export BASE24_COLOR_0F_HEX="ac8a8c" |
| 145 | + export BASE24_COLOR_10_HEX="0d0d0d" |
| 146 | + export BASE24_COLOR_11_HEX="0a0a0a" |
| 147 | + export BASE24_COLOR_12_HEX="c49ea0" |
| 148 | + export BASE24_COLOR_13_HEX="c4c19e" |
| 149 | + export BASE24_COLOR_14_HEX="9ec49f" |
| 150 | + export BASE24_COLOR_15_HEX="9ec3c4" |
| 151 | + export BASE24_COLOR_16_HEX="a39ec4" |
| 152 | + export BASE24_COLOR_17_HEX="c49ec4" |
| 153 | +fi |
0 commit comments