]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vim/colors/jellybeans.vim
Add install script
[rbdr/dotfiles] / vim / colors / jellybeans.vim
... / ...
CommitLineData
1" Vim color file
2"
3" " __ _ _ _ "
4" " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ "
5" " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| "
6" " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ "
7" " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ "
8" " \___/ "
9"
10" "A colorful, dark color scheme for Vim."
11"
12" File: jellybeans.vim
13" Maintainer: NanoTech <http://nanotech.nanotechcorp.net/>
14" Version: 1.5
15" Last Change: January 15th, 2012
16" Contributors: Daniel Herbert <http://pocket-ninja.com/>,
17" Henry So, Jr. <henryso@panix.com>,
18" David Liang <bmdavll at gmail dot com>,
19" Rich Healey (richoH),
20" Andrew Wong (w0ng)
21"
22" Copyright (c) 2009-2012 NanoTech
23"
24" Permission is hereby granted, free of charge, to any person obtaining a copy
25" of this software and associated documentation files (the "Software"), to deal
26" in the Software without restriction, including without limitation the rights
27" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28" copies of the Software, and to permit persons to whom the Software is
29" furnished to do so, subject to the following conditions:
30"
31" The above copyright notice and this permission notice shall be included in
32" all copies or substantial portions of the Software.
33"
34" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40" THE SOFTWARE.
41
42set background=dark
43
44hi clear
45
46if exists("syntax_on")
47 syntax reset
48endif
49
50let colors_name = "jellybeans"
51
52if has("gui_running") || &t_Co == 88 || &t_Co == 256
53 let s:low_color = 0
54else
55 let s:low_color = 1
56endif
57
58" Color approximation functions by Henry So, Jr. and David Liang {{{
59" Added to jellybeans.vim by Daniel Herbert
60
61" returns an approximate grey index for the given grey level
62fun! s:grey_number(x)
63 if &t_Co == 88
64 if a:x < 23
65 return 0
66 elseif a:x < 69
67 return 1
68 elseif a:x < 103
69 return 2
70 elseif a:x < 127
71 return 3
72 elseif a:x < 150
73 return 4
74 elseif a:x < 173
75 return 5
76 elseif a:x < 196
77 return 6
78 elseif a:x < 219
79 return 7
80 elseif a:x < 243
81 return 8
82 else
83 return 9
84 endif
85 else
86 if a:x < 14
87 return 0
88 else
89 let l:n = (a:x - 8) / 10
90 let l:m = (a:x - 8) % 10
91 if l:m < 5
92 return l:n
93 else
94 return l:n + 1
95 endif
96 endif
97 endif
98endfun
99
100" returns the actual grey level represented by the grey index
101fun! s:grey_level(n)
102 if &t_Co == 88
103 if a:n == 0
104 return 0
105 elseif a:n == 1
106 return 46
107 elseif a:n == 2
108 return 92
109 elseif a:n == 3
110 return 115
111 elseif a:n == 4
112 return 139
113 elseif a:n == 5
114 return 162
115 elseif a:n == 6
116 return 185
117 elseif a:n == 7
118 return 208
119 elseif a:n == 8
120 return 231
121 else
122 return 255
123 endif
124 else
125 if a:n == 0
126 return 0
127 else
128 return 8 + (a:n * 10)
129 endif
130 endif
131endfun
132
133" returns the palette index for the given grey index
134fun! s:grey_color(n)
135 if &t_Co == 88
136 if a:n == 0
137 return 16
138 elseif a:n == 9
139 return 79
140 else
141 return 79 + a:n
142 endif
143 else
144 if a:n == 0
145 return 16
146 elseif a:n == 25
147 return 231
148 else
149 return 231 + a:n
150 endif
151 endif
152endfun
153
154" returns an approximate color index for the given color level
155fun! s:rgb_number(x)
156 if &t_Co == 88
157 if a:x < 69
158 return 0
159 elseif a:x < 172
160 return 1
161 elseif a:x < 230
162 return 2
163 else
164 return 3
165 endif
166 else
167 if a:x < 75
168 return 0
169 else
170 let l:n = (a:x - 55) / 40
171 let l:m = (a:x - 55) % 40
172 if l:m < 20
173 return l:n
174 else
175 return l:n + 1
176 endif
177 endif
178 endif
179endfun
180
181" returns the actual color level for the given color index
182fun! s:rgb_level(n)
183 if &t_Co == 88
184 if a:n == 0
185 return 0
186 elseif a:n == 1
187 return 139
188 elseif a:n == 2
189 return 205
190 else
191 return 255
192 endif
193 else
194 if a:n == 0
195 return 0
196 else
197 return 55 + (a:n * 40)
198 endif
199 endif
200endfun
201
202" returns the palette index for the given R/G/B color indices
203fun! s:rgb_color(x, y, z)
204 if &t_Co == 88
205 return 16 + (a:x * 16) + (a:y * 4) + a:z
206 else
207 return 16 + (a:x * 36) + (a:y * 6) + a:z
208 endif
209endfun
210
211" returns the palette index to approximate the given R/G/B color levels
212fun! s:color(r, g, b)
213 " get the closest grey
214 let l:gx = s:grey_number(a:r)
215 let l:gy = s:grey_number(a:g)
216 let l:gz = s:grey_number(a:b)
217
218 " get the closest color
219 let l:x = s:rgb_number(a:r)
220 let l:y = s:rgb_number(a:g)
221 let l:z = s:rgb_number(a:b)
222
223 if l:gx == l:gy && l:gy == l:gz
224 " there are two possibilities
225 let l:dgr = s:grey_level(l:gx) - a:r
226 let l:dgg = s:grey_level(l:gy) - a:g
227 let l:dgb = s:grey_level(l:gz) - a:b
228 let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
229 let l:dr = s:rgb_level(l:gx) - a:r
230 let l:dg = s:rgb_level(l:gy) - a:g
231 let l:db = s:rgb_level(l:gz) - a:b
232 let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
233 if l:dgrey < l:drgb
234 " use the grey
235 return s:grey_color(l:gx)
236 else
237 " use the color
238 return s:rgb_color(l:x, l:y, l:z)
239 endif
240 else
241 " only one possibility
242 return s:rgb_color(l:x, l:y, l:z)
243 endif
244endfun
245
246" returns the palette index to approximate the 'rrggbb' hex string
247fun! s:rgb(rgb)
248 let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
249 let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
250 let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
251 return s:color(l:r, l:g, l:b)
252endfun
253
254" sets the highlighting for the given group
255fun! s:X(group, fg, bg, attr, lcfg, lcbg)
256 if s:low_color
257 let l:fge = empty(a:lcfg)
258 let l:bge = empty(a:lcbg)
259
260 if !l:fge && !l:bge
261 exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=".a:lcbg
262 elseif !l:fge && l:bge
263 exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=NONE"
264 elseif l:fge && !l:bge
265 exec "hi ".a:group." ctermfg=NONE ctermbg=".a:lcbg
266 endif
267 else
268 let l:fge = empty(a:fg)
269 let l:bge = empty(a:bg)
270
271 if !l:fge && !l:bge
272 exec "hi ".a:group." guifg=#".a:fg." guibg=#".a:bg." ctermfg=".s:rgb(a:fg)." ctermbg=".s:rgb(a:bg)
273 elseif !l:fge && l:bge
274 exec "hi ".a:group." guifg=#".a:fg." guibg=NONE ctermfg=".s:rgb(a:fg)." ctermbg=NONE"
275 elseif l:fge && !l:bge
276 exec "hi ".a:group." guifg=NONE guibg=#".a:bg." ctermfg=NONE ctermbg=".s:rgb(a:bg)
277 endif
278 endif
279
280 if a:attr == ""
281 exec "hi ".a:group." gui=none cterm=none"
282 else
283 let noitalic = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",")
284 if empty(noitalic)
285 let noitalic = "none"
286 endif
287 exec "hi ".a:group." gui=".a:attr." cterm=".noitalic
288 endif
289endfun
290" }}}
291
292call s:X("Normal","e8e8d3","151515","","White","")
293set background=dark
294
295if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black
296 let s:termBlack = "Black"
297else
298 let s:termBlack = "Grey"
299endif
300
301if version >= 700
302 call s:X("CursorLine","","1c1c1c","","",s:termBlack)
303 call s:X("CursorColumn","","1c1c1c","","",s:termBlack)
304 call s:X("MatchParen","ffffff","80a090","bold","","DarkCyan")
305
306 call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack)
307 call s:X("TabLineFill","9098a0","","","",s:termBlack)
308 call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White")
309
310 " Auto-completion
311 call s:X("Pmenu","ffffff","606060","","White",s:termBlack)
312 call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White")
313endif
314
315call s:X("Visual","","404040","","",s:termBlack)
316call s:X("Cursor","","b0d0f0","","","")
317
318call s:X("LineNr","605958","151515","none",s:termBlack,"")
319call s:X("Comment","888888","","italic","Grey","")
320call s:X("Todo","808080","","bold","White",s:termBlack)
321
322call s:X("StatusLine","000000","dddddd","italic","","White")
323call s:X("StatusLineNC","ffffff","403c41","italic","White","Black")
324call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack)
325call s:X("WildMenu","f0a0c0","302028","","Magenta","")
326
327call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"")
328call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack)
329call s:X("SignColumn","777777","333333","","",s:termBlack)
330call s:X("ColorColumn","","000000","","",s:termBlack)
331
332call s:X("Title","70b950","","bold","Green","")
333
334call s:X("Constant","cf6a4c","","","Red","")
335call s:X("Special","799d6a","","","Green","")
336call s:X("Delimiter","668799","","","Grey","")
337
338call s:X("String","99ad6a","","","Green","")
339call s:X("StringDelimiter","556633","","","DarkGreen","")
340
341call s:X("Identifier","c6b6ee","","","LightCyan","")
342call s:X("Structure","8fbfdc","","","LightCyan","")
343call s:X("Function","fad07a","","","Yellow","")
344call s:X("Statement","8197bf","","","DarkBlue","")
345call s:X("PreProc","8fbfdc","","","LightBlue","")
346
347hi! link Operator Normal
348
349call s:X("Type","ffb964","","","Yellow","")
350call s:X("NonText","606060","151515","",s:termBlack,"")
351
352call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"")
353
354call s:X("Search","f0a0c0","302028","underline","Magenta","")
355
356call s:X("Directory","dad085","","","Yellow","")
357call s:X("ErrorMsg","","902020","","","DarkRed")
358hi! link Error ErrorMsg
359hi! link MoreMsg Special
360call s:X("Question","65C254","","","Green","")
361
362
363" Spell Checking
364
365call s:X("SpellBad","","902020","underline","","DarkRed")
366call s:X("SpellCap","","0000df","underline","","Blue")
367call s:X("SpellRare","","540063","underline","","DarkMagenta")
368call s:X("SpellLocal","","2D7067","underline","","Green")
369
370" Diff
371
372hi! link diffRemoved Constant
373hi! link diffAdded String
374
375" VimDiff
376
377call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen")
378call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed")
379call s:X("DiffChange","","2B5B77","","White","DarkBlue")
380call s:X("DiffText","8fbfdc","000000","reverse","Yellow","")
381
382" PHP
383
384hi! link phpFunctions Function
385call s:X("StorageClass","c59f6f","","","Red","")
386hi! link phpSuperglobal Identifier
387hi! link phpQuoteSingle StringDelimiter
388hi! link phpQuoteDouble StringDelimiter
389hi! link phpBoolean Constant
390hi! link phpNull Constant
391hi! link phpArrayPair Operator
392
393" Ruby
394
395hi! link rubySharpBang Comment
396call s:X("rubyClass","447799","","","DarkBlue","")
397call s:X("rubyIdentifier","c6b6fe","","","Cyan","")
398hi! link rubyConstant Type
399hi! link rubyFunction Function
400
401call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","")
402call s:X("rubySymbol","7697d6","","","Blue","")
403hi! link rubyGlobalVariable rubyInstanceVariable
404hi! link rubyModule rubyClass
405call s:X("rubyControl","7597c6","","","Blue","")
406
407hi! link rubyString String
408hi! link rubyStringDelimiter StringDelimiter
409hi! link rubyInterpolationDelimiter Identifier
410
411call s:X("rubyRegexpDelimiter","540063","","","Magenta","")
412call s:X("rubyRegexp","dd0093","","","DarkMagenta","")
413call s:X("rubyRegexpSpecial","a40073","","","Magenta","")
414
415call s:X("rubyPredefinedIdentifier","de5577","","","Red","")
416
417" JavaScript
418
419hi! link javaScriptValue Constant
420hi! link javaScriptRegexpString rubyRegexp
421
422" CoffeeScript
423
424hi! link coffeeRegExp javaScriptRegexpString
425
426" Lua
427
428hi! link luaOperator Conditional
429
430" C
431
432hi! link cOperator Constant
433
434" Objective-C/Cocoa
435
436hi! link objcClass Type
437hi! link cocoaClass objcClass
438hi! link objcSubclass objcClass
439hi! link objcSuperclass objcClass
440hi! link objcDirective rubyClass
441hi! link objcStatement Constant
442hi! link cocoaFunction Function
443hi! link objcMethodName Identifier
444hi! link objcMethodArg Normal
445hi! link objcMessageName Identifier
446
447" Debugger.vim
448
449call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue")
450call s:X("DbgBreakPt","","4F0037","","","DarkMagenta")
451
452" vim-indent-guides
453
454if !exists("g:indent_guides_auto_colors")
455 let g:indent_guides_auto_colors = 0
456endif
457call s:X("IndentGuidesOdd","","202020","","","")
458call s:X("IndentGuidesEven","","1c1c1c","","","")
459
460" Plugins, etc.
461
462hi! link TagListFileName Directory
463call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green")
464
465" Manual overrides for 256-color terminals. Dark colors auto-map badly.
466if !s:low_color
467 hi StatusLineNC ctermbg=235
468 hi Folded ctermbg=236
469 hi FoldColumn ctermbg=234
470 hi SignColumn ctermbg=236
471 hi CursorColumn ctermbg=234
472 hi CursorLine ctermbg=234
473 hi SpecialKey ctermbg=234
474 hi NonText ctermbg=233
475 hi LineNr ctermbg=233
476 hi DiffText ctermfg=81
477 hi Normal ctermbg=233
478 hi DbgBreakPt ctermbg=53
479endif
480
481" delete functions {{{
482delf s:X
483delf s:rgb
484delf s:color
485delf s:rgb_color
486delf s:rgb_level
487delf s:rgb_number
488delf s:grey_color
489delf s:grey_level
490delf s:grey_number
491" }}}