Mercurial > ec-dotfiles
comparison vendor/vim-packs/srcery-vim/autoload/clap/themes/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 |
comparison
equal
deleted
inserted
replaced
703:b7cd7465cc26 | 704:1e0f578f6752 |
---|---|
1 " Author: Birger J. Nordolum <contact+srcery@mindtooth.no> | |
2 | |
3 " Description: Clap theme based on the Srcery color scheme. The theme | |
4 " require some tweaks to make it work. If you plan on copying or | |
5 " building upon this code for your own colorscheme, make sure that you | |
6 " are aware of the additional tweaks for Srcery. | |
7 | |
8 | |
9 let s:save_cpo = &cpoptions | |
10 set cpoptions&vim | |
11 | |
12 | |
13 " Srcery Palette {{{ | |
14 | |
15 " Normal Colors | |
16 let s:black = srcery#helper#GetColor('SrceryBlack') | |
17 let s:red = srcery#helper#GetColor('SrceryRed') | |
18 let s:green = srcery#helper#GetColor('SrceryGreen') | |
19 let s:yellow = srcery#helper#GetColor('SrceryYellow') | |
20 let s:blue = srcery#helper#GetColor('SrceryBlue') | |
21 let s:magenta = srcery#helper#GetColor('SrceryMagenta') | |
22 let s:cyan = srcery#helper#GetColor('SrceryCyan') | |
23 let s:white = srcery#helper#GetColor('SrceryWhite') | |
24 | |
25 " Bright Colors | |
26 let s:bright_black = srcery#helper#GetColor('SrceryBrightBlack') | |
27 let s:bright_red = srcery#helper#GetColor('SrceryBrightRed') | |
28 let s:bright_green = srcery#helper#GetColor('SrceryBrightGreen') | |
29 let s:bright_yellow = srcery#helper#GetColor('SrceryBrightYellow') | |
30 let s:bright_blue = srcery#helper#GetColor('SrceryBrightBlue') | |
31 let s:bright_magenta = srcery#helper#GetColor('SrceryBrightMagenta') | |
32 let s:bright_cyan = srcery#helper#GetColor('SrceryBrightCyan') | |
33 let s:bright_white = srcery#helper#GetColor('SrceryBrightWhite') | |
34 | |
35 " Extra Colors | |
36 let s:orange = srcery#helper#GetColor('SrceryOrange') | |
37 let s:bright_orange = srcery#helper#GetColor('SrceryBrightOrange') | |
38 let s:hard_black = srcery#helper#GetColor('SrceryHardBlack') | |
39 let s:xgray1 = srcery#helper#GetColor('SrceryXgray1') | |
40 let s:xgray2 = srcery#helper#GetColor('SrceryXgray2') | |
41 let s:xgray3 = srcery#helper#GetColor('SrceryXgray3') | |
42 let s:xgray4 = srcery#helper#GetColor('SrceryXgray4') | |
43 let s:xgray5 = srcery#helper#GetColor('SrceryXgray5') | |
44 let s:xgray6 = srcery#helper#GetColor('SrceryXgray6') | |
45 | |
46 "}}} | |
47 " Srcery Tweaks {{{ | |
48 | |
49 " The following tweaks are done to make sure that the theme works | |
50 " properly. Because Srcery has a transparent background as an option, | |
51 " some additional actions were taken to ensure that the clap colors look | |
52 " right regardless of this setting. | |
53 | |
54 " We need to tweak both the SignColumn and ClapSymbol to set the colors | |
55 " correctly. When using the transparent option, we explicitly need to | |
56 " change the symbol color. | |
57 | |
58 " Save original SignColumn | |
59 let s:original_signcolumn_bg_color = srcery#helper#GetColor('SignColumn', 'bg') | |
60 | |
61 | |
62 " We use an augroup to load/unload tweaks needed for the theme. Clap | |
63 " includes some triggers that we can hook onto. | |
64 | |
65 function! ClapSrceryLoad() abort | |
66 " Set column color to NONE so that clap can control this. | |
67 " Note! This changes also the normal SignColumn color of the | |
68 " main window. Might result in unexpected changes. | |
69 highlight SignColumn ctermbg=NONE guibg=NONE | |
70 | |
71 " Only execute the color change when the variable | |
72 " `g:srcery_transparent_background` set to 1. This is for | |
73 " making the rounded corners display correctly. Clap read the | |
74 " `Normal` highlight color, but in this case it's not enough, | |
75 " and hence the explicit change. | |
76 if exists('g:srcery_transparent_background') | |
77 let l:clap_symbol_style = 'ctermbg=' .s:black[1]. ' guibg=' .s:black[0] | |
78 | |
79 execute 'highlight ClapSymbol ' . l:clap_symbol_style | |
80 endif | |
81 endfunction | |
82 | |
83 function! ClapSrceryUnload() abort | |
84 " Revert the change made to SignColumn.. | |
85 let l:signcolumn = 'ctermbg=' . | |
86 \ (s:original_signcolumn_bg_color[1] ? s:original_signcolumn_bg_color[1] : 'NONE') . | |
87 \' guibg=' . | |
88 \ (s:original_signcolumn_bg_color[0] ? s:original_signcolumn_bg_color[0] : 'NONE') | |
89 | |
90 execute 'highlight SignColumn ' . l:signcolumn | |
91 endfunction | |
92 | |
93 augroup ClapSrcery | |
94 autocmd! | |
95 | |
96 autocmd User ClapOnEnter call ClapSrceryLoad() | |
97 autocmd User ClapOnExit call ClapSrceryUnload() | |
98 augroup END | |
99 | |
100 " }}} | |
101 " Clap Theme {{{ | |
102 | |
103 " The tweaks below is copied from the upstream code, but tweaked to use | |
104 " Srcery's colors. | |
105 " Upstream: https://github.com/liuchengxu/vim-clap/blob/master/autoload/clap/themes/material_design_dark.vim | |
106 | |
107 let s:palette = {} | |
108 | |
109 let s:palette.display = { 'ctermbg': s:xgray2[1], 'guibg': s:xgray2[0], 'ctermfg': 'NONE', } | |
110 | |
111 " Let ClapInput, ClapSpinner and ClapSearchText use the same backgound. | |
112 let s:bg0 = { 'ctermbg': s:xgray5[1], 'guibg': s:xgray5[0] } | |
113 let s:palette.input = s:bg0 | |
114 let s:palette.spinner = extend({ 'ctermfg': s:bright_orange[1], 'guifg': s:bright_orange[0], 'cterm': 'bold', 'gui': 'bold'}, s:bg0) | |
115 let s:palette.search_text = extend({ 'ctermfg': s:bright_white[1], 'guifg': s:bright_white[0], 'cterm': 'bold', 'gui': 'bold' }, s:bg0) | |
116 | |
117 let s:palette.preview = { 'ctermbg': s:xgray4[1], 'guibg': s:xgray4[0] } | |
118 | |
119 let s:palette.current_selection = { 'ctermbg': s:xgray3[1], 'guibg': s:xgray3[0], 'cterm': 'bold', 'gui': 'bold' } | |
120 let s:palette.current_selection_sign = { 'ctermfg': s:red[1], 'guifg': s:red[0], 'ctermbg': s:xgray3[1], 'guibg': s:xgray3[0]} | |
121 | |
122 let s:palette.selected = { 'ctermfg': 'NONE', 'guifg': s:bright_blue[0], 'ctermbg': s:xgray3[1], 'guibg': s:xgray3[0] } | |
123 let s:palette.selected_sign = { 'ctermfg': s:green[1], 'guifg': s:green[0], 'ctermbg': s:xgray3[1], 'guibg': s:xgray3[0] } | |
124 | |
125 let g:clap#themes#srcery#palette = s:palette | |
126 | |
127 " }}} | |
128 | |
129 | |
130 let &cpoptions = s:save_cpo | |
131 unlet s:save_cpo |