material-theme.vim 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. " Material Theme (https://github.com/equinusocio/material-theme)
  2. " Scheme: Mattia Astorino
  3. " This enables the coresponding base16-shell script to run so that
  4. " :colorscheme works in terminals supported by base16-shell scripts
  5. " User must set this variable in .vimrc
  6. " let g:base16_shell_path=base16-builder/output/shell/
  7. " if !has('gui_running')
  8. " if exists("g:base16_shell_path")
  9. " execute "silent !/bin/sh ".g:base16_shell_path."/base16-materialtheme.".&background.".sh"
  10. " endif
  11. " endif
  12. " GUI color definitions
  13. let s:gui00 = "263238"
  14. let s:gui01 = "37474F"
  15. let s:gui02 = "546E7A"
  16. let s:gui03 = "5C7E8C"
  17. let s:gui04 = "80CBC4"
  18. let s:gui05 = "C792EA"
  19. let s:gui06 = "7986CB"
  20. let s:gui07 = "82B1FF"
  21. let s:gui08 = "8BD649"
  22. let s:gui09 = "C3E88D"
  23. let s:gui0A = "CDD3DE"
  24. let s:gui0B = "EC5F67"
  25. let s:gui0C = "F1E655"
  26. let s:gui0D = "F77669"
  27. let s:gui0E = "F8E71C"
  28. let s:gui0F = "FFFFFF"
  29. " Terminal color definitions
  30. let s:cterm00 = "00"
  31. let s:cterm03 = "08"
  32. let s:cterm05 = "07"
  33. let s:cterm07 = "15"
  34. let s:cterm08 = "01"
  35. let s:cterm0A = "03"
  36. let s:cterm0B = "02"
  37. let s:cterm0C = "06"
  38. let s:cterm0D = "04"
  39. let s:cterm0E = "05"
  40. if exists('base16colorspace') && base16colorspace == "256"
  41. let s:cterm01 = "18"
  42. let s:cterm02 = "19"
  43. let s:cterm04 = "20"
  44. let s:cterm06 = "21"
  45. let s:cterm09 = "16"
  46. let s:cterm0F = "17"
  47. else
  48. let s:cterm01 = "10"
  49. let s:cterm02 = "11"
  50. let s:cterm04 = "12"
  51. let s:cterm06 = "13"
  52. let s:cterm09 = "09"
  53. let s:cterm0F = "14"
  54. endif
  55. " Theme setup
  56. hi clear
  57. syntax reset
  58. let g:colors_name = "material-theme"
  59. " Highlighting function
  60. fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr)
  61. if a:guifg != ""
  62. exec "hi " . a:group . " guifg=#" . s:gui(a:guifg)
  63. endif
  64. if a:guibg != ""
  65. exec "hi " . a:group . " guibg=#" . s:gui(a:guibg)
  66. endif
  67. if a:ctermfg != ""
  68. exec "hi " . a:group . " ctermfg=" . s:cterm(a:ctermfg)
  69. endif
  70. if a:ctermbg != ""
  71. exec "hi " . a:group . " ctermbg=" . s:cterm(a:ctermbg)
  72. endif
  73. if a:attr != ""
  74. exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
  75. endif
  76. endfun
  77. " Return GUI color for light/dark variants
  78. fun s:gui(color)
  79. if &background == "dark"
  80. return a:color
  81. endif
  82. if a:color == s:gui00
  83. return s:gui0F
  84. elseif a:color == s:gui01
  85. return s:gui06
  86. elseif a:color == s:gui02
  87. return s:gui05
  88. elseif a:color == s:gui03
  89. return s:gui04
  90. elseif a:color == s:gui05
  91. return s:gui02
  92. elseif a:color == s:gui06
  93. return s:gui01
  94. elseif a:color == s:gui0F
  95. return s:gui0A
  96. endif
  97. return a:color
  98. endfun
  99. " Return terminal color for light/dark variants
  100. fun s:cterm(color)
  101. if &background == "dark"
  102. return a:color
  103. endif
  104. if a:color == s:cterm00
  105. return s:cterm07
  106. elseif a:color == s:cterm01
  107. return s:cterm06
  108. elseif a:color == s:cterm02
  109. return s:cterm05
  110. elseif a:color == s:cterm03
  111. return s:cterm04
  112. elseif a:color == s:cterm04
  113. return s:cterm03
  114. elseif a:color == s:cterm05
  115. return s:cterm02
  116. elseif a:color == s:cterm06
  117. return s:cterm01
  118. elseif a:color == s:cterm07
  119. return s:cterm00
  120. endif
  121. return a:color
  122. endfun
  123. " Vim editor colors
  124. call <sid>hi("Bold", "", "", "", "", "bold")
  125. call <sid>hi("Debug", s:gui08, "", s:cterm08, "", "")
  126. call <sid>hi("Directory", s:gui04, "", s:cterm04, "", "")
  127. call <sid>hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "")
  128. call <sid>hi("Exception", s:gui0D, "", s:cterm0D, "", "")
  129. call <sid>hi("FoldColumn", "", s:gui01, "", s:cterm01, "")
  130. call <sid>hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "")
  131. call <sid>hi("IncSearch", s:gui01, s:gui09, s:cterm01, s:cterm09, "none")
  132. call <sid>hi("Italic", "", "", "", "", "none")
  133. call <sid>hi("Macro", s:gui08, "", s:cterm08, "", "")
  134. call <sid>hi("MatchParen", s:gui01, s:gui03, s:cterm00, s:cterm03, "")
  135. call <sid>hi("ModeMsg", s:gui04, "", s:cterm04, "", "")
  136. call <sid>hi("MoreMsg", s:gui04, "", s:cterm04, "", "")
  137. call <sid>hi("Question", s:gui0D, "", s:cterm0D, "", "")
  138. call <sid>hi("Search", s:gui03, s:gui0A, s:cterm03, s:cterm0A, "")
  139. call <sid>hi("SpecialKey", s:gui03, "", s:cterm03, "", "")
  140. call <sid>hi("TooLong", s:gui08, "", s:cterm08, "", "")
  141. call <sid>hi("Underlined", s:gui08, "", s:cterm08, "", "")
  142. call <sid>hi("Visual", "", s:gui01, "", s:cterm01, "")
  143. call <sid>hi("VisualNOS", "", s:gui01, "", s:cterm01, "")
  144. call <sid>hi("WarningMsg", s:gui08, "", s:cterm08, "", "")
  145. call <sid>hi("WildMenu", s:gui08, "", s:cterm08, "", "")
  146. call <sid>hi("Title", s:gui04, "", s:cterm04, "", "none")
  147. call <sid>hi("Conceal", s:gui04, s:gui00, s:cterm04, s:cterm00, "")
  148. call <sid>hi("Cursor", "", s:gui03, "", s:cterm03, "")
  149. call <sid>hi("NonText", s:gui03, "", s:cterm03, "", "")
  150. call <sid>hi("Normal", s:gui0F, s:gui00, s:cterm0F, s:cterm00, "")
  151. call <sid>hi("LineNr", s:gui03, s:gui00, s:cterm01, s:cterm00, "")
  152. call <sid>hi("SignColumn", s:gui03, s:gui01, s:cterm03, s:cterm01, "")
  153. call <sid>hi("SpecialKey", s:gui04, "", s:cterm04, "", "")
  154. call <sid>hi("StatusLine", s:gui04, s:gui02, s:cterm04, s:cterm02, "none")
  155. call <sid>hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
  156. call <sid>hi("VertSplit", s:gui00, s:gui00, s:cterm00, s:cterm00, "none")
  157. call <sid>hi("ColorColumn", "", s:gui01, "", s:cterm01, "none")
  158. call <sid>hi("CursorColumn", "", s:gui01, "", s:cterm01, "none")
  159. call <sid>hi("CursorLine", "", s:gui01, "", s:cterm01, "none")
  160. call <sid>hi("CursorLineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "")
  161. call <sid>hi("PMenu", s:gui04, s:gui01, s:cterm04, s:cterm01, "none")
  162. call <sid>hi("PMenuSel", s:gui0A, s:gui01, s:cterm0A, s:cterm01, "")
  163. call <sid>hi("TabLine", s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
  164. call <sid>hi("TabLineFill", s:gui03, s:gui01, s:cterm03, s:cterm01, "none")
  165. call <sid>hi("TabLineSel", s:gui09, s:gui01, s:cterm03, s:cterm01, "none")
  166. " Hide '~' at end of buffer in neovim
  167. " Set g:material_hide_endofbuffer = 0 to disable
  168. if has('nvim') && (!exists('g:material_hide_endofbuffer') || g:material_hide_endofbuffer == 1)
  169. call <sid>hi("EndOfBuffer",s:gui00, s:gui00, s:cterm00, s:cterm00, "none")
  170. endif
  171. " Standard syntax highlighting
  172. call <sid>hi("Boolean", s:gui0D, "", s:cterm0D, "", "none")
  173. call <sid>hi("Character", s:gui08, "", s:cterm08, "", "none")
  174. call <sid>hi("Comment", s:gui03, "", s:cterm03, "", "none")
  175. call <sid>hi("Conditional", s:gui05, "", s:cterm05, "", "none")
  176. call <sid>hi("Constant", s:gui0D, "", s:cterm0D, "", "none")
  177. call <sid>hi("Define", s:gui07, "", s:cterm07, "", "none")
  178. call <sid>hi("Delimiter", s:gui04, "", s:cterm04, "", "none")
  179. call <sid>hi("Float", s:gui0D, "", s:cterm0D, "", "none")
  180. call <sid>hi("Function", s:gui07, "", s:cterm07, "", "none")
  181. call <sid>hi("Identifier", s:gui05, "", s:cterm05, "", "none")
  182. call <sid>hi("Include", s:gui05, "", s:cterm05, "", "none")
  183. call <sid>hi("Keyword", s:gui05, "", s:cterm05, "", "none")
  184. call <sid>hi("Label", s:gui06, "", s:cterm06, "", "none")
  185. call <sid>hi("Number", s:gui0D, "", s:cterm0D, "", "none")
  186. call <sid>hi("Operator", s:gui05, "", s:cterm05, "", "none")
  187. call <sid>hi("PreProc", s:gui05, "", s:cterm05, "", "none")
  188. call <sid>hi("Repeat", s:gui04, "", s:cterm04, "", "none")
  189. call <sid>hi("Special", s:gui07, "", s:cterm07, "", "none")
  190. call <sid>hi("SpecialChar", s:gui04, "", s:cterm04, "", "none")
  191. call <sid>hi("Statement", s:gui05, "", s:cterm05, "", "none")
  192. call <sid>hi("StorageClass", s:gui07, "", s:cterm07, "", "none")
  193. call <sid>hi("String", s:gui09, "", s:cterm09, "", "none")
  194. call <sid>hi("Structure", s:gui07, "", s:cterm07, "", "none")
  195. call <sid>hi("Tag", s:gui07, "", s:cterm07, "", "none")
  196. call <sid>hi("Todo", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
  197. call <sid>hi("Type", s:gui07, "", s:cterm07, "", "none")
  198. call <sid>hi("Typedef", s:gui07, "", s:cterm07, "", "none")
  199. " C highlighting
  200. call <sid>hi("cOperator", s:gui0C, "", s:cterm0C, "", "")
  201. call <sid>hi("cPreCondit", s:gui0E, "", s:cterm0E, "", "")
  202. " C# highlighting
  203. call <sid>hi("csClass", s:gui0A, "", s:cterm0A, "", "")
  204. call <sid>hi("csAttribute", s:gui0A, "", s:cterm0A, "", "")
  205. call <sid>hi("csModifier", s:gui0E, "", s:cterm0E, "", "")
  206. call <sid>hi("csType", s:gui08, "", s:cterm08, "", "")
  207. call <sid>hi("csUnspecifiedStatement", s:gui0D, "", s:cterm0D, "", "")
  208. call <sid>hi("csContextualStatement", s:gui0E, "", s:cterm0E, "", "")
  209. call <sid>hi("csNewDecleration", s:gui08, "", s:cterm08, "", "")
  210. " CSS highlighting
  211. call <sid>hi("cssBraces", s:gui05, "", s:cterm05, "", "")
  212. call <sid>hi("cssClassName", s:gui0E, "", s:cterm0E, "", "")
  213. call <sid>hi("cssColor", s:gui0C, "", s:cterm0C, "", "")
  214. " Diff highlighting
  215. call <sid>hi("DiffAdd", s:gui04, s:gui01, s:cterm04, s:cterm01, "")
  216. call <sid>hi("DiffChange", s:gui03, s:gui01, s:cterm03, s:cterm01, "")
  217. call <sid>hi("DiffDelete", s:gui06, s:gui01, s:cterm06, s:cterm01, "")
  218. call <sid>hi("DiffText", s:gui04, s:gui01, s:cterm04, s:cterm01, "")
  219. call <sid>hi("DiffAdded", s:gui06, s:gui00, s:cterm06, s:cterm00, "")
  220. call <sid>hi("DiffFile", s:gui06, s:gui00, s:cterm06, s:cterm00, "")
  221. call <sid>hi("DiffNewFile", s:gui05, s:gui00, s:cterm05, s:cterm00, "")
  222. call <sid>hi("DiffLine", s:gui04, s:gui00, s:cterm04, s:cterm00, "")
  223. call <sid>hi("DiffRemoved", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "")
  224. " Git highlighting
  225. call <sid>hi("gitCommitOverflow", s:gui08, "", s:cterm08, "", "")
  226. call <sid>hi("gitCommitSummary", s:gui04, "", s:cterm04, "", "")
  227. " GitGutter highlighting
  228. call <sid>hi("GitGutterAdd", s:gui04, s:gui01, s:cterm04, s:cterm01, "")
  229. call <sid>hi("GitGutterChange", s:gui05, s:gui01, s:cterm05, s:cterm01, "")
  230. call <sid>hi("GitGutterDelete", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "")
  231. call <sid>hi("GitGutterChangeDelete", s:gui0E, s:gui01, s:cterm0E, s:cterm01, "")
  232. " HTML highlighting
  233. call <sid>hi("htmlBold", s:gui0A, "", s:cterm0A, "", "")
  234. call <sid>hi("htmlItalic", s:gui0E, "", s:cterm0E, "", "")
  235. call <sid>hi("htmlEndTag", s:gui04, "", s:cterm04, "", "")
  236. call <sid>hi("htmlTag", s:gui04, "", s:cterm04, "", "")
  237. call <sid>hi("htmlTagName", s:gui07, "", s:cterm07, "", "")
  238. call <sid>hi("htmlArg", s:gui04, "", s:cterm04, "", "")
  239. " JavaScript highlighting
  240. call <sid>hi("javaScript", s:gui05, "", s:cterm05, "", "")
  241. call <sid>hi("javaScriptBraces", s:gui05, "", s:cterm05, "", "")
  242. call <sid>hi("javaScriptNumber", s:gui0D, "", s:cterm0D, "", "")
  243. " Markdown highlighting
  244. call <sid>hi("markdownCode", s:gui06, "", s:cterm06, "", "")
  245. call <sid>hi("markdownError", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "")
  246. call <sid>hi("markdownCodeBlock", s:gui06, "", s:cterm06, "", "")
  247. call <sid>hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "")
  248. " NERDTree highlighting
  249. call <sid>hi("NERDTreeDirSlash", s:gui04, "", s:cterm04, "", "")
  250. call <sid>hi("NERDTreeExecFile", s:gui0D, "", s:cterm0D, "", "")
  251. " PHP highlighting
  252. call <sid>hi("phpComparison", s:gui05, "", s:cterm05, "", "")
  253. call <sid>hi("phpMethodsVar", s:gui07, "", s:cterm07, "", "")
  254. call <sid>hi("phpMemberSelector", s:gui04, "", s:cterm04, "", "")
  255. call <sid>hi("phpIdentifier", s:gui04, "", s:cterm04, "", "")
  256. call <sid>hi("phpVarSelector", s:gui04, "", s:cterm04, "", "")
  257. call <sid>hi("phpType", s:gui05, "", s:cterm05, "", "")
  258. call <sid>hi("phpClass", s:gui0C, "", s:cterm0C, "", "")
  259. call <sid>hi("phpClasses", s:gui0C, "", s:cterm0C, "", "")
  260. call <sid>hi("phpParent", s:gui02, "", s:cterm02, "", "")
  261. call <sid>hi("phpFunctions", s:gui07, "", s:cterm07, "", "")
  262. call <sid>hi("phpFunction", s:gui07, "", s:cterm07, "", "")
  263. call <sid>hi("phpMethod", s:gui07, "", s:cterm07, "", "")
  264. call <sid>hi("phpOperator", s:gui04, "", s:cterm04, "", "")
  265. call <sid>hi("phpKeyword", s:gui05, "", s:cterm05, "", "")
  266. call <sid>hi("phpClassExtends", s:gui0A, "", s:cterm0A, "", "")
  267. call <sid>hi("phpInclude", s:gui05, "", s:cterm05, "", "")
  268. call <sid>hi("phpUseClass", s:gui0A, "", s:cterm0A, "", "")
  269. call <sid>hi("phpBoolean", s:gui05, "", s:cterm05, "", "")
  270. " Python highlighting
  271. call <sid>hi("pythonOperator", s:gui04, "", s:cterm04, "", "")
  272. call <sid>hi("pythonRepeat", s:gui04, "", s:cterm04, "", "")
  273. " Ruby highlighting
  274. call <sid>hi("rubyAttribute", s:gui0D, "", s:cterm0D, "", "")
  275. call <sid>hi("rubyConstant", s:gui0A, "", s:cterm0A, "", "")
  276. call <sid>hi("rubyInterpolation", s:gui0B, "", s:cterm0B, "", "")
  277. call <sid>hi("rubyInterpolationDelimiter", s:gui0F, "", s:cterm0F, "", "")
  278. call <sid>hi("rubyRegexp", s:gui0C, "", s:cterm0C, "", "")
  279. call <sid>hi("rubySymbol", s:gui0B, "", s:cterm0B, "", "")
  280. call <sid>hi("rubyStringDelimiter", s:gui0B, "", s:cterm0B, "", "")
  281. " SASS highlighting
  282. call <sid>hi("sassidChar", s:gui08, "", s:cterm08, "", "")
  283. call <sid>hi("sassClassChar", s:gui09, "", s:cterm09, "", "")
  284. call <sid>hi("sassInclude", s:gui0E, "", s:cterm0E, "", "")
  285. call <sid>hi("sassMixing", s:gui0E, "", s:cterm0E, "", "")
  286. call <sid>hi("sassMixinName", s:gui0D, "", s:cterm0D, "", "")
  287. " Signify highlighting
  288. call <sid>hi("SignifySignAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "")
  289. call <sid>hi("SignifySignChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "")
  290. call <sid>hi("SignifySignDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "")
  291. " Spelling highlighting
  292. call <sid>hi("SpellBad", "", s:gui00, "", s:cterm00, "undercurl")
  293. call <sid>hi("SpellLocal", "", s:gui00, "", s:cterm00, "undercurl")
  294. call <sid>hi("SpellCap", "", s:gui00, "", s:cterm00, "undercurl")
  295. call <sid>hi("SpellRare", "", s:gui00, "", s:cterm00, "undercurl")
  296. " Remove functions
  297. delf <sid>hi
  298. delf <sid>gui
  299. delf <sid>cterm
  300. " Remove color variables
  301. unlet s:gui00 s:gui01 s:gui02 s:gui03 s:gui04 s:gui05 s:gui06 s:gui07 s:gui08 s:gui09 s:gui0A s:gui0B s:gui0C s:gui0D s:gui0E s:gui0F
  302. unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F