changeset 551:138ee2cd2179

Use jellybeans theme for vim. Better compat with plain terminal.
author nanaya <me@myconan.net>
date Tue, 14 Apr 2015 04:47:54 +0900
parents 4afbb88c7579
children 6084b6b425ad
files rc/vim-base16-default rc/vim-jellybeans rc/vimrc setup
diffstat 4 files changed, 572 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/rc/vim-base16-default	Tue Apr 14 04:47:17 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-" Base16 Default (https://github.com/chriskempson/base16)
-" Scheme: Chris Kempson (http://chriskempson.com)
-
-" GUI color definitions
-let s:gui00 = "151515"
-let s:gui01 = "202020"
-let s:gui02 = "303030"
-let s:gui03 = "505050"
-let s:gui04 = "b0b0b0"
-let s:gui05 = "d0d0d0"
-let s:gui06 = "e0e0e0"
-let s:gui07 = "f5f5f5"
-let s:gui08 = "ac4142"
-let s:gui09 = "d28445"
-let s:gui0A = "f4bf75"
-let s:gui0B = "90a959"
-let s:gui0C = "75b5aa"
-let s:gui0D = "6a9fb5"
-let s:gui0E = "aa759f"
-let s:gui0F = "8f5536"
-
-" Terminal color definitions
-let s:cterm00 = "00"
-let s:cterm03 = "08"
-let s:cterm05 = "07"
-let s:cterm07 = "15"
-let s:cterm08 = "01"
-let s:cterm0A = "03"
-let s:cterm0B = "02"
-let s:cterm0C = "06"
-let s:cterm0D = "04"
-let s:cterm0E = "05"
-if exists('base16colorspace') && base16colorspace == "256"
-  let s:cterm01 = "18"
-  let s:cterm02 = "19"
-  let s:cterm04 = "20"
-  let s:cterm06 = "21"
-  let s:cterm09 = "16"
-  let s:cterm0F = "17"
-else
-  let s:cterm01 = "10"
-  let s:cterm02 = "11"
-  let s:cterm04 = "12"
-  let s:cterm06 = "13"
-  let s:cterm09 = "09"
-  let s:cterm0F = "14"
-endif
-
-" Theme setup
-hi clear
-syntax reset
-let g:colors_name = "base16-default"
-
-" Highlighting function
-fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr)
-  if a:guifg != ""
-    exec "hi " . a:group . " guifg=#" . s:gui(a:guifg)
-  endif
-  if a:guibg != ""
-    exec "hi " . a:group . " guibg=#" . s:gui(a:guibg)
-  endif
-  if a:ctermfg != ""
-    exec "hi " . a:group . " ctermfg=" . s:cterm(a:ctermfg)
-  endif
-  if a:ctermbg != ""
-    exec "hi " . a:group . " ctermbg=" . s:cterm(a:ctermbg)
-  endif
-  if a:attr != ""
-    exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
-  endif
-endfun
-
-" Return GUI color for light/dark variants
-fun s:gui(color)
-  if &background == "dark"
-    return a:color
-  endif
-
-  if a:color == s:gui00
-    return s:gui07
-  elseif a:color == s:gui01
-    return s:gui06
-  elseif a:color == s:gui02
-    return s:gui05
-  elseif a:color == s:gui03
-    return s:gui04
-  elseif a:color == s:gui04
-    return s:gui03
-  elseif a:color == s:gui05
-    return s:gui02
-  elseif a:color == s:gui06
-    return s:gui01
-  elseif a:color == s:gui07
-    return s:gui00
-  endif
-
-  return a:color
-endfun
-
-" Return terminal color for light/dark variants
-fun s:cterm(color)
-  if &background == "dark"
-    return a:color
-  endif
-
-  if a:color == s:cterm00
-    return s:cterm07
-  elseif a:color == s:cterm01
-    return s:cterm06
-  elseif a:color == s:cterm02
-    return s:cterm05
-  elseif a:color == s:cterm03
-    return s:cterm04
-  elseif a:color == s:cterm04
-    return s:cterm03
-  elseif a:color == s:cterm05
-    return s:cterm02
-  elseif a:color == s:cterm06
-    return s:cterm01
-  elseif a:color == s:cterm07
-    return s:cterm00
-  endif
-
-  return a:color
-endfun
-
-" Vim editor colors
-call <sid>hi("Bold",          "", "", "", "", "bold")
-call <sid>hi("Debug",         s:gui08, "", s:cterm08, "", "")
-call <sid>hi("Directory",     s:gui0D, "", s:cterm0D, "", "")
-call <sid>hi("ErrorMsg",      s:gui08, s:gui00, s:cterm08, s:cterm00, "")
-call <sid>hi("Exception",     s:gui08, "", s:cterm08, "", "")
-call <sid>hi("FoldColumn",    "", s:gui01, "", s:cterm01, "")
-call <sid>hi("Folded",        s:gui03, s:gui01, s:cterm03, s:cterm01, "")
-call <sid>hi("IncSearch",     s:gui01, s:gui0A, s:cterm01, s:cterm0A, "none")
-call <sid>hi("Italic",        "", "", "", "", "none")
-call <sid>hi("Macro",         s:gui08, "", s:cterm08, "", "")
-call <sid>hi("MatchParen",    s:gui00, s:gui03, s:cterm00, s:cterm03,  "")
-call <sid>hi("ModeMsg",       s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("MoreMsg",       s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("Question",      s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("Search",        s:gui01, s:gui0A, s:cterm01, s:cterm0A,  "")
-call <sid>hi("SpecialKey",    s:gui03, "", s:cterm03, "", "")
-call <sid>hi("TooLong",       s:gui08, "", s:cterm08, "", "")
-call <sid>hi("Underlined",    s:gui08, "", s:cterm08, "", "")
-call <sid>hi("Visual",        "", s:gui02, "", s:cterm02, "")
-call <sid>hi("VisualNOS",     s:gui08, "", s:cterm08, "", "")
-call <sid>hi("WarningMsg",    s:gui08, "", s:cterm08, "", "")
-call <sid>hi("WildMenu",      s:gui08, "", s:cterm08, "", "")
-call <sid>hi("Title",         s:gui0D, "", s:cterm0D, "", "none")
-call <sid>hi("Conceal",       s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
-call <sid>hi("Cursor",        s:gui00, s:gui05, s:cterm00, s:cterm05, "")
-call <sid>hi("NonText",       s:gui03, "", s:cterm03, "", "")
-call <sid>hi("Normal",        s:gui05, s:gui00, s:cterm05, s:cterm00, "")
-call <sid>hi("LineNr",        s:gui03, s:gui01, s:cterm03, s:cterm01, "")
-call <sid>hi("SignColumn",    s:gui03, s:gui01, s:cterm03, s:cterm01, "")
-call <sid>hi("SpecialKey",    s:gui03, "", s:cterm03, "", "")
-call <sid>hi("StatusLine",    s:gui04, s:gui02, s:cterm04, s:cterm02, "none")
-call <sid>hi("StatusLineNC",  s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
-call <sid>hi("VertSplit",     s:gui02, s:gui02, s:cterm02, s:cterm02, "none")
-call <sid>hi("ColorColumn",   "", s:gui01, "", s:cterm01, "none")
-call <sid>hi("CursorColumn",  "", s:gui01, "", s:cterm01, "none")
-call <sid>hi("CursorLine",    "", s:gui01, "", s:cterm01, "none")
-call <sid>hi("CursorLineNr",  s:gui03, s:gui01, s:cterm03, s:cterm01, "")
-call <sid>hi("PMenu",         s:gui04, s:gui01, s:cterm04, s:cterm01, "none")
-call <sid>hi("PMenuSel",      s:gui01, s:gui04, s:cterm01, s:cterm04, "")
-call <sid>hi("TabLine",       s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
-call <sid>hi("TabLineFill",   s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
-call <sid>hi("TabLineSel",    s:gui0B, s:gui01, s:cterm0B, s:cterm01, "none")
-
-" Standard syntax highlighting
-call <sid>hi("Boolean",      s:gui09, "", s:cterm09, "", "")
-call <sid>hi("Character",    s:gui08, "", s:cterm08, "", "")
-call <sid>hi("Comment",      s:gui03, "", s:cterm03, "", "")
-call <sid>hi("Conditional",  s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("Constant",     s:gui09, "", s:cterm09, "", "")
-call <sid>hi("Define",       s:gui0E, "", s:cterm0E, "", "none")
-call <sid>hi("Delimiter",    s:gui0F, "", s:cterm0F, "", "")
-call <sid>hi("Float",        s:gui09, "", s:cterm09, "", "")
-call <sid>hi("Function",     s:gui0D, "", s:cterm0D, "", "")
-call <sid>hi("Identifier",   s:gui08, "", s:cterm08, "", "none")
-call <sid>hi("Include",      s:gui0D, "", s:cterm0D, "", "")
-call <sid>hi("Keyword",      s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("Label",        s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("Number",       s:gui09, "", s:cterm09, "", "")
-call <sid>hi("Operator",     s:gui05, "", s:cterm05, "", "none")
-call <sid>hi("PreProc",      s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("Repeat",       s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("Special",      s:gui0C, "", s:cterm0C, "", "")
-call <sid>hi("SpecialChar",  s:gui0F, "", s:cterm0F, "", "")
-call <sid>hi("Statement",    s:gui08, "", s:cterm08, "", "")
-call <sid>hi("StorageClass", s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("String",       s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("Structure",    s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("Tag",          s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("Todo",         s:gui0A, s:gui01, s:cterm0A, s:cterm01, "")
-call <sid>hi("Type",         s:gui09, "", s:cterm09, "", "none")
-call <sid>hi("Typedef",      s:gui0A, "", s:cterm0A, "", "")
-
-" Spelling highlighting
-call <sid>hi("SpellBad",     "", s:gui00, "", s:cterm00, "undercurl")
-call <sid>hi("SpellLocal",   "", s:gui00, "", s:cterm00, "undercurl")
-call <sid>hi("SpellCap",     "", s:gui00, "", s:cterm00, "undercurl")
-call <sid>hi("SpellRare",    "", s:gui00, "", s:cterm00, "undercurl")
-
-" Additional diff highlighting
-call <sid>hi("DiffAdd",      s:gui0B, s:gui00, s:cterm0B, s:cterm00, "")
-call <sid>hi("DiffChange",   s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
-call <sid>hi("DiffDelete",   s:gui08, s:gui00, s:cterm08, s:cterm00, "")
-call <sid>hi("DiffText",     s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
-call <sid>hi("DiffAdded",    s:gui0B, s:gui00, s:cterm0B, s:cterm00, "")
-call <sid>hi("DiffFile",     s:gui08, s:gui00, s:cterm08, s:cterm00, "")
-call <sid>hi("DiffNewFile",  s:gui0B, s:gui00, s:cterm0B, s:cterm00, "")
-call <sid>hi("DiffLine",     s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
-call <sid>hi("DiffRemoved",  s:gui08, s:gui00, s:cterm08, s:cterm00, "")
-
-" Ruby highlighting
-call <sid>hi("rubyAttribute",               s:gui0D, "", s:cterm0D, "", "")
-call <sid>hi("rubyConstant",                s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("rubyInterpolation",           s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("rubyInterpolationDelimiter",  s:gui0F, "", s:cterm0F, "", "")
-call <sid>hi("rubyRegexp",                  s:gui0C, "", s:cterm0C, "", "")
-call <sid>hi("rubySymbol",                  s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("rubyStringDelimiter",         s:gui0B, "", s:cterm0B, "", "")
-
-" PHP highlighting
-call <sid>hi("phpMemberSelector",  s:gui05, "", s:cterm05, "", "")
-call <sid>hi("phpComparison",      s:gui05, "", s:cterm05, "", "")
-call <sid>hi("phpParent",          s:gui05, "", s:cterm05, "", "")
-
-" HTML highlighting
-call <sid>hi("htmlBold",    s:gui0A, "", s:cterm0A, "", "")
-call <sid>hi("htmlItalic",  s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("htmlEndTag",  s:gui05, "", s:cterm05, "", "")
-call <sid>hi("htmlTag",     s:gui05, "", s:cterm05, "", "")
-
-" CSS highlighting
-call <sid>hi("cssBraces",      s:gui05, "", s:cterm05, "", "")
-call <sid>hi("cssClassName",   s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("cssColor",       s:gui0C, "", s:cterm0C, "", "")
-
-" SASS highlighting
-call <sid>hi("sassidChar",     s:gui08, "", s:cterm08, "", "")
-call <sid>hi("sassClassChar",  s:gui09, "", s:cterm09, "", "")
-call <sid>hi("sassInclude",    s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("sassMixing",     s:gui0E, "", s:cterm0E, "", "")
-call <sid>hi("sassMixinName",  s:gui0D, "", s:cterm0D, "", "")
-
-" JavaScript highlighting
-call <sid>hi("javaScript",        s:gui05, "", s:cterm05, "", "")
-call <sid>hi("javaScriptBraces",  s:gui05, "", s:cterm05, "", "")
-call <sid>hi("javaScriptNumber",  s:gui09, "", s:cterm09, "", "")
-
-" Markdown highlighting
-call <sid>hi("markdownCode",              s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("markdownCodeBlock",         s:gui0B, "", s:cterm0B, "", "")
-call <sid>hi("markdownHeadingDelimiter",  s:gui0D, "", s:cterm0D, "", "")
-
-" Git highlighting
-call <sid>hi("gitCommitOverflow",  s:gui08, "", s:cterm08, "", "")
-call <sid>hi("gitCommitSummary",   s:gui0B, "", s:cterm0B, "", "")
-  
-" GitGutter highlighting
-call <sid>hi("GitGutterAdd",     s:gui0B, s:gui01, s:cterm0B, s:cterm01, "")
-call <sid>hi("GitGutterChange",  s:gui0D, s:gui01, s:cterm0D, s:cterm01, "")
-call <sid>hi("GitGutterDelete",  s:gui08, s:gui01, s:cterm08, s:cterm01, "")
-call <sid>hi("GitGutterChangeDelete",  s:gui0E, s:gui01, s:cterm0E, s:cterm01, "")
-
-" Signify highlighting
-call <sid>hi("SignifySignAdd",     s:gui0B, s:gui01, s:cterm0B, s:cterm01, "")
-call <sid>hi("SignifySignChange",  s:gui0D, s:gui01, s:cterm0D, s:cterm01, "")
-call <sid>hi("SignifySignDelete",  s:gui08, s:gui01, s:cterm08, s:cterm01, "")
-
-" NERDTree highlighting
-call <sid>hi("NERDTreeDirSlash",  s:gui0D, "", s:cterm0D, "", "")
-call <sid>hi("NERDTreeExecFile",  s:gui05, "", s:cterm05, "", "")
-
-" Remove functions
-delf <sid>hi
-delf <sid>gui
-delf <sid>cterm
-
-" Remove color variables
-unlet s:gui00 s:gui01 s:gui02 s:gui03  s:gui04  s:gui05  s:gui06  s:gui07  s:gui08  s:gui09 s:gui0A  s:gui0B  s:gui0C  s:gui0D  s:gui0E  s:gui0F
-unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/vim-jellybeans	Tue Apr 14 04:47:54 2015 +0900
@@ -0,0 +1,569 @@
+" 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~git
+" Last Change:  January 15th, 2012
+" License:      MIT
+" Contributors: Daniel Herbert (pocketninja)
+"               Henry So, Jr. <henryso@panix.com>
+"               David Liang <bmdavll at gmail dot com>
+"               Rich Healey (richo)
+"               Andrew Wong (w0ng)
+"
+" Copyright (c) 2009-2012 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") || &t_Co == 88 || &t_Co == 256
+  let s:low_color = 0
+else
+  let s:low_color = 1
+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)
+  " 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
+
+" returns the palette index to approximate the 'rrggbb' hex string
+fun! s:rgb(rgb)
+  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
+
+" sets the highlighting for the given group
+fun! s:X(group, fg, bg, attr, lcfg, lcbg)
+  if s:low_color
+    let l:fge = empty(a:lcfg)
+    let l:bge = empty(a:lcbg)
+
+    if !l:fge && !l:bge
+      exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=".a:lcbg
+    elseif !l:fge && l:bge
+      exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=NONE"
+    elseif l:fge && !l:bge
+      exec "hi ".a:group." ctermfg=NONE ctermbg=".a:lcbg
+    endif
+  else
+    let l:fge = empty(a:fg)
+    let l:bge = empty(a:bg)
+
+    if !l:fge && !l:bge
+      exec "hi ".a:group." guifg=#".a:fg." guibg=#".a:bg." ctermfg=".s:rgb(a:fg)." ctermbg=".s:rgb(a:bg)
+    elseif !l:fge && l:bge
+      exec "hi ".a:group." guifg=#".a:fg." guibg=NONE ctermfg=".s:rgb(a:fg)." ctermbg=NONE"
+    elseif l:fge && !l:bge
+      exec "hi ".a:group." guifg=NONE guibg=#".a:bg." ctermfg=NONE ctermbg=".s:rgb(a:bg)
+    endif
+  endif
+
+  if a:attr == ""
+    exec "hi ".a:group." gui=none cterm=none"
+  else
+    let l:noitalic = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",")
+    if empty(l:noitalic)
+      let l:noitalic = "none"
+    endif
+    exec "hi ".a:group." gui=".a:attr." cterm=".l:noitalic
+  endif
+endfun
+" }}}
+
+if !exists("g:jellybeans_background_color")
+  let g:jellybeans_background_color = "151515"
+end
+
+call s:X("Normal","e8e8d3",g:jellybeans_background_color,"","White","")
+set background=dark
+
+if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black
+    let s:termBlack = "Black"
+else
+    let s:termBlack = "Grey"
+endif
+
+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",g:jellybeans_background_color,"b0d0f0","","","")
+
+call s:X("LineNr","605958",g:jellybeans_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
+
+call s:X("Type","ffb964","","","Yellow","")
+call s:X("NonText","606060",g:jellybeans_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
+
+" JavaScript
+
+hi! link javaScriptValue Constant
+hi! link javaScriptRegexpString rubyRegexp
+
+" 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")
+
+if !exists("g:jellybeans_background_color_256")
+  let g:jellybeans_background_color_256=233
+end
+" Manual overrides for 256-color terminals. Dark colors auto-map badly.
+if !s:low_color
+  hi StatusLineNC ctermbg=235
+  hi Folded ctermbg=236
+  hi FoldColumn ctermbg=234
+  hi SignColumn ctermbg=236
+  hi CursorColumn ctermbg=234
+  hi CursorLine ctermbg=234
+  hi SpecialKey ctermbg=234
+  exec "hi NonText ctermbg=".g:jellybeans_background_color_256
+  exec "hi LineNr ctermbg=".g:jellybeans_background_color_256
+  hi DiffText ctermfg=81
+  exec "hi Normal ctermbg=".g:jellybeans_background_color_256
+  hi DbgBreakPt ctermbg=53
+  hi IndentGuidesOdd ctermbg=235
+  hi IndentGuidesEven ctermbg=234
+endif
+
+if exists("g:jellybeans_overrides")
+  fun! s:load_colors(defs)
+    for [l:group, l:v] in items(a:defs)
+      call s:X(l:group, get(l:v, 'guifg', ''), get(l:v, 'guibg', ''),
+      \                 get(l:v, 'attr', ''),
+      \                 get(l:v, 'ctermfg', ''), get(l:v, 'ctermbg', ''))
+      if !s:low_color
+        for l:prop in ['ctermfg', 'ctermbg']
+          let l:override_key = '256'.l:prop
+          if has_key(l:v, l:override_key)
+            exec "hi ".l:group." ".l:prop."=".l:v[l:override_key]
+          endif
+        endfor
+      endif
+      unlet l:group
+      unlet l:v
+    endfor
+  endfun
+  call s:load_colors(g:jellybeans_overrides)
+  delf s:load_colors
+endif
+
+" delete functions {{{
+delf s:X
+delf s:rgb
+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
+" }}}
--- a/rc/vimrc	Tue Apr 14 04:47:17 2015 +0900
+++ b/rc/vimrc	Tue Apr 14 04:47:54 2015 +0900
@@ -67,8 +67,8 @@
   set foldmethod=syntax
   set nofoldenable
   set background=dark
-  set t_Co=256
-  colorscheme base16-default
+  let g:jellybeans_use_lowcolor_black = 0
+  colorscheme jellybeans
 endif
 
 if has("autocmd")
--- a/setup	Tue Apr 14 04:47:17 2015 +0900
+++ b/setup	Tue Apr 14 04:47:54 2015 +0900
@@ -186,7 +186,7 @@
     _touch "${HOME}/.hgignore_global.local"
     _rc "${1}" "inputrc" ".inputrc"
     _tmux "${1}"
-    _rc "${1}" "vim-base16-default" ".vim/colors/base16-default.vim"
+    _rc "${1}" "vim-jellybeans" ".vim/colors/jellybeans.vim"
     _vim_syntax "${1}"
     _rc "${1}" "vim-autoload-pathogen" ".vim/autoload/pathogen.vim"
     _rc "${1}" "vimrc" ".vimrc"