ayu.vim 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. " Initialisation:"{{{
  2. " ----------------------------------------------------------------------------
  3. hi clear
  4. if exists("syntax_on")
  5. syntax reset
  6. endif
  7. let s:style = get(g:, 'ayucolor', 'dark')
  8. let g:colors_name = "ayu"
  9. "}}}
  10. " Palettes:"{{{
  11. " ----------------------------------------------------------------------------
  12. let s:palette = {}
  13. let s:palette.bg = {'dark': "#0F1419", 'light': "#FAFAFA", 'mirage': "#212733"}
  14. let s:palette.comment = {'dark': "#5C6773", 'light': "#ABB0B6", 'mirage': "#5C6773"}
  15. let s:palette.markup = {'dark': "#F07178", 'light': "#F07178", 'mirage': "#F07178"}
  16. let s:palette.constant = {'dark': "#FFEE99", 'light': "#A37ACC", 'mirage': "#D4BFFF"}
  17. let s:palette.operator = {'dark': "#E7C547", 'light': "#E7C547", 'mirage': "#80D4FF"}
  18. let s:palette.tag = {'dark': "#36A3D9", 'light': "#36A3D9", 'mirage': "#5CCFE6"}
  19. let s:palette.regexp = {'dark': "#95E6CB", 'light': "#4CBF99", 'mirage': "#95E6CB"}
  20. let s:palette.string = {'dark': "#B8CC52", 'light': "#86B300", 'mirage': "#BBE67E"}
  21. let s:palette.function = {'dark': "#FFB454", 'light': "#F29718", 'mirage': "#FFD57F"}
  22. let s:palette.special = {'dark': "#E6B673", 'light': "#E6B673", 'mirage': "#FFC44C"}
  23. let s:palette.keyword = {'dark': "#FF7733", 'light': "#FF7733", 'mirage': "#FFAE57"}
  24. let s:palette.error = {'dark': "#FF3333", 'light': "#FF3333", 'mirage': "#FF3333"}
  25. let s:palette.accent = {'dark': "#F29718", 'light': "#FF6A00", 'mirage': "#FFCC66"}
  26. let s:palette.panel = {'dark': "#14191F", 'light': "#FFFFFF", 'mirage': "#272D38"}
  27. let s:palette.guide = {'dark': "#2D3640", 'light': "#D9D8D7", 'mirage': "#3D4751"}
  28. let s:palette.line = {'dark': "#151A1E", 'light': "#F3F3F3", 'mirage': "#242B38"}
  29. let s:palette.selection = {'dark': "#253340", 'light': "#F0EEE4", 'mirage': "#343F4C"}
  30. let s:palette.fg = {'dark': "#E6E1CF", 'light': "#5C6773", 'mirage': "#D9D7CE"}
  31. let s:palette.fg_idle = {'dark': "#3E4B59", 'light': "#828C99", 'mirage': "#607080"}
  32. "}}}
  33. " Highlighting Primitives:"{{{
  34. " ----------------------------------------------------------------------------
  35. function! s:build_prim(hi_elem, field)
  36. let l:vname = "s:" . a:hi_elem . "_" . a:field " s:bg_gray
  37. let l:gui_assign = "gui".a:hi_elem."=".s:palette[a:field][s:style] " guibg=...
  38. exe "let " . l:vname . " = ' " . l:gui_assign . "'"
  39. endfunction
  40. let s:bg_none = ' guibg=NONE ctermbg=NONE'
  41. let s:fg_none = ' guifg=NONE ctermfg=NONE'
  42. for [key_name, d_value] in items(s:palette)
  43. call s:build_prim('bg', key_name)
  44. call s:build_prim('fg', key_name)
  45. endfor
  46. " }}}
  47. " Formatting Options:"{{{
  48. " ----------------------------------------------------------------------------
  49. let s:none = "NONE"
  50. let s:t_none = "NONE"
  51. let s:n = "NONE"
  52. let s:c = ",undercurl"
  53. let s:r = ",reverse"
  54. let s:s = ",standout"
  55. let s:b = ",bold"
  56. let s:u = ",underline"
  57. let s:i = ",italic"
  58. exe "let s:fmt_none = ' gui=NONE". " cterm=NONE". " term=NONE" ."'"
  59. exe "let s:fmt_bold = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'"
  60. exe "let s:fmt_bldi = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'"
  61. exe "let s:fmt_undr = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'"
  62. exe "let s:fmt_undb = ' gui=NONE".s:u.s:b. " cterm=NONE".s:u.s:b. " term=NONE".s:u.s:b."'"
  63. exe "let s:fmt_undi = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'"
  64. exe "let s:fmt_curl = ' gui=NONE".s:c. " cterm=NONE".s:c. " term=NONE".s:c ."'"
  65. exe "let s:fmt_ital = ' gui=NONE".s:i. " cterm=NONE".s:i. " term=NONE".s:i ."'"
  66. exe "let s:fmt_stnd = ' gui=NONE".s:s. " cterm=NONE".s:s. " term=NONE".s:s ."'"
  67. exe "let s:fmt_revr = ' gui=NONE".s:r. " cterm=NONE".s:r. " term=NONE".s:r ."'"
  68. exe "let s:fmt_revb = ' gui=NONE".s:r.s:b. " cterm=NONE".s:r.s:b. " term=NONE".s:r.s:b."'"
  69. "}}}
  70. " Vim Highlighting: (see :help highlight-groups)"{{{
  71. " ----------------------------------------------------------------------------
  72. exe "hi! Normal" .s:fg_fg .s:bg_bg .s:fmt_none
  73. exe "hi! ColorColumn" .s:fg_none .s:bg_line .s:fmt_none
  74. " Conceal, Cursor, CursorIM
  75. exe "hi! CursorColumn" .s:fg_none .s:bg_line .s:fmt_none
  76. exe "hi! CursorLine" .s:fg_none .s:bg_line .s:fmt_none
  77. exe "hi! CursorLineNr" .s:fg_accent .s:bg_line .s:fmt_none
  78. exe "hi! LineNr" .s:fg_guide .s:bg_none .s:fmt_none
  79. exe "hi! Directory" .s:fg_fg_idle .s:bg_none .s:fmt_none
  80. exe "hi! DiffAdd" .s:fg_string .s:bg_panel .s:fmt_none
  81. exe "hi! DiffChange" .s:fg_tag .s:bg_panel .s:fmt_none
  82. exe "hi! DiffText" .s:fg_fg .s:bg_panel .s:fmt_none
  83. exe "hi! ErrorMsg" .s:fg_fg .s:bg_error .s:fmt_stnd
  84. exe "hi! VertSplit" .s:fg_bg .s:bg_none .s:fmt_none
  85. exe "hi! Folded" .s:fg_fg_idle .s:bg_panel .s:fmt_none
  86. exe "hi! FoldColumn" .s:fg_none .s:bg_panel .s:fmt_none
  87. exe "hi! SignColumn" .s:fg_none .s:bg_panel .s:fmt_none
  88. " Incsearch"
  89. exe "hi! MatchParen" .s:fg_fg .s:bg_bg .s:fmt_undr
  90. exe "hi! ModeMsg" .s:fg_string .s:bg_none .s:fmt_none
  91. exe "hi! MoreMsg" .s:fg_string .s:bg_none .s:fmt_none
  92. exe "hi! NonText" .s:fg_guide .s:bg_none .s:fmt_none
  93. exe "hi! Pmenu" .s:fg_fg .s:bg_selection .s:fmt_none
  94. exe "hi! PmenuSel" .s:fg_fg .s:bg_selection .s:fmt_revr
  95. " PmenuSbar"
  96. " PmenuThumb"
  97. exe "hi! Question" .s:fg_string .s:bg_none .s:fmt_none
  98. exe "hi! Search" .s:fg_bg .s:bg_constant .s:fmt_none
  99. exe "hi! SpecialKey" .s:fg_selection .s:bg_none .s:fmt_none
  100. exe "hi! SpellCap" .s:fg_tag .s:bg_none .s:fmt_undr
  101. exe "hi! SpellLocal" .s:fg_keyword .s:bg_none .s:fmt_undr
  102. exe "hi! SpellBad" .s:fg_error .s:bg_none .s:fmt_undr
  103. exe "hi! SpellRare" .s:fg_regexp .s:bg_none .s:fmt_undr
  104. exe "hi! StatusLine" .s:fg_fg .s:bg_panel .s:fmt_none
  105. exe "hi! StatusLineNC" .s:fg_fg_idle .s:bg_panel .s:fmt_none
  106. exe "hi! WildMenu" .s:fg_bg .s:bg_markup .s:fmt_none
  107. exe "hi! TabLine" .s:fg_fg .s:bg_panel .s:fmt_revr
  108. " TabLineFill"
  109. " TabLineSel"
  110. exe "hi! Title" .s:fg_keyword .s:bg_none .s:fmt_none
  111. exe "hi! Visual" .s:fg_none .s:bg_selection .s:fmt_none
  112. " VisualNos"
  113. exe "hi! WarningMsg" .s:fg_error .s:bg_none .s:fmt_none
  114. " TODO LongLineWarning to use variables instead of hardcoding
  115. hi LongLineWarning guifg=NONE guibg=#371F1C gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
  116. " WildMenu"
  117. "}}}
  118. " Generic Syntax Highlighting: (see :help group-name)"{{{
  119. " ----------------------------------------------------------------------------
  120. exe "hi! Comment" .s:fg_comment .s:bg_none .s:fmt_none
  121. exe "hi! Constant" .s:fg_constant .s:bg_none .s:fmt_none
  122. exe "hi! String" .s:fg_string .s:bg_none .s:fmt_none
  123. " Character"
  124. " Number"
  125. " Boolean"
  126. " Float"
  127. exe "hi! Identifier" .s:fg_tag .s:bg_none .s:fmt_none
  128. exe "hi! Function" .s:fg_function .s:bg_none .s:fmt_none
  129. exe "hi! Statement" .s:fg_keyword .s:bg_none .s:fmt_none
  130. " Conditional"
  131. " Repeat"
  132. " Label"
  133. exe "hi! Operator" .s:fg_operator .s:bg_none .s:fmt_none
  134. " Keyword"
  135. " Exception"
  136. exe "hi! PreProc" .s:fg_special .s:bg_none .s:fmt_none
  137. " Include"
  138. " Define"
  139. " Macro"
  140. " PreCondit"
  141. exe "hi! Type" .s:fg_tag .s:bg_none .s:fmt_none
  142. " StorageClass"
  143. exe "hi! Structure" .s:fg_special .s:bg_none .s:fmt_none
  144. " Typedef"
  145. exe "hi! Special" .s:fg_special .s:bg_none .s:fmt_none
  146. " SpecialChar"
  147. " Tag"
  148. " Delimiter"
  149. " SpecialComment"
  150. " Debug"
  151. "
  152. exe "hi! Underlined" .s:fg_tag .s:bg_none .s:fmt_undr
  153. exe "hi! Ignore" .s:fg_none .s:bg_none .s:fmt_none
  154. exe "hi! Error" .s:fg_fg .s:bg_error .s:fmt_none
  155. exe "hi! Todo" .s:fg_markup .s:bg_none .s:fmt_none
  156. " Quickfix window highlighting
  157. exe "hi! qfLineNr" .s:fg_keyword .s:bg_none .s:fmt_none
  158. " qfFileName"
  159. " qfLineNr"
  160. " qfError"
  161. exe "hi! Conceal" .s:fg_guide .s:bg_none .s:fmt_none
  162. exe "hi! CursorLineConceal" .s:fg_guide .s:bg_line .s:fmt_none
  163. " Terminal
  164. " ---------
  165. if has("nvim")
  166. let g:terminal_color_0 = s:palette.bg[s:style]
  167. let g:terminal_color_1 = s:palette.markup[s:style]
  168. let g:terminal_color_2 = s:palette.string[s:style]
  169. let g:terminal_color_3 = s:palette.accent[s:style]
  170. let g:terminal_color_4 = s:palette.tag[s:style]
  171. let g:terminal_color_5 = s:palette.constant[s:style]
  172. let g:terminal_color_6 = s:palette.regexp[s:style]
  173. let g:terminal_color_7 = "#FFFFFF"
  174. let g:terminal_color_8 = s:palette.fg_idle[s:style]
  175. let g:terminal_color_9 = s:palette.error[s:style]
  176. let g:terminal_color_10 = s:palette.string[s:style]
  177. let g:terminal_color_11 = s:palette.accent[s:style]
  178. let g:terminal_color_12 = s:palette.tag[s:style]
  179. let g:terminal_color_13 = s:palette.constant[s:style]
  180. let g:terminal_color_14 = s:palette.regexp[s:style]
  181. let g:terminal_color_15 = s:palette.comment[s:style]
  182. let g:terminal_color_background = g:terminal_color_0
  183. let g:terminal_color_foreground = s:palette.fg[s:style]
  184. else
  185. let g:terminal_ansi_colors = [s:palette.bg[s:style], s:palette.markup[s:style]]
  186. let g:terminal_ansi_colors += [s:palette.string[s:style], s:palette.accent[s:style]]
  187. let g:terminal_ansi_colors += [s:palette.tag[s:style], s:palette.constant[s:style]]
  188. let g:terminal_ansi_colors += [s:palette.regexp[s:style], "#FFFFFF"]
  189. let g:terminal_ansi_colors += [s:palette.fg_idle[s:style], s:palette.error[s:style]]
  190. let g:terminal_ansi_colors += [s:palette.string[s:style], s:palette.accent[s:style]]
  191. let g:terminal_ansi_colors += [s:palette.tag[s:style], s:palette.constant[s:style]]
  192. let g:terminal_ansi_colors += [s:palette.regexp[s:style], s:palette.comment[s:style]]
  193. endif
  194. " NerdTree
  195. " ---------
  196. exe "hi! NERDTreeOpenable" .s:fg_fg_idle .s:bg_none .s:fmt_none
  197. exe "hi! NERDTreeClosable" .s:fg_accent .s:bg_none .s:fmt_none
  198. " exe "hi! NERDTreeBookmarksHeader" .s:fg_pink .s:bg_none .s:fmt_none
  199. " exe "hi! NERDTreeBookmarksLeader" .s:fg_bg .s:bg_none .s:fmt_none
  200. " exe "hi! NERDTreeBookmarkName" .s:fg_keyword .s:bg_none .s:fmt_none
  201. " exe "hi! NERDTreeCWD" .s:fg_pink .s:bg_none .s:fmt_none
  202. exe "hi! NERDTreeUp" .s:fg_fg_idle .s:bg_none .s:fmt_none
  203. exe "hi! NERDTreeDir" .s:fg_function .s:bg_none .s:fmt_none
  204. exe "hi! NERDTreeFile" .s:fg_none .s:bg_none .s:fmt_none
  205. exe "hi! NERDTreeDirSlash" .s:fg_accent .s:bg_none .s:fmt_none
  206. " GitGutter
  207. " ---------
  208. exe "hi! GitGutterAdd" .s:fg_string .s:bg_none .s:fmt_none
  209. exe "hi! GitGutterChange" .s:fg_tag .s:bg_none .s:fmt_none
  210. exe "hi! GitGutterDelete" .s:fg_markup .s:bg_none .s:fmt_none
  211. exe "hi! GitGutterChangeDelete" .s:fg_function .s:bg_none .s:fmt_none
  212. "}}}
  213. " Diff Syntax Highlighting:"{{{
  214. " ----------------------------------------------------------------------------
  215. " Diff
  216. " diffOldFile
  217. " diffNewFile
  218. " diffFile
  219. " diffOnly
  220. " diffIdentical
  221. " diffDiffer
  222. " diffBDiffer
  223. " diffIsA
  224. " diffNoEOL
  225. " diffCommon
  226. hi! link diffRemoved Constant
  227. " diffChanged
  228. hi! link diffAdded String
  229. " diffLine
  230. " diffSubname
  231. " diffComment
  232. "}}}
  233. "
  234. " This is needed for some reason: {{{
  235. let &background = s:style
  236. " }}}