]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/colors/summerfruit256.vim
Add main tmuxp config
[rbdr/dotfiles] / vim / colors / summerfruit256.vim
1 " Vim color file
2 " Maintainer: Martin Baeuml <baeuml@gmail.com>
3 " Last Change: 2008-02-09
4 "
5 " This color file is a modification of the "summerfruit" color scheme by Armin Ronacher
6 " so that it can be used on 88- and 256-color xterms. The colors are translated
7 " using Henry So's programmatic approximation of gui colors from his "desert256"
8 " color scheme.
9 "
10 " I removed the "italic" option and the background color from
11 " comment-coloring because that looks odd on my console.
12 "
13 " The original "summerfruit" color scheme and "desert256" are available from vim.org.
14
15 set background=light
16 if version > 580
17 " no guarantees for version 5.8 and below, but this makes it stop
18 " complaining
19 hi clear
20 if exists("syntax_on")
21 syntax reset
22 endif
23 endif
24 let g:colors_name="summerfruit256"
25
26 if has("gui_running") || &t_Co == 88 || &t_Co == 256
27 " functions {{{
28 " returns an approximate grey index for the given grey level
29 fun <SID>grey_number(x)
30 if &t_Co == 88
31 if a:x < 23
32 return 0
33 elseif a:x < 69
34 return 1
35 elseif a:x < 103
36 return 2
37 elseif a:x < 127
38 return 3
39 elseif a:x < 150
40 return 4
41 elseif a:x < 173
42 return 5
43 elseif a:x < 196
44 return 6
45 elseif a:x < 219
46 return 7
47 elseif a:x < 243
48 return 8
49 else
50 return 9
51 endif
52 else
53 if a:x < 14
54 return 0
55 else
56 let l:n = (a:x - 8) / 10
57 let l:m = (a:x - 8) % 10
58 if l:m < 5
59 return l:n
60 else
61 return l:n + 1
62 endif
63 endif
64 endif
65 endfun
66
67 " returns the actual grey level represented by the grey index
68 fun <SID>grey_level(n)
69 if &t_Co == 88
70 if a:n == 0
71 return 0
72 elseif a:n == 1
73 return 46
74 elseif a:n == 2
75 return 92
76 elseif a:n == 3
77 return 115
78 elseif a:n == 4
79 return 139
80 elseif a:n == 5
81 return 162
82 elseif a:n == 6
83 return 185
84 elseif a:n == 7
85 return 208
86 elseif a:n == 8
87 return 231
88 else
89 return 255
90 endif
91 else
92 if a:n == 0
93 return 0
94 else
95 return 8 + (a:n * 10)
96 endif
97 endif
98 endfun
99
100 " returns the palette index for the given grey index
101 fun <SID>grey_color(n)
102 if &t_Co == 88
103 if a:n == 0
104 return 16
105 elseif a:n == 9
106 return 79
107 else
108 return 79 + a:n
109 endif
110 else
111 if a:n == 0
112 return 16
113 elseif a:n == 25
114 return 231
115 else
116 return 231 + a:n
117 endif
118 endif
119 endfun
120
121 " returns an approximate color index for the given color level
122 fun <SID>rgb_number(x)
123 if &t_Co == 88
124 if a:x < 69
125 return 0
126 elseif a:x < 172
127 return 1
128 elseif a:x < 230
129 return 2
130 else
131 return 3
132 endif
133 else
134 if a:x < 75
135 return 0
136 else
137 let l:n = (a:x - 55) / 40
138 let l:m = (a:x - 55) % 40
139 if l:m < 20
140 return l:n
141 else
142 return l:n + 1
143 endif
144 endif
145 endif
146 endfun
147
148 " returns the actual color level for the given color index
149 fun <SID>rgb_level(n)
150 if &t_Co == 88
151 if a:n == 0
152 return 0
153 elseif a:n == 1
154 return 139
155 elseif a:n == 2
156 return 205
157 else
158 return 255
159 endif
160 else
161 if a:n == 0
162 return 0
163 else
164 return 55 + (a:n * 40)
165 endif
166 endif
167 endfun
168
169 " returns the palette index for the given R/G/B color indices
170 fun <SID>rgb_color(x, y, z)
171 if &t_Co == 88
172 return 16 + (a:x * 16) + (a:y * 4) + a:z
173 else
174 return 16 + (a:x * 36) + (a:y * 6) + a:z
175 endif
176 endfun
177
178 " returns the palette index to approximate the given R/G/B color levels
179 fun <SID>color(r, g, b)
180 " get the closest grey
181 let l:gx = <SID>grey_number(a:r)
182 let l:gy = <SID>grey_number(a:g)
183 let l:gz = <SID>grey_number(a:b)
184
185 " get the closest color
186 let l:x = <SID>rgb_number(a:r)
187 let l:y = <SID>rgb_number(a:g)
188 let l:z = <SID>rgb_number(a:b)
189
190 if l:gx == l:gy && l:gy == l:gz
191 " there are two possibilities
192 let l:dgr = <SID>grey_level(l:gx) - a:r
193 let l:dgg = <SID>grey_level(l:gy) - a:g
194 let l:dgb = <SID>grey_level(l:gz) - a:b
195 let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
196 let l:dr = <SID>rgb_level(l:gx) - a:r
197 let l:dg = <SID>rgb_level(l:gy) - a:g
198 let l:db = <SID>rgb_level(l:gz) - a:b
199 let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
200 if l:dgrey < l:drgb
201 " use the grey
202 return <SID>grey_color(l:gx)
203 else
204 " use the color
205 return <SID>rgb_color(l:x, l:y, l:z)
206 endif
207 else
208 " only one possibility
209 return <SID>rgb_color(l:x, l:y, l:z)
210 endif
211 endfun
212
213 " returns the palette index to approximate the 'rrggbb' hex string
214 fun <SID>rgb(rgb)
215 let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
216 let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
217 let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
218
219 return <SID>color(l:r, l:g, l:b)
220 endfun
221
222 " sets the highlighting for the given group
223 fun <SID>X(group, fg, bg, attr)
224 if a:fg != ""
225 exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
226 endif
227 if a:bg != ""
228 exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
229 endif
230 if a:attr != ""
231 exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
232 endif
233 endfun
234 " }}}
235
236 " Global
237 call <SID>X("Normal", "000000", "ffffff", "")
238 call <SID>X("NonText", "438ec3", "b7dce8", "")
239
240 " Search
241 call <SID>X("Search", "800000", "ffae00", "")
242 call <SID>X("IncSearch", "800000", "ffae00", "")
243
244 " Interface Elements
245 call <SID>X("StatusLine", "ffffff", "43c464", "bold")
246 call <SID>X("StatusLineNC", "9bd4a9", "51b069", "")
247 call <SID>X("VertSplit", "3687a2", "3687a2", "")
248 call <SID>X("Folded", "3c78a2", "c3daea", "")
249 call <SID>X("IncSearch", "708090", "f0e68c", "")
250 call <SID>X("Pmenu", "ffffff", "cb2f27", "")
251 call <SID>X("SignColumn", "", "", "")
252 call <SID>X("CursorLine", "", "c0d9eb", "")
253 call <SID>X("LineNr", "eeeeee", "438ec3", "bold")
254 call <SID>X("MatchParen", "", "", "")
255
256 " Specials
257 call <SID>X("Todo", "e50808", "dbf3cd", "bold")
258 call <SID>X("Title", "000000", "", "")
259 call <SID>X("Special", "fd8900", "", "")
260
261 " Syntax Elements
262 call <SID>X("String", "0086d2", "", "")
263 call <SID>X("Constant", "0086d2", "", "")
264 call <SID>X("Number", "0086f7", "", "")
265 call <SID>X("Statement", "fb660a", "", "")
266 call <SID>X("Function", "ff0086", "", "")
267 call <SID>X("PreProc", "ff0007", "", "")
268 call <SID>X("Comment", "22a21f", "", "bold")
269 call <SID>X("Type", "70796b", "", "")
270 call <SID>X("Error", "ffffff", "d40000", "")
271 call <SID>X("Identifier", "ff0086", "", "")
272 call <SID>X("Label", "ff0086", "", "")
273
274 " Python Highlighting
275 call <SID>X("pythonCoding", "ff0086", "", "")
276 call <SID>X("pythonRun", "ff0086", "", "")
277 call <SID>X("pythonBuiltinObj", "2b6ba2", "", "")
278 call <SID>X("pythonBuiltinFunc", "2b6ba2", "", "")
279 call <SID>X("pythonException", "ee0000", "", "")
280 call <SID>X("pythonExClass", "66cd66", "", "")
281 call <SID>X("pythonSpaceError", "", "", "")
282 call <SID>X("pythonDocTest", "2f5f49", "", "")
283 call <SID>X("pythonDocTest2", "3b916a", "", "")
284 call <SID>X("pythonFunction", "ee0000", "", "")
285 call <SID>X("pythonClass", "ff0086", "", "")
286
287 " HTML Highlighting
288 call <SID>X("htmlTag", "00bdec", "", "")
289 call <SID>X("htmlEndTag", "00bdec", "", "")
290 call <SID>X("htmlSpecialTagName", "4aa04a", "", "")
291 call <SID>X("htmlTagName", "4aa04a", "", "")
292 call <SID>X("htmlTagN", "4aa04a", "", "")
293
294 " Jinja Highlighting
295 call <SID>X("jinjaTagBlock", "ff0007", "fbf4c7", "bold")
296 call <SID>X("jinjaVarBlock", "ff0007", "fbf4c7", "")
297 call <SID>X("jinjaString", "0086d2", "fbf4c7", "")
298 call <SID>X("jinjaNumber", "bf0945", "fbf4c7", "bold")
299 call <SID>X("jinjaStatement", "fb660a", "fbf4c7", "bold")
300 call <SID>X("jinjaComment", "008800", "002300", "italic")
301 call <SID>X("jinjaFilter", "ff0086", "fbf4c7", "")
302 call <SID>X("jinjaRaw", "aaaaaa", "fbf4c7", "")
303 call <SID>X("jinjaOperator", "ffffff", "fbf4c7", "")
304 call <SID>X("jinjaVariable", "92cd35", "fbf4c7", "")
305 call <SID>X("jinjaAttribute", "dd7700", "fbf4c7", "")
306 call <SID>X("jinjaSpecial", "008ffd", "fbf4c7", "")
307
308 " delete functions {{{
309 delf <SID>X
310 delf <SID>rgb
311 delf <SID>color
312 delf <SID>rgb_color
313 delf <SID>rgb_level
314 delf <SID>rgb_number
315 delf <SID>grey_color
316 delf <SID>grey_level
317 delf <SID>grey_number
318 " }}}
319 endif
320
321 " vim: set fdl=0 fdm=marker:
322