1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | " Vim color file " " " __ _ _ _ " " " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ " " " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| " " " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ " " " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ " " " \___/ " " " "A colorful, dark color scheme for Vim." " " File: jellybeans.vim " URL: github.com/nanotech/jellybeans.vim " Scripts URL: vim.org/scripts/script.php?script_id=2555 " Maintainer: NanoTech (nanotech.nanotechcorp.net) " Version: 1.6 " Last Change: October 18th, 2016 " License: MIT " Contributors: Andrew Wong (w0ng) " Brian Marshall (bmars) " Daniel Herbert (pocketninja) " David Liang <bmdavll at gmail dot com> " Henry So, Jr. <henryso@panix.com> " Joe Doherty (docapotamus) " Karl Litterfeldt (Litterfeldt) " Keith Pitt (keithpitt) " Philipp Rustemeier (12foo) " Rafael Bicalho (rbika) " Rich Healey (richo) " Siwen Yu (yusiwen) " Tim Willis (willist) " " Copyright (c) 2009-2016 NanoTech " " Permission is hereby granted, free of charge, to any per‐ " son obtaining a copy of this software and associated doc‐ " umentation files (the “Software”), to deal in the Soft‐ " ware without restriction, including without limitation " the rights to use, copy, modify, merge, publish, distrib‐ " ute, sublicense, and/or sell copies of the Software, and " to permit persons to whom the Software is furnished to do " so, subject to the following conditions: " " The above copyright notice and this permission notice " shall be included in all copies or substantial portions " of the Software. " " THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY " KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO " THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐ " LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, " DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐ " TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ " NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " THE SOFTWARE. set background=dark hi clear if exists("syntax_on") syntax reset endif let colors_name = "jellybeans" if has("gui_running") || (has('termguicolors') && &termguicolors) || &t_Co >= 88 let s:low_color = 0 else let s:low_color = 1 endif " Configuration Variables: " - g:jellybeans_overrides (default = {}) " - g:jellybeans_use_lowcolor_black (default = 1) " - g:jellybeans_use_gui_italics (default = 1) " - g:jellybeans_use_term_italics (default = 0) let s:background_color = "151515" if exists("g:jellybeans_overrides") let s:overrides = g:jellybeans_overrides else let s:overrides = {} endif " Backwards compatibility if exists("g:jellybeans_background_color") \ || exists("g:jellybeans_background_color_256") \ || exists("g:jellybeans_use_term_background_color") let s:overrides = deepcopy(s:overrides) if !has_key(s:overrides, "background") let s:overrides["background"] = {} endif if exists("g:jellybeans_background_color") let s:overrides["background"]["guibg"] = g:jellybeans_background_color endif if exists("g:jellybeans_background_color_256") let s:overrides["background"]["256ctermbg"] = g:jellybeans_background_color_256 endif if exists("g:jellybeans_use_term_background_color") \ && g:jellybeans_use_term_background_color let s:overrides["background"]["ctermbg"] = "NONE" let s:overrides["background"]["256ctermbg"] = "NONE" endif endif if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black let s:termBlack = "Black" else let s:termBlack = "Grey" endif " When `termguicolors` is set, Vim[^1] ignores `guibg=NONE` after " `guibg` is already set to a color. See: " " - https://github.com/vim/vim/issues/981 " - https://github.com/nanotech/jellybeans.vim/issues/64 " " To work around this, ensure we don't set the default background " color before an override changes it to `NONE` by ensuring that the " background color isn't set to a value different from its override. " " [^1]: Tested on 8.0.567. Does not apply to Neovim. " " TODO: Enable this behavior for all highlights by applying " overrides before calling highlight commands. " if has_key(s:overrides, "background") && has_key(s:overrides["background"], "guibg") let s:background_color = s:overrides["background"]["guibg"] endif " Color approximation functions by Henry So, Jr. and David Liang {{{ " Added to jellybeans.vim by Daniel Herbert " returns an approximate grey index for the given grey level fun! s:grey_number(x) if &t_Co == 88 if a:x < 23 return 0 elseif a:x < 69 return 1 elseif a:x < 103 return 2 elseif a:x < 127 return 3 elseif a:x < 150 return 4 elseif a:x < 173 return 5 elseif a:x < 196 return 6 elseif a:x < 219 return 7 elseif a:x < 243 return 8 else return 9 endif else if a:x < 14 return 0 else let l:n = (a:x - 8) / 10 let l:m = (a:x - 8) % 10 if l:m < 5 return l:n else return l:n + 1 endif endif endif endfun " returns the actual grey level represented by the grey index fun! s:grey_level(n) if &t_Co == 88 if a:n == 0 return 0 elseif a:n == 1 return 46 elseif a:n == 2 return 92 elseif a:n == 3 return 115 elseif a:n == 4 return 139 elseif a:n == 5 return 162 elseif a:n == 6 return 185 elseif a:n == 7 return 208 elseif a:n == 8 return 231 else return 255 endif else if a:n == 0 return 0 else return 8 + (a:n * 10) endif endif endfun " returns the palette index for the given grey index fun! s:grey_color(n) if &t_Co == 88 if a:n == 0 return 16 elseif a:n == 9 return 79 else return 79 + a:n endif else if a:n == 0 return 16 elseif a:n == 25 return 231 else return 231 + a:n endif endif endfun " returns an approximate color index for the given color level fun! s:rgb_number(x) if &t_Co == 88 if a:x < 69 return 0 elseif a:x < 172 return 1 elseif a:x < 230 return 2 else return 3 endif else if a:x < 75 return 0 else let l:n = (a:x - 55) / 40 let l:m = (a:x - 55) % 40 if l:m < 20 return l:n else return l:n + 1 endif endif endif endfun " returns the actual color level for the given color index fun! s:rgb_level(n) if &t_Co == 88 if a:n == 0 return 0 elseif a:n == 1 return 139 elseif a:n == 2 return 205 else return 255 endif else if a:n == 0 return 0 else return 55 + (a:n * 40) endif endif endfun " returns the palette index for the given R/G/B color indices fun! s:rgb_color(x, y, z) if &t_Co == 88 return 16 + (a:x * 16) + (a:y * 4) + a:z else return 16 + (a:x * 36) + (a:y * 6) + a:z endif endfun " returns the palette index to approximate the given R/G/B color levels fun! s:color(r, g, b) " map greys directly (see xterm's 256colres.pl) if &t_Co == 256 && a:r == a:g && a:g == a:b && a:r > 3 && a:r < 243 return (a:r - 8) / 10 + 232 endif " get the closest grey let l:gx = s:grey_number(a:r) let l:gy = s:grey_number(a:g) let l:gz = s:grey_number(a:b) " get the closest color let l:x = s:rgb_number(a:r) let l:y = s:rgb_number(a:g) let l:z = s:rgb_number(a:b) if l:gx == l:gy && l:gy == l:gz " there are two possibilities let l:dgr = s:grey_level(l:gx) - a:r let l:dgg = s:grey_level(l:gy) - a:g let l:dgb = s:grey_level(l:gz) - a:b let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) let l:dr = s:rgb_level(l:gx) - a:r let l:dg = s:rgb_level(l:gy) - a:g let l:db = s:rgb_level(l:gz) - a:b let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) if l:dgrey < l:drgb " use the grey return s:grey_color(l:gx) else " use the color return s:rgb_color(l:x, l:y, l:z) endif else " only one possibility return s:rgb_color(l:x, l:y, l:z) endif endfun fun! s:is_empty_or_none(str) return empty(a:str) || a:str ==? "NONE" endfun " returns the palette index to approximate the 'rrggbb' hex string fun! s:rgb(rgb) if s:is_empty_or_none(a:rgb) return "NONE" endif let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 return s:color(l:r, l:g, l:b) endfun fun! s:prefix_highlight_value_with(prefix, color) if s:is_empty_or_none(a:color) return "NONE" else return a:prefix . a:color endif endfun fun! s:remove_italic_attr(attr) let l:attr = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",") if empty(l:attr) let l:attr = "NONE" endif return l:attr endfun " sets the highlighting for the given group fun! s:X(group, fg, bg, attr, lcfg, lcbg) if s:low_color exec "hi ".a:group. \ " ctermfg=".s:prefix_highlight_value_with("", a:lcfg). \ " ctermbg=".s:prefix_highlight_value_with("", a:lcbg) else exec "hi ".a:group. \ " guifg=".s:prefix_highlight_value_with("#", a:fg). \ " guibg=".s:prefix_highlight_value_with("#", a:bg). \ " ctermfg=".s:rgb(a:fg). \ " ctermbg=".s:rgb(a:bg) endif let l:attr = s:prefix_highlight_value_with("", a:attr) if exists("g:jellybeans_use_term_italics") && g:jellybeans_use_term_italics let l:cterm_attr = l:attr else let l:cterm_attr = s:remove_italic_attr(l:attr) endif if !exists("g:jellybeans_use_gui_italics") || g:jellybeans_use_gui_italics let l:gui_attr = l:attr else let l:gui_attr = s:remove_italic_attr(l:attr) endif exec "hi ".a:group." gui=".l:gui_attr." cterm=".l:cterm_attr endfun " }}} call s:X("Normal","e8e8d3",s:background_color,"","White","") set background=dark if version >= 700 call s:X("CursorLine","","1c1c1c","","",s:termBlack) call s:X("CursorColumn","","1c1c1c","","",s:termBlack) call s:X("MatchParen","ffffff","556779","bold","","DarkCyan") call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack) call s:X("TabLineFill","9098a0","","","",s:termBlack) call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White") " Auto-completion call s:X("Pmenu","ffffff","606060","","White",s:termBlack) call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White") endif call s:X("Visual","","404040","","",s:termBlack) call s:X("Cursor",s:background_color,"b0d0f0","","","") call s:X("LineNr","605958",s:background_color,"NONE",s:termBlack,"") call s:X("CursorLineNr","ccc5c4","","NONE","White","") call s:X("Comment","888888","","italic","Grey","") call s:X("Todo","c7c7c7","","bold","White",s:termBlack) call s:X("StatusLine","000000","dddddd","italic","","White") call s:X("StatusLineNC","ffffff","403c41","italic","White","Black") call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack) call s:X("WildMenu","f0a0c0","302028","","Magenta","") call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"") call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack) call s:X("SignColumn","777777","333333","","",s:termBlack) call s:X("ColorColumn","","000000","","",s:termBlack) call s:X("Title","70b950","","bold","Green","") call s:X("Constant","cf6a4c","","","Red","") call s:X("Special","799d6a","","","Green","") call s:X("Delimiter","668799","","","Grey","") call s:X("String","99ad6a","","","Green","") call s:X("StringDelimiter","556633","","","DarkGreen","") call s:X("Identifier","c6b6ee","","","LightCyan","") call s:X("Structure","8fbfdc","","","LightCyan","") call s:X("Function","fad07a","","","Yellow","") call s:X("Statement","8197bf","","","DarkBlue","") call s:X("PreProc","8fbfdc","","","LightBlue","") hi! link Operator Structure hi! link Conceal Operator call s:X("Type","ffb964","","","Yellow","") call s:X("NonText","606060",s:background_color,"",s:termBlack,"") call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"") call s:X("Search","f0a0c0","302028","underline","Magenta","") call s:X("Directory","dad085","","","Yellow","") call s:X("ErrorMsg","","902020","","","DarkRed") hi! link Error ErrorMsg hi! link MoreMsg Special call s:X("Question","65C254","","","Green","") " Spell Checking call s:X("SpellBad","","902020","underline","","DarkRed") call s:X("SpellCap","","0000df","underline","","Blue") call s:X("SpellRare","","540063","underline","","DarkMagenta") call s:X("SpellLocal","","2D7067","underline","","Green") " Diff hi! link diffRemoved Constant hi! link diffAdded String " VimDiff call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen") call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed") call s:X("DiffChange","","2B5B77","","White","DarkBlue") call s:X("DiffText","8fbfdc","000000","reverse","Yellow","") " PHP hi! link phpFunctions Function call s:X("StorageClass","c59f6f","","","Red","") hi! link phpSuperglobal Identifier hi! link phpQuoteSingle StringDelimiter hi! link phpQuoteDouble StringDelimiter hi! link phpBoolean Constant hi! link phpNull Constant hi! link phpArrayPair Operator hi! link phpOperator Normal hi! link phpRelation Normal hi! link phpVarSelector Identifier " Python hi! link pythonOperator Statement " Ruby hi! link rubySharpBang Comment call s:X("rubyClass","447799","","","DarkBlue","") call s:X("rubyIdentifier","c6b6fe","","","Cyan","") hi! link rubyConstant Type hi! link rubyFunction Function call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","") call s:X("rubySymbol","7697d6","","","Blue","") hi! link rubyGlobalVariable rubyInstanceVariable hi! link rubyModule rubyClass call s:X("rubyControl","7597c6","","","Blue","") hi! link rubyString String hi! link rubyStringDelimiter StringDelimiter hi! link rubyInterpolationDelimiter Identifier call s:X("rubyRegexpDelimiter","540063","","","Magenta","") call s:X("rubyRegexp","dd0093","","","DarkMagenta","") call s:X("rubyRegexpSpecial","a40073","","","Magenta","") call s:X("rubyPredefinedIdentifier","de5577","","","Red","") " Erlang hi! link erlangAtom rubySymbol hi! link erlangBIF rubyPredefinedIdentifier hi! link erlangFunction rubyPredefinedIdentifier hi! link erlangDirective Statement hi! link erlangNode Identifier " Elixir hi! link elixirAtom rubySymbol " JavaScript hi! link javaScriptValue Constant hi! link javaScriptRegexpString rubyRegexp hi! link javaScriptTemplateVar StringDelim hi! link javaScriptTemplateDelim Identifier hi! link javaScriptTemplateString String " CoffeeScript hi! link coffeeRegExp javaScriptRegexpString " Lua hi! link luaOperator Conditional " C hi! link cFormat Identifier hi! link cOperator Constant " Objective-C/Cocoa hi! link objcClass Type hi! link cocoaClass objcClass hi! link objcSubclass objcClass hi! link objcSuperclass objcClass hi! link objcDirective rubyClass hi! link objcStatement Constant hi! link cocoaFunction Function hi! link objcMethodName Identifier hi! link objcMethodArg Normal hi! link objcMessageName Identifier " Vimscript hi! link vimOper Normal " HTML hi! link htmlTag Statement hi! link htmlEndTag htmlTag hi! link htmlTagName htmlTag " XML hi! link xmlTag Statement hi! link xmlEndTag xmlTag hi! link xmlTagName xmlTag hi! link xmlEqual xmlTag hi! link xmlEntity Special hi! link xmlEntityPunct xmlEntity hi! link xmlDocTypeDecl PreProc hi! link xmlDocTypeKeyword PreProc hi! link xmlProcessingDelim xmlAttrib " Debugger.vim call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue") call s:X("DbgBreakPt","","4F0037","","","DarkMagenta") " vim-indent-guides if !exists("g:indent_guides_auto_colors") let g:indent_guides_auto_colors = 0 endif call s:X("IndentGuidesOdd","","232323","","","") call s:X("IndentGuidesEven","","1b1b1b","","","") " Plugins, etc. hi! link TagListFileName Directory call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green") " Manual overrides for 256-color terminals. Dark colors auto-map badly. if !s:low_color hi StatusLineNC ctermbg=235 hi Folded ctermbg=236 hi DiffText ctermfg=81 hi DbgBreakPt ctermbg=53 hi IndentGuidesOdd ctermbg=235 hi IndentGuidesEven ctermbg=234 endif if !empty("s:overrides") fun! s:current_attr(group) let l:synid = synIDtrans(hlID(a:group)) let l:attrs = [] for l:attr in ["bold", "italic", "reverse", "standout", "underline", "undercurl"] if synIDattr(l:synid, l:attr, "gui") == 1 call add(l:attrs, l:attr) endif endfor return join(l:attrs, ",") endfun fun! s:current_color(group, what, mode) let l:color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode) if l:color == -1 return "" else return substitute(l:color, "^#", "", "") endif endfun fun! s:load_color_def(group, def) call s:X(a:group, get(a:def, "guifg", s:current_color(a:group, "fg", "gui")), \ get(a:def, "guibg", s:current_color(a:group, "bg", "gui")), \ get(a:def, "attr", s:current_attr(a:group)), \ get(a:def, "ctermfg", s:current_color(a:group, "fg", "cterm")), \ get(a:def, "ctermbg", s:current_color(a:group, "bg", "cterm"))) if !s:low_color for l:prop in ["ctermfg", "ctermbg"] let l:override_key = "256".l:prop if has_key(a:def, l:override_key) exec "hi ".a:group." ".l:prop."=".a:def[l:override_key] endif endfor endif endfun fun! s:load_colors(defs) for [l:group, l:def] in items(a:defs) if l:group == "background" call s:load_color_def("LineNr", l:def) call s:load_color_def("NonText", l:def) call s:load_color_def("Normal", l:def) else call s:load_color_def(l:group, l:def) endif unlet l:group unlet l:def endfor endfun call s:load_colors(s:overrides) delf s:load_colors delf s:load_color_def delf s:current_color delf s:current_attr endif " delete functions {{{ delf s:X delf s:remove_italic_attr delf s:prefix_highlight_value_with delf s:rgb delf s:is_empty_or_none delf s:color delf s:rgb_color delf s:rgb_level delf s:rgb_number delf s:grey_color delf s:grey_level delf s:grey_number " }}} |