annotate vendor/vim-packs/srcery-vim/autoload/clap/themes/srcery.vim @ 726:78469331407e

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