Blame | Last modification | View Log | RSS feed
" Vim color file" Maintainer: Henry So, Jr. <henryso@panix.com>" These are the colors of the "desert" theme by Hans Fugal with a few small" modifications (namely that I lowered the intensity of the normal white and" made the normal and nontext backgrounds black), modified to work with 88-" and 256-color xterms."" The original "desert" theme is available as part of the vim distribution or" at http://hans.fugal.net/vim/colors/."" The real feature of this color scheme, with a wink to the "inkpot" theme, is" the programmatic approximation of the gui colors to the palettes of 88- and" 256- color xterms. The functions that do this (folded away, for" readability) are calibrated to the colors used for Thomas E. Dickey's xterm" (version 200), which is available at http://dickey.his.com/xterm/xterm.html."" I struggled with trying to parse the rgb.txt file to avoid the necessity of" converting color names to #rrggbb form, but decided it was just not worth" the effort. Maybe someone seeing this may decide otherwise...set background=darkif version > 580" no guarantees for version 5.8 and below, but this makes it stop" complaininghi clearif exists("syntax_on")syntax resetendifendiflet g:colors_name="desert256"if has("gui_running") || &t_Co == 88 || &t_Co == 256" functions {{{" returns an approximate grey index for the given grey levelfun <SID>grey_number(x)if &t_Co == 88if a:x < 23return 0elseif a:x < 69return 1elseif a:x < 103return 2elseif a:x < 127return 3elseif a:x < 150return 4elseif a:x < 173return 5elseif a:x < 196return 6elseif a:x < 219return 7elseif a:x < 243return 8elsereturn 9endifelseif a:x < 14return 0elselet l:n = (a:x - 8) / 10let l:m = (a:x - 8) % 10if l:m < 5return l:nelsereturn l:n + 1endifendifendifendfun" returns the actual grey level represented by the grey indexfun <SID>grey_level(n)if &t_Co == 88if a:n == 0return 0elseif a:n == 1return 46elseif a:n == 2return 92elseif a:n == 3return 115elseif a:n == 4return 139elseif a:n == 5return 162elseif a:n == 6return 185elseif a:n == 7return 208elseif a:n == 8return 231elsereturn 255endifelseif a:n == 0return 0elsereturn 8 + (a:n * 10)endifendifendfun" returns the palette index for the given grey indexfun <SID>grey_color(n)if &t_Co == 88if a:n == 0return 16elseif a:n == 9return 79elsereturn 79 + a:nendifelseif a:n == 0return 16elseif a:n == 25return 231elsereturn 231 + a:nendifendifendfun" returns an approximate color index for the given color levelfun <SID>rgb_number(x)if &t_Co == 88if a:x < 69return 0elseif a:x < 172return 1elseif a:x < 230return 2elsereturn 3endifelseif a:x < 75return 0elselet l:n = (a:x - 55) / 40let l:m = (a:x - 55) % 40if l:m < 20return l:nelsereturn l:n + 1endifendifendifendfun" returns the actual color level for the given color indexfun <SID>rgb_level(n)if &t_Co == 88if a:n == 0return 0elseif a:n == 1return 139elseif a:n == 2return 205elsereturn 255endifelseif a:n == 0return 0elsereturn 55 + (a:n * 40)endifendifendfun" returns the palette index for the given R/G/B color indicesfun <SID>rgb_color(x, y, z)if &t_Co == 88return 16 + (a:x * 16) + (a:y * 4) + a:zelsereturn 16 + (a:x * 36) + (a:y * 6) + a:zendifendfun" returns the palette index to approximate the given R/G/B color levelsfun <SID>color(r, g, b)" get the closest greylet l:gx = <SID>grey_number(a:r)let l:gy = <SID>grey_number(a:g)let l:gz = <SID>grey_number(a:b)" get the closest colorlet l:x = <SID>rgb_number(a:r)let l:y = <SID>rgb_number(a:g)let l:z = <SID>rgb_number(a:b)if l:gx == l:gy && l:gy == l:gz" there are two possibilitieslet l:dgr = <SID>grey_level(l:gx) - a:rlet l:dgg = <SID>grey_level(l:gy) - a:glet l:dgb = <SID>grey_level(l:gz) - a:blet l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)let l:dr = <SID>rgb_level(l:gx) - a:rlet l:dg = <SID>rgb_level(l:gy) - a:glet l:db = <SID>rgb_level(l:gz) - a:blet l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)if l:dgrey < l:drgb" use the greyreturn <SID>grey_color(l:gx)else" use the colorreturn <SID>rgb_color(l:x, l:y, l:z)endifelse" only one possibilityreturn <SID>rgb_color(l:x, l:y, l:z)endifendfun" returns the palette index to approximate the 'rrggbb' hex stringfun <SID>rgb(rgb)let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0return <SID>color(l:r, l:g, l:b)endfun" sets the highlighting for the given groupfun <SID>X(group, fg, bg, attr)if a:fg != ""exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)endifif a:bg != ""exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)endifif a:attr != ""exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attrendifendfun" }}}call <SID>X("Normal", "cccccc", "000000", "")" highlight groupscall <SID>X("Cursor", "708090", "f0e68c", "")"CursorIM"Directory"DiffAdd"DiffChange"DiffDelete"DiffText"ErrorMsgcall <SID>X("VertSplit", "c2bfa5", "7f7f7f", "reverse")call <SID>X("Folded", "ffd700", "4d4d4d", "")call <SID>X("FoldColumn", "d2b48c", "4d4d4d", "")call <SID>X("IncSearch", "708090", "f0e68c", "")"LineNrcall <SID>X("ModeMsg", "daa520", "", "")call <SID>X("MoreMsg", "2e8b57", "", "")call <SID>X("NonText", "addbe7", "000000", "bold")call <SID>X("Question", "00ff7f", "", "")call <SID>X("Search", "f5deb3", "cd853f", "")call <SID>X("SpecialKey", "9acd32", "", "")call <SID>X("StatusLine", "c2bfa5", "000000", "reverse")call <SID>X("StatusLineNC", "c2bfa5", "7f7f7f", "reverse")call <SID>X("Title", "cd5c5c", "", "")call <SID>X("Visual", "6b8e23", "f0e68c", "reverse")"VisualNOScall <SID>X("WarningMsg", "fa8072", "", "")"WildMenu"Menu"Scrollbar"Tooltip" syntax highlighting groupscall <SID>X("Comment", "87ceeb", "", "")call <SID>X("Constant", "ffa0a0", "", "")call <SID>X("Identifier", "98fb98", "", "none")call <SID>X("Statement", "f0e68c", "", "bold")call <SID>X("PreProc", "cd5c5c", "", "")call <SID>X("Type", "bdb76b", "", "bold")call <SID>X("Special", "ffdead", "", "")"Underlinedcall <SID>X("Ignore", "666666", "", "")"Errorcall <SID>X("Todo", "ff4500", "eeee00", "")" delete functions {{{delf <SID>Xdelf <SID>rgbdelf <SID>colordelf <SID>rgb_colordelf <SID>rgb_leveldelf <SID>rgb_numberdelf <SID>grey_colordelf <SID>grey_leveldelf <SID>grey_number" }}}else" color terminal definitionshi SpecialKey ctermfg=darkgreenhi NonText cterm=bold ctermfg=darkbluehi Directory ctermfg=darkcyanhi ErrorMsg cterm=bold ctermfg=7 ctermbg=1hi IncSearch cterm=NONE ctermfg=yellow ctermbg=greenhi Search cterm=NONE ctermfg=grey ctermbg=bluehi MoreMsg ctermfg=darkgreenhi ModeMsg cterm=NONE ctermfg=brownhi LineNr ctermfg=3hi Question ctermfg=greenhi StatusLine cterm=bold,reversehi StatusLineNC cterm=reversehi VertSplit cterm=reversehi Title ctermfg=5hi Visual cterm=reversehi VisualNOS cterm=bold,underlinehi WarningMsg ctermfg=1hi WildMenu ctermfg=0 ctermbg=3hi Folded ctermfg=darkgrey ctermbg=NONEhi FoldColumn ctermfg=darkgrey ctermbg=NONEhi DiffAdd ctermbg=4hi DiffChange ctermbg=5hi DiffDelete cterm=bold ctermfg=4 ctermbg=6hi DiffText cterm=bold ctermbg=1hi Comment ctermfg=darkcyanhi Constant ctermfg=brownhi Special ctermfg=5hi Identifier ctermfg=6hi Statement ctermfg=3hi PreProc ctermfg=5hi Type ctermfg=2hi Underlined cterm=underline ctermfg=5hi Ignore ctermfg=darkgreyhi Error cterm=bold ctermfg=7 ctermbg=1endif" vim: set fdl=0 fdm=marker: