├── README.md ├── LICENSE └── functions └── theme_gruvbox.fish /README.md: -------------------------------------------------------------------------------- 1 | # fish-gruvbox 2 | [gruvbox] theme for [fish shell] 3 | 4 | # Install 5 | With [fisherman] 6 | ``` 7 | fisher jomik/fish-gruvbox 8 | ``` 9 | 10 | This will expose the function called `theme_gruvbox`. 11 | It is a simple function that takes two arguments. 12 | The first is the mode, either `light` or `dark`. 13 | The second is the contrast, `soft`, `medium` or `hard`. 14 | The defaults are `light` and `medium`. 15 | 16 | To automatically apply this theme, call `theme_gruvbox` from your `config.fish`. 17 | 18 | [gruvbox]: https://github.com/morhetz/gruvbox 19 | [fish shell]: http://fishshell.com/ 20 | [fisherman]: https://github.com/fisherman/fisherman 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jonas Damtoft 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /functions/theme_gruvbox.fish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fish 2 | function theme_gruvbox --description 'Apply gruvbox theme' 3 | set -l mode 'light' 4 | if test (count $argv) -gt 0 5 | set mode $argv[1] 6 | end 7 | 8 | set -g contrast 'medium' 9 | if test (count $argv) -gt 1 10 | set contrast $argv[2] 11 | end 12 | 13 | switch $contrast 14 | case 'soft' 15 | case 'medium' 16 | case 'hard' 17 | case '*' 18 | set_color $fish_color_error 19 | echo 'Unknown contrast $contrast, choose soft, medium or hard' 20 | set_color $fish_color_normal 21 | return 1 22 | end 23 | 24 | switch $mode 25 | case 'light' 26 | __theme_gruvbox_base 27 | __theme_gruvbox_light 28 | case 'dark' 29 | __theme_gruvbox_base 30 | __theme_gruvbox_dark 31 | case '*' 32 | set_color $fish_color_error 33 | echo 'Unknown mode $mode, choose light or dark' 34 | set_color $fish_color_normal 35 | return 1 36 | end 37 | __theme_gruvbox_palette 38 | return 0 39 | end 40 | 41 | function __theme_gruvbox_base 42 | __printf_color 1 'cc/24/1d' 43 | __printf_color 2 '98/97/1a' 44 | __printf_color 3 'd7/99/21' 45 | __printf_color 4 '45/85/88' 46 | __printf_color 5 'b1/62/86' 47 | __printf_color 6 '68/9d/6a' 48 | end 49 | 50 | function __theme_gruvbox_light 51 | set -l bg 'fb/f1/c7' 52 | switch $contrast 53 | case "soft" 54 | set bg 'f2/e5/bc' 55 | case "hard" 56 | set bg 'f9/f5/d7' 57 | end 58 | command printf "\033]11;rgb:$bg\007" 59 | 60 | set -l fg '3c/38/36' 61 | command printf "\033]10;rgb:$fg\007" 62 | 63 | __printf_color 0 $bg 64 | __printf_color 7 '7c/6f/64' 65 | __printf_color 8 '92/83/74' 66 | __printf_color 9 '9d/00/06' 67 | __printf_color 10 '79/74/0e' 68 | __printf_color 11 'b5/76/14' 69 | __printf_color 12 '07/66/78' 70 | __printf_color 13 '8f/3f/71' 71 | __printf_color 14 '42/7b/58' 72 | __printf_color 15 $fg 73 | end 74 | 75 | function __theme_gruvbox_dark 76 | set -l bg '28/28/28' 77 | switch $contrast 78 | case "soft" 79 | set bg '32/30/2f' 80 | case "hard" 81 | set bg '1d/20/21' 82 | end 83 | command printf "\033]11;rgb:$bg\007" 84 | 85 | set -l fg 'eb/db/b2' 86 | command printf "\033]10;rgb:$fg\007" 87 | 88 | __printf_color 0 $bg 89 | __printf_color 7 'a8/99/84' 90 | __printf_color 8 '92/83/74' 91 | __printf_color 9 'fb/59/34' 92 | __printf_color 10 'b8/bb/26' 93 | __printf_color 11 'fa/bd/2f' 94 | __printf_color 12 '83/a5/98' 95 | __printf_color 13 'd3/86/9b' 96 | __printf_color 14 '8e/c0/7c' 97 | __printf_color 15 $fg 98 | end 99 | 100 | function __theme_gruvbox_palette 101 | __printf_color 236 '32/30/2f' 102 | __printf_color 234 '1d/20/21' 103 | 104 | __printf_color 235 '28/28/28' 105 | __printf_color 237 '3c/38/36' 106 | __printf_color 239 '50/49/45' 107 | __printf_color 241 '66/5c/54' 108 | __printf_color 243 '7c/6f/64' 109 | 110 | __printf_color 244 '92/83/74' 111 | __printf_color 245 '92/83/74' 112 | 113 | __printf_color 228 'f2/e5/bc' 114 | __printf_color 230 'f9/f5/d7' 115 | 116 | __printf_color 229 'fb/f1/c7' 117 | __printf_color 223 'eb/db/b2' 118 | __printf_color 250 'd5/c4/a1' 119 | __printf_color 248 'bd/ae/93' 120 | __printf_color 246 'a8/99/84' 121 | 122 | __printf_color 167 'fb/49/34' 123 | __printf_color 142 'b8/bb/26' 124 | __printf_color 214 'fa/bd/2f' 125 | __printf_color 109 '83/a5/98' 126 | __printf_color 175 'd3/86/9b' 127 | __printf_color 108 '8e/c0/7c' 128 | __printf_color 208 'fe/80/19' 129 | 130 | __printf_color 88 '9d/00/06' 131 | __printf_color 100 '79/74/0e' 132 | __printf_color 136 'b5/76/14' 133 | __printf_color 24 '07/66/78' 134 | __printf_color 96 '8f/3f/71' 135 | __printf_color 65 '42/7b/58' 136 | __printf_color 130 'af/3a/03' 137 | end 138 | 139 | function __printf_color 140 | command printf "\033]4;$argv[1];rgb:$argv[2]\007" 141 | end 142 | --------------------------------------------------------------------------------