├── README.md ├── autoload └── airline │ └── themes │ └── desertink.vim └── colors └── desertink.vim /README.md: -------------------------------------------------------------------------------- 1 | ## desertink.vim 2 | 3 | This is a version of the default desert colorscheme with a darker background and more colorful foreground colors. 4 | 5 | A theme for [vim-airline](https://github.com/bling/vim-airline) is included as well. 6 | 7 | ##### Screenshot (running in tmux and ROXTerm): 8 | 9 | ![desertink](http://i.imgur.com/MhZ2UFD.png) 10 | 11 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/toupeira/vim-desertink/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 12 | -------------------------------------------------------------------------------- /autoload/airline/themes/desertink.vim: -------------------------------------------------------------------------------- 1 | " Based on powerlinish 2 | " 3 | " Theme to mimic the default colorscheme of powerline 4 | " Not 100% the same so it's powerline... ish. 5 | " 6 | " Differences from default powerline: 7 | " * Paste indicator isn't colored different 8 | " * Far right hand section matches the color of the mode indicator 9 | " 10 | " Differences from other airline themes: 11 | " * No color differences when you're in a modified buffer 12 | " * Visual mode only changes the mode section. Otherwise 13 | " it appears the same as normal mode 14 | 15 | " Normal mode 16 | let s:N1 = [ '#005f00' , '#afd700' , 22 , 148, '' ] 17 | let s:N2 = [ '#bbbbbb' , '#444444' , 250 , 238, '' ] 18 | let s:N3 = [ '#ffffff' , '#303030' , 231 , 235, 'bold' ] 19 | 20 | " Insert mode 21 | let s:I1 = [ '#ffffff' , '#004866' , 231 , 24 ] 22 | let s:I2 = [ '#99DDFF' , '#0087af' , 74 , 31 ] 23 | let s:I3 = [ '#B2E5FF' , '#005f87' , 117 , 24 ] 24 | 25 | " Visual mode 26 | let s:V1 = [ '#080808' , '#ffaf00' , 232 , 214 ] 27 | 28 | " Replace mode 29 | let s:RE = [ '#ffffff' , '#d74444' , 231 , 9 ] 30 | 31 | " Inactive mode 32 | let s:IA1 = [ '#777777' , '#4a4a4a' , 240 , 237 , '' ] 33 | let s:IA2 = [ '#777777' , '#3a3a3a' , 242 , 236 , '' ] 34 | let s:IA3 = [ '#999999' , s:N3[1] , 244 , s:N3[3] , '' ] 35 | 36 | " Tabline 37 | let s:TN = s:N2 " normal buffers 38 | let s:TM = [ '#870000', '#ff8700', 88, 208, 'bold' ] " modified buffers 39 | let s:TMU = [ '#ff8700', '#870000', 208, 88, 'bold' ] " modified unselected buffers 40 | let s:TH = [ s:N1[1], s:N1[0], s:N1[3], s:N1[2] ] " hidden buffers 41 | 42 | let g:airline#themes#desertink#palette = {} 43 | 44 | let g:airline#themes#desertink#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) 45 | let g:airline#themes#desertink#palette.normal_modified = { 46 | \ 'airline_a': s:TM, 47 | \ 'airline_z': s:TM } 48 | 49 | let g:airline#themes#desertink#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:N3) 50 | let g:airline#themes#desertink#palette.insert_replace = { 51 | \ 'airline_a': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ], 52 | \ 'airline_z': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ] } 53 | 54 | let g:airline#themes#desertink#palette.visual = { 55 | \ 'airline_a': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ], 56 | \ 'airline_z': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ] } 57 | 58 | let g:airline#themes#desertink#palette.replace = copy(airline#themes#desertink#palette.normal) 59 | let g:airline#themes#desertink#palette.replace.airline_a = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ] 60 | let g:airline#themes#desertink#palette.replace.airline_z = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ] 61 | 62 | let g:airline#themes#desertink#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) 63 | 64 | let g:airline#themes#desertink#palette.tabline = { 65 | \ 'airline_tab': s:TH, 66 | \ 'airline_tabmod': s:TM, 67 | \ 'airline_tabmod_unsel': s:TMU, 68 | \ 'airline_tabhid': s:TN } 69 | -------------------------------------------------------------------------------- /colors/desertink.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " Name: desertink.vim 4 | " Version: 1.2 5 | " Author: Markus Koller 6 | " 7 | " Note: Only works in GUI and 88/256 color terminals 8 | " 9 | " This is a version of the default desert colorscheme with a 10 | " darker background and more colorful foreground colors. 11 | " 12 | " It also adds highlighting for folds, diffs, line numbers, 13 | " signcolumn, completion menus, and cursor line/column. 14 | 15 | " The colors are automatically converted for 88/256 color terminals, 16 | " adapted from http://www.vim.org/scripts/script.php?script_id=1243 17 | " 18 | " You can find the latest version at https://github.com/toupeira/desertink.vim 19 | " 20 | 21 | set background=dark 22 | if version > 580 23 | " no guarantees for version 5.8 and below, but this makes it stop 24 | " complaining 25 | hi clear 26 | if exists("syntax_on") 27 | syntax reset 28 | endif 29 | endif 30 | let g:colors_name="desertink" 31 | 32 | if has("gui_running") || &t_Co >= 88 33 | " functions {{{ 34 | " returns an approximate grey index for the given grey level 35 | fun! grey_number(x) 36 | if &t_Co == 88 37 | if a:x < 23 38 | return 0 39 | elseif a:x < 69 40 | return 1 41 | elseif a:x < 103 42 | return 2 43 | elseif a:x < 127 44 | return 3 45 | elseif a:x < 150 46 | return 4 47 | elseif a:x < 173 48 | return 5 49 | elseif a:x < 196 50 | return 6 51 | elseif a:x < 219 52 | return 7 53 | elseif a:x < 243 54 | return 8 55 | else 56 | return 9 57 | endif 58 | else 59 | if a:x < 14 60 | return 0 61 | else 62 | let l:n = (a:x - 8) / 10 63 | let l:m = (a:x - 8) % 10 64 | if l:m < 5 65 | return l:n 66 | else 67 | return l:n + 1 68 | endif 69 | endif 70 | endif 71 | endfun 72 | 73 | " returns the actual grey level represented by the grey index 74 | fun! grey_level(n) 75 | if &t_Co == 88 76 | if a:n == 0 77 | return 0 78 | elseif a:n == 1 79 | return 46 80 | elseif a:n == 2 81 | return 92 82 | elseif a:n == 3 83 | return 115 84 | elseif a:n == 4 85 | return 139 86 | elseif a:n == 5 87 | return 162 88 | elseif a:n == 6 89 | return 185 90 | elseif a:n == 7 91 | return 208 92 | elseif a:n == 8 93 | return 231 94 | else 95 | return 255 96 | endif 97 | else 98 | if a:n == 0 99 | return 0 100 | else 101 | return 8 + (a:n * 10) 102 | endif 103 | endif 104 | endfun 105 | 106 | " returns the palette index for the given grey index 107 | fun! grey_color(n) 108 | if &t_Co == 88 109 | if a:n == 0 110 | return 16 111 | elseif a:n == 9 112 | return 79 113 | else 114 | return 79 + a:n 115 | endif 116 | else 117 | if a:n == 0 118 | return 16 119 | elseif a:n == 25 120 | return 231 121 | else 122 | return 231 + a:n 123 | endif 124 | endif 125 | endfun 126 | 127 | " returns an approximate color index for the given color level 128 | fun! rgb_number(x) 129 | if &t_Co == 88 130 | if a:x < 69 131 | return 0 132 | elseif a:x < 172 133 | return 1 134 | elseif a:x < 230 135 | return 2 136 | else 137 | return 3 138 | endif 139 | else 140 | if a:x < 75 141 | return 0 142 | else 143 | let l:n = (a:x - 55) / 40 144 | let l:m = (a:x - 55) % 40 145 | if l:m < 20 146 | return l:n 147 | else 148 | return l:n + 1 149 | endif 150 | endif 151 | endif 152 | endfun 153 | 154 | " returns the actual color level for the given color index 155 | fun! rgb_level(n) 156 | if &t_Co == 88 157 | if a:n == 0 158 | return 0 159 | elseif a:n == 1 160 | return 139 161 | elseif a:n == 2 162 | return 205 163 | else 164 | return 255 165 | endif 166 | else 167 | if a:n == 0 168 | return 0 169 | else 170 | return 55 + (a:n * 40) 171 | endif 172 | endif 173 | endfun 174 | 175 | " returns the palette index for the given R/G/B color indices 176 | fun! rgb_color(x, y, z) 177 | if &t_Co == 88 178 | return 16 + (a:x * 16) + (a:y * 4) + a:z 179 | else 180 | return 16 + (a:x * 36) + (a:y * 6) + a:z 181 | endif 182 | endfun 183 | 184 | " returns the palette index to approximate the given R/G/B color levels 185 | fun! color(r, g, b) 186 | " get the closest grey 187 | let l:gx = grey_number(a:r) 188 | let l:gy = grey_number(a:g) 189 | let l:gz = grey_number(a:b) 190 | 191 | " get the closest color 192 | let l:x = rgb_number(a:r) 193 | let l:y = rgb_number(a:g) 194 | let l:z = rgb_number(a:b) 195 | 196 | if l:gx == l:gy && l:gy == l:gz 197 | " there are two possibilities 198 | let l:dgr = grey_level(l:gx) - a:r 199 | let l:dgg = grey_level(l:gy) - a:g 200 | let l:dgb = grey_level(l:gz) - a:b 201 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) 202 | let l:dr = rgb_level(l:gx) - a:r 203 | let l:dg = rgb_level(l:gy) - a:g 204 | let l:db = rgb_level(l:gz) - a:b 205 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) 206 | if l:dgrey < l:drgb 207 | " use the grey 208 | return grey_color(l:gx) 209 | else 210 | " use the color 211 | return rgb_color(l:x, l:y, l:z) 212 | endif 213 | else 214 | " only one possibility 215 | return rgb_color(l:x, l:y, l:z) 216 | endif 217 | endfun 218 | 219 | " returns the palette index to approximate the 'rrggbb' hex string 220 | fun! rgb(rgb) 221 | if a:rgb == "ffffff" 222 | return 15 223 | endif 224 | 225 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 226 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 227 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 228 | 229 | return color(l:r, l:g, l:b) 230 | endfun 231 | 232 | " sets the highlighting for the given group, add optional fg, bg and attr 233 | " values to override the terminal settings 234 | if has('gui_running') || (has('termguicolors') && &termguicolors) 235 | fun! X(group, fg, bg, attr, ...) 236 | if a:fg != "" 237 | exec "hi " . a:group . " guifg=#" . a:fg 238 | endif 239 | if a:bg != "" 240 | exec "hi " . a:group . " guibg=#" . a:bg 241 | endif 242 | if a:attr != "" 243 | exec "hi " . a:group . " gui=" . a:attr 244 | endif 245 | endfun 246 | else 247 | fun! X(group, fg, bg, attr, ...) 248 | let l:ctermfg = (a:0 > 0 && a:1 != "") ? a:1 : rgb(a:fg) 249 | let l:ctermbg = (a:0 > 1 && a:2 != "") ? a:2 : rgb(a:bg) 250 | let l:ctermattr = (a:0 > 2 && a:3 != "") ? a:3 : a:attr 251 | 252 | if a:fg != "" 253 | exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . l:ctermfg 254 | endif 255 | if a:bg != "" 256 | exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . l:ctermbg 257 | endif 258 | if a:attr != "" 259 | exec "hi " . a:group . " gui=" . a:attr 260 | endif 261 | if l:ctermattr != "" 262 | exec "hi " . a:group . " cterm=" . l:ctermattr 263 | endif 264 | endfun 265 | endif 266 | " }}} 267 | 268 | call X("Normal", "ffffff", "121212", "", "", "233") 269 | call X("NonText", "addbe7", "262626", "bold", "", "235") 270 | 271 | highlight! link TabLineFill Normal 272 | 273 | " highlight groups 274 | "CursorIM 275 | "Directory 276 | "WildMenu 277 | "Menu 278 | "Scrollbar 279 | "Tooltip 280 | 281 | call X("Cursor", "708090", "f0e68c", "") 282 | 283 | " setting a background color for the cursor line can hide 284 | " other background colors such as Error and ErrorMsg 285 | call X("CursorLine", "", "1a1a1a", "", "", "235", "none") 286 | call X("CursorColumn", "", "1a1a1a", "", "", "235") 287 | 288 | " use only bold for the cursorline to avoid covering the background 289 | "highlight clear CursorLine 290 | "highlight clear CursorColumn 291 | "highlight CursorLine cterm=bold gui=bold 292 | "highlight CursorColumn cterm=bold gui=bold 293 | 294 | call X("ColorColumn", "", "222222", "", "") 295 | 296 | call X("StatusLine", "262626", "ffffff", "reverse", "", "", "reverse") 297 | call X("StatusLineNC", "262626", "808080", "reverse", "") 298 | 299 | call X("Question", "00ff7f", "", "bold") 300 | call X("Error", "ffffff", "913d3b", "bold") 301 | call X("ErrorMsg", "ffffff", "913d3b", "bold") 302 | call X("ModeMsg", "daa520", "", "") 303 | call X("MoreMsg", "00ff7f", "", "bold") 304 | call X("Ignore", "666666", "", "") 305 | call X("Todo", "f9f747", "d75f00", "bold") 306 | call X("SpellBad", "", "913d3b", "") 307 | 308 | "call X("VertSplit", "c2bfa5", "7f7f7f", "reverse") 309 | highlight! link VertSplit LineNr 310 | 311 | call X("LineNr", "3e3e3e", "080808", "", "239") 312 | "call X("CursorLineNr", "aaaaaa", "080808", "", "253") 313 | highlight! link CursorLineNr CursorLine 314 | 315 | call X("Folded", "ffa500", "262626", "bold") 316 | call X("FoldColumn", "d2b48c", "121212", "") 317 | call X("SignColumn", "", "121212", "", "", "233") 318 | 319 | call X("Search", "ffffff", "6b8e23", "bold") 320 | call X("IncSearch", "ffffff", "3a663a", "bold") 321 | 322 | call X("SpecialKey", "9acd32", "", "") 323 | 324 | call X("Title", "cd5c5c", "", "") 325 | call X("Visual", "", "005F87", "bold") 326 | call X("WarningMsg", "fa8072", "", "") 327 | call X("MatchParen", "", "606060", "bold") 328 | 329 | call X("DiffAdd", "d7ffaf", "5f875f", "") 330 | call X("DiffChange", "d7d7ff", "5f5f87", "") 331 | call X("DiffDelete", "ff8080", "cc6666", "") 332 | call X("DiffText", "5f5f87", "81a2be", "") 333 | 334 | call X("Pmenu", "eeeeee", "444444", "") 335 | call X("PmenuSel", "ffffff", "555555", "bold") 336 | call X("PmenuSbar", "", "666666", "") 337 | call X("PmenuThumb", "", "606060", "") 338 | 339 | " syntax highlighting groups 340 | call X("Comment", "87ceeb", "", "") 341 | call X("Constant", "ff8080", "", "") 342 | call X("Identifier", "98fb98", "", "none") 343 | call X("Statement", "f0e260", "", "bold") 344 | call X("PreProc", "cd5c5c", "", "bold") 345 | call X("Type", "91b365", "", "bold") 346 | call X("Special", "ffc266", "", "") 347 | "Underlined 348 | 349 | " delete functions {{{ 350 | delf X 351 | delf rgb 352 | delf color 353 | delf rgb_color 354 | delf rgb_level 355 | delf rgb_number 356 | delf grey_color 357 | delf grey_level 358 | delf grey_number 359 | " }}} 360 | else 361 | " basic colorscheme for 16-color terminals 362 | highlight Statement ctermfg=Yellow 363 | highlight Identifier ctermfg=Green 364 | highlight Type ctermfg=DarkGreen 365 | highlight Comment ctermfg=Cyan 366 | highlight PreProc ctermfg=Blue 367 | highlight LineNr ctermfg=DarkGray 368 | highlight Special ctermfg=Brown 369 | highlight Constant ctermfg=Red 370 | 371 | highlight Search ctermfg=Black ctermbg=Green 372 | highlight IncSearch ctermfg=DarkGray ctermbg=White 373 | highlight Visual ctermfg=White ctermbg=Blue 374 | highlight Folded cterm=bold,reverse ctermfg=DarkGray ctermbg=Brown 375 | 376 | highlight Pmenu cterm=reverse ctermfg=DarkGray ctermbg=White 377 | highlight PmenuSel ctermfg=Black ctermbg=White 378 | highlight PmenuSbar ctermbg=Black 379 | highlight PmenuThumb ctermfg=White 380 | 381 | " use only bold for the cursorline to avoid covering the background 382 | highlight clear CursorLine 383 | highlight clear CursorColumn 384 | highlight CursorLine cterm=bold gui=bold 385 | highlight CursorColumn cterm=bold gui=bold 386 | endif 387 | 388 | " vim: set fdl=0 fdm=marker: 389 | --------------------------------------------------------------------------------