comparison vendor/vim-packs/srcery-vim/colors/srcery.vim @ 704:1e0f578f6752

Update vendor and add support for vim packs
author nanaya <me@nanaya.net>
date Sun, 18 Dec 2022 20:06:46 +0900
parents
children 78469331407e
comparison
equal deleted inserted replaced
703:b7cd7465cc26 704:1e0f578f6752
1 " 'srcery.vim' -- Vim color scheme.
2 " Maintainer: Roosta (mail@roosta.sh)
3 " Description: Colorscheme that focus ease of use and clearly defined contrasting colors with a slightly earthy tone.
4 " Original Source: https://github.com/morhetz/gruvbox
5
6 scriptencoding utf-8
7
8 set background=dark
9
10 if v:version > 580
11 hi clear
12 if exists('syntax_on')
13 syntax reset
14 endif
15 endif
16
17 let g:colors_name='srcery'
18
19 if !has('gui_running') && &t_Co != 256
20 finish
21 endif
22
23 " Palette {{{
24
25 let s:none = g:srcery#palette.none
26
27 " 16 base colors
28 let s:black = g:srcery#palette.black
29 let s:red = g:srcery#palette.red
30 let s:green = g:srcery#palette.green
31 let s:yellow = g:srcery#palette.yellow
32 let s:blue = g:srcery#palette.blue
33 let s:magenta = g:srcery#palette.magenta
34 let s:cyan = g:srcery#palette.cyan
35 let s:white = g:srcery#palette.white
36 let s:bright_black = g:srcery#palette.bright_black
37 let s:bright_red = g:srcery#palette.bright_red
38 let s:bright_green = g:srcery#palette.bright_green
39 let s:bright_yellow = g:srcery#palette.bright_yellow
40 let s:bright_blue = g:srcery#palette.bright_blue
41 let s:bright_magenta = g:srcery#palette.bright_magenta
42 let s:bright_cyan = g:srcery#palette.bright_cyan
43 let s:bright_white = g:srcery#palette.bright_white
44
45 " xterm colors
46 let s:orange = g:srcery#palette.orange
47 let s:bright_orange = g:srcery#palette.bright_orange
48 let s:hard_black = g:srcery#palette.hard_black
49 let s:xgray1 = g:srcery#palette.xgray1
50 let s:xgray2 = g:srcery#palette.xgray2
51 let s:xgray3 = g:srcery#palette.xgray3
52 let s:xgray4 = g:srcery#palette.xgray4
53 let s:xgray5 = g:srcery#palette.xgray5
54 let s:xgray6 = g:srcery#palette.xgray6
55
56 "}}}
57 " Setup Emphasis: {{{
58
59 let s:bold = g:srcery#palette.bold
60 let s:italic = g:srcery#palette.italic
61 let s:underline = g:srcery#palette.underline
62 let s:undercurl = g:srcery#palette.undercurl
63 let s:inverse = g:srcery#palette.inverse
64
65 " }}}
66
67 " Highlighting Function: {{{
68
69 function! s:HL(group, fg, ...)
70 " Arguments: group, guifg, guibg, gui, guisp
71
72 " foreground
73 let l:fg = a:fg
74
75 " background
76 if a:0 >= 1
77 let l:bg = a:1
78 else
79 let l:bg = s:none
80 endif
81
82 " emphasis
83 if a:0 >= 2 && strlen(a:2)
84 let l:emstr = a:2
85 else
86 let l:emstr = 'NONE,'
87 endif
88
89 " special fallback
90 if a:0 >= 3
91 if g:srcery_guisp_fallback !=# 'NONE'
92 let fg = a:3
93 endif
94
95 " bg fallback mode should invert higlighting
96 if g:srcery_guisp_fallback ==# 'bg'
97 let emstr .= 'inverse,'
98 endif
99 endif
100
101 let l:histring = [ 'hi', a:group,
102 \ 'guifg=' . l:fg[0], 'ctermfg=' . l:fg[1],
103 \ 'guibg=' . l:bg[0], 'ctermbg=' . l:bg[1],
104 \ 'gui=' . l:emstr[:-2], 'cterm=' . l:emstr[:-2]
105 \ ]
106
107 " special
108 if a:0 >= 3
109 call add(l:histring, 'guisp=' . a:3[0])
110 endif
111
112 execute join(l:histring, ' ')
113 endfunction
114
115 "}}}
116 " Srcery Hi Groups: {{{
117
118 " memoize common hi groups
119 call s:HL('SrceryRed', s:red)
120 call s:HL('SrceryGreen', s:green)
121 call s:HL('SrceryYellow', s:yellow)
122 call s:HL('SrceryBlue', s:blue)
123 call s:HL('SrceryMagenta', s:magenta)
124 call s:HL('SrceryCyan', s:cyan)
125 call s:HL('SrceryBlack', s:black)
126 call s:HL('SrceryWhite', s:white)
127
128 call s:HL('SrceryRedBold', s:red, s:none, s:bold)
129 call s:HL('SrceryGreenBold', s:green, s:none, s:bold)
130 call s:HL('SrceryYellowBold', s:yellow, s:none, s:bold)
131 call s:HL('SrceryBlueBold', s:blue, s:none, s:bold)
132 call s:HL('SrceryMagentaBold', s:magenta, s:none, s:bold)
133 call s:HL('SrceryCyanBold', s:cyan, s:none, s:bold)
134 call s:HL('SrceryBlackBold', s:black, s:none, s:bold)
135 call s:HL('SrceryWhiteBold', s:white, s:none, s:bold)
136
137 call s:HL('SrceryBrightRed', s:bright_red, s:none)
138 call s:HL('SrceryBrightGreen', s:bright_green, s:none)
139 call s:HL('SrceryBrightYellow', s:bright_yellow, s:none)
140 call s:HL('SrceryBrightBlue', s:bright_blue, s:none)
141 call s:HL('SrceryBrightMagenta', s:bright_magenta, s:none)
142 call s:HL('SrceryBrightCyan', s:bright_cyan, s:none)
143 call s:HL('SrceryBrightBlack', s:bright_black, s:none)
144 call s:HL('SrceryBrightWhite', s:bright_white)
145
146 call s:HL('SrceryBrightRedBold', s:bright_red, s:none, s:bold)
147 call s:HL('SrceryBrightGreenBold', s:bright_green, s:none, s:bold)
148 call s:HL('SrceryBrightYellowBold', s:bright_yellow, s:none, s:bold)
149 call s:HL('SrceryBrightBlueBold', s:bright_blue, s:none, s:bold)
150 call s:HL('SrceryBrightMagentaBold', s:bright_magenta, s:none, s:bold)
151 call s:HL('SrceryBrightCyanBold', s:bright_cyan, s:none, s:bold)
152 call s:HL('SrceryBrightBlackBold', s:bright_black, s:none, s:bold)
153 call s:HL('SrceryBrightWhiteBold', s:bright_white, s:none, s:bold)
154
155 " special
156 call s:HL('SrceryOrange', s:orange)
157 call s:HL('SrceryBrightOrange', s:bright_orange)
158 call s:HL('SrceryOrangeBold', s:orange, s:none, s:bold)
159 call s:HL('SrceryHardBlack', s:hard_black)
160 call s:HL('SrceryXgray1', s:xgray1)
161 call s:HL('SrceryXgray2', s:xgray2)
162 call s:HL('SrceryXgray3', s:xgray3)
163 call s:HL('SrceryXgray4', s:xgray4)
164 call s:HL('SrceryXgray5', s:xgray5)
165 call s:HL('SrceryXgray6', s:xgray6)
166
167 " }}}
168
169 " Vanilla colorscheme ---------------------------------------------------------
170 " General UI: {{{
171
172 " Normal text
173 "
174 if g:srcery_bg_passthrough == 1 && !has('gui_running')
175 call s:HL('Normal', s:bright_white, s:none)
176 else
177 call s:HL('Normal', s:bright_white, s:black)
178 endif
179
180 if v:version >= 700
181 " Screen line that the cursor is
182 call s:HL('CursorLine', s:none, s:xgray2)
183 " Screen column that the cursor is
184 hi! link CursorColumn CursorLine
185
186 call s:HL('TabLineFill', s:bright_black, s:xgray2)
187 call s:HL('TabLineSel', s:bright_white, s:xgray5)
188
189 " Not active tab page label
190 hi! link TabLine TabLineFill
191
192 " Match paired bracket under the cursor
193 "
194 if g:srcery_inverse_match_paren == 1
195 call s:HL('MatchParen', s:bright_magenta, s:none, s:inverse . s:bold)
196 else
197 call s:HL('MatchParen', s:bright_magenta, s:none, s:bold)
198 endif
199 endif
200
201 if v:version >= 703
202 " Highlighted screen columns
203 call s:HL('ColorColumn', s:none, s:xgray2)
204
205 " Concealed element: \lambda → λ
206 call s:HL('Conceal', s:blue, s:none)
207
208 " Line number of CursorLine
209 if g:srcery_bg_passthrough == 1 && !has('gui_running')
210 call s:HL('CursorLineNr', s:yellow, s:none)
211 else
212 call s:HL('CursorLineNr', s:yellow, s:black)
213 endif
214
215 endif
216
217 hi! link NonText SrceryXgray4
218 hi! link SpecialKey SrceryBlue
219
220 if g:srcery_inverse == 1
221 call s:HL('Visual', s:none, s:none, s:inverse)
222 else
223 call s:HL('Visual', s:none, s:xgray2, s:bold)
224 endif
225
226 hi! link VisualNOS Visual
227
228 if g:srcery_inverse == 1 && g:srcery_inverse_matches == 1
229 call s:HL('Search', s:none, s:none, s:inverse)
230 call s:HL('IncSearch', s:none, s:none, s:inverse)
231 else
232 call s:HL('Search', s:none, s:xgray5, s:bold)
233 call s:HL('IncSearch', s:none, s:xgray5, s:underline . s:bold)
234 endif
235
236 call s:HL('Underlined', s:blue, s:none, s:underline)
237
238 call s:HL('StatusLine', s:bright_white, s:xgray2)
239
240 if g:srcery_bg_passthrough == 1 && !has('gui_running')
241 call s:HL('StatusLineNC', s:bright_black, s:none, s:underline)
242
243 " The column separating vertically split windows
244 call s:HL('VertSplit', s:bright_white, s:none)
245
246 " Current match in wildmenu completion
247 call s:HL('WildMenu', s:blue, s:none, s:bold)
248 else
249 call s:HL('StatusLineNC', s:bright_black, s:black, s:underline)
250 call s:HL('VertSplit', s:bright_white, s:black)
251 call s:HL('WildMenu', s:blue, s:black, s:bold)
252 endif
253
254 " Directory names, special names in listing
255 hi! link Directory SrceryGreenBold
256
257 " Titles for output from :set all, :autocmd, etc.
258 hi! link Title SrceryGreenBold
259
260 " Error messages on the command line
261 call s:HL('ErrorMsg', s:bright_white, s:red)
262 " More prompt: -- More --
263 hi! link MoreMsg SrceryYellowBold
264 " Current mode message: -- INSERT --
265 hi! link ModeMsg SrceryYellowBold
266 " 'Press enter' prompt and yes/no questions
267 hi! link Question SrceryOrangeBold
268 " Warning messages
269 hi! link WarningMsg SrceryRedBold
270
271 " }}}
272 " Gutter: {{{
273
274 " Line number for :number and :# commands
275 call s:HL('LineNr', s:bright_black)
276
277 if g:srcery_bg_passthrough == 1 && !has('gui_running')
278 " Column where signs are displayed
279 " TODO Possibly need to fix SignColumn
280 call s:HL('SignColumn', s:none, s:none)
281 " Line used for closed folds
282 call s:HL('Folded', s:bright_black, s:none, s:italic)
283 " Column where folds are displayed
284 call s:HL('FoldColumn', s:bright_black, s:none)
285 else
286 call s:HL('SignColumn', s:none, s:black)
287 call s:HL('Folded', s:bright_black, s:black, s:italic)
288 call s:HL('FoldColumn', s:bright_black, s:black)
289 endif
290
291 " }}}
292 " Cursor: {{{
293
294 " Character under cursor
295 call s:HL('Cursor', s:black, s:yellow)
296 " Visual mode cursor, selection
297 hi! link vCursor Cursor
298 " Input moder cursor
299 hi! link iCursor Cursor
300 " Language mapping cursor
301 hi! link lCursor Cursor
302
303 " }}}
304 " Syntax Highlighting: {{{
305
306 hi! link Special SrceryOrange
307
308 call s:HL('Comment', s:bright_black, s:none, s:italic)
309
310 if g:srcery_bg_passthrough == 1 && !has('gui_running')
311 call s:HL('Todo', s:bright_white, s:none, s:bold . s:italic)
312 else
313 call s:HL('Todo', s:bright_white, s:black, s:bold . s:italic)
314 endif
315
316 call s:HL('Error', s:bright_white, s:red, s:bold)
317
318 " String constant: "this is a string"
319 call s:HL('String', s:bright_green)
320
321 " Generic statement
322 hi! link Statement SrceryRed
323 " if, then, else, endif, swicth, etc.
324 hi! link Conditional SrceryRed
325 " for, do, while, etc.
326 hi! link Repeat SrceryRed
327 " case, default, etc.
328 hi! link Label SrceryRed
329 " try, catch, throw
330 hi! link Exception SrceryRed
331 " sizeof, "+", "*", etc.
332 hi! link Operator Normal
333 " Any other keyword
334 hi! link Keyword SrceryRed
335
336 " Variable name
337 hi! link Identifier SrceryCyan
338 " Function name
339 hi! link Function SrceryYellow
340
341 " Generic preprocessor
342 hi! link PreProc SrceryCyan
343 " Preprocessor #include
344 hi! link Include SrceryCyan
345 " Preprocessor #define
346 hi! link Define SrceryCyan
347 " Same as Define
348 hi! link Macro SrceryOrange
349 " Preprocessor #if, #else, #endif, etc.
350 hi! link PreCondit SrceryCyan
351
352 " Generic constant
353 hi! link Constant SrceryBrightMagenta
354 " Character constant: 'c', '/n'
355 hi! link Character SrceryBrightMagenta
356 " Boolean constant: TRUE, false
357 hi! link Boolean SrceryBrightMagenta
358 " Number constant: 234, 0xff
359 hi! link Number SrceryBrightMagenta
360 " Floating point constant: 2.3e10
361 hi! link Float SrceryBrightMagenta
362
363 " Generic type
364 if g:srcery_italic_types == 1 && g:srcery_italic == 1
365 call s:HL('Type', s:bright_blue, s:none, s:italic)
366 else
367 hi! link Type SrceryBrightBlue
368 end
369 " static, register, volatile, etc
370 hi! link StorageClass SrceryOrange
371 " struct, union, enum, etc.
372 hi! link Structure SrceryCyan
373 " typedef
374 hi! link Typedef SrceryMagenta
375
376 if g:srcery_dim_lisp_paren == 1
377 hi! link Delimiter SrceryXgray6
378 else
379 hi! link Delimiter SrceryBrightBlack
380 endif
381
382 " }}}
383 " Completion Menu: {{{
384
385 if v:version >= 700
386 " Popup menu: normal item
387 call s:HL('Pmenu', s:bright_white, s:xgray2)
388 " Popup menu: selected item
389 call s:HL('PmenuSel', s:bright_white, s:blue, s:bold)
390
391 if g:srcery_bg_passthrough == 1 && !has('gui_running')
392 " Popup menu: scrollbar
393 call s:HL('PmenuSbar', s:none, s:none)
394 " Popup menu: scrollbar thumb
395 call s:HL('PmenuThumb', s:none, s:none)
396 else
397 call s:HL('PmenuSbar', s:none, s:black)
398 call s:HL('PmenuThumb', s:none, s:black)
399 endif
400 endif
401
402 " }}}
403 " Diffs: {{{
404
405 if g:srcery_bg_passthrough == 1 && !has('gui_running')
406 call s:HL('DiffDelete', s:red, s:none)
407 call s:HL('DiffAdd', s:green, s:none)
408 call s:HL('DiffChange', s:cyan, s:none)
409 call s:HL('DiffText', s:yellow, s:none)
410 else
411 call s:HL('DiffDelete', s:red, s:black)
412 call s:HL('DiffAdd', s:green, s:black)
413 call s:HL('DiffChange', s:cyan, s:black)
414 call s:HL('DiffText', s:yellow, s:black)
415 endif
416
417 " }}}
418 " Spelling: {{{
419
420 if has('spell')
421 " Not capitalised word, or compile warnings
422 call s:HL('SpellCap', s:green, s:none, s:bold . s:italic)
423 " Not recognized word
424 call s:HL('SpellBad', s:none, s:none, s:undercurl, s:blue)
425 " Wrong spelling for selected region
426 call s:HL('SpellLocal', s:none, s:none, s:undercurl, s:cyan)
427 " Rare word
428 call s:HL('SpellRare', s:none, s:none, s:undercurl, s:magenta)
429 endif
430
431 " }}}
432 " Terminal: {{{
433
434 if g:srcery_hard_black_terminal_bg == 1 && has('terminal')
435 " Must set an explicit background as NONE won't work
436 " Therefore not useful with transparent background option
437 call s:HL('Terminal', s:bright_white, s:hard_black)
438 endif
439
440 " }}}
441
442 " Filetype specific -----------------------------------------------------------
443 " Diff: {{{
444
445 hi! link diffAdded SrceryGreen
446 hi! link diffRemoved SrceryRed
447 hi! link diffChanged SrceryCyan
448
449 hi! link diffFile SrceryOrange
450 hi! link diffNewFile SrceryYellow
451
452 hi! link diffLine SrceryBlue
453
454 " }}}
455 " Misc: {{{
456
457 call s:HL('ExtraWhitespace', s:none, s:red)
458 " }}}
459
460 " vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker :