onehalfdark.vim 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. " ==============================================================================
  2. " Name: One Half Dark
  3. " Author: Son A. Pham <sp@sonpham.me>
  4. " Url: https://github.com/sonph/onehalf
  5. " License: The MIT License (MIT)
  6. "
  7. " A dark vim color scheme based on Atom's One. See github.com/sonph/onehalf
  8. " for installation instructions, a light color scheme, versions for other
  9. " editors/terminals, and a matching theme for vim-airline.
  10. " ==============================================================================
  11. set background=dark
  12. highlight clear
  13. syntax reset
  14. let g:colors_name="onehalfdark"
  15. let colors_name="onehalfdark"
  16. let s:black = { "gui": "#282c34", "cterm": "236" }
  17. let s:red = { "gui": "#e06c75", "cterm": "168" }
  18. let s:green = { "gui": "#98c379", "cterm": "114" }
  19. let s:yellow = { "gui": "#e5c07b", "cterm": "180" }
  20. let s:blue = { "gui": "#61afef", "cterm": "75" }
  21. let s:purple = { "gui": "#c678dd", "cterm": "176" }
  22. let s:cyan = { "gui": "#56b6c2", "cterm": "73" }
  23. let s:white = { "gui": "#dcdfe4", "cterm": "188" }
  24. let s:fg = s:white
  25. let s:bg = s:black
  26. let s:comment_fg = { "gui": "#5c6370", "cterm": "241" }
  27. let s:gutter_bg = { "gui": "#282c34", "cterm": "236" }
  28. let s:gutter_fg = { "gui": "#919baa", "cterm": "247" }
  29. let s:non_text = { "gui": "#373C45", "cterm": "239" }
  30. let s:cursor_line = { "gui": "#313640", "cterm": "237" }
  31. let s:color_col = { "gui": "#313640", "cterm": "237" }
  32. let s:selection = { "gui": "#474e5d", "cterm": "239" }
  33. let s:vertsplit = { "gui": "#313640", "cterm": "237" }
  34. function! s:h(group, fg, bg, attr)
  35. if type(a:fg) == type({})
  36. exec "hi " . a:group . " guifg=" . a:fg.gui . " ctermfg=" . a:fg.cterm
  37. else
  38. exec "hi " . a:group . " guifg=NONE cterm=NONE"
  39. endif
  40. if type(a:bg) == type({})
  41. exec "hi " . a:group . " guibg=" . a:bg.gui . " ctermbg=" . a:bg.cterm
  42. else
  43. exec "hi " . a:group . " guibg=NONE ctermbg=NONE"
  44. endif
  45. if a:attr != ""
  46. exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
  47. else
  48. exec "hi " . a:group . " gui=NONE cterm=NONE"
  49. endif
  50. endfun
  51. " User interface colors {
  52. call s:h("Normal", s:fg, s:bg, "")
  53. call s:h("Cursor", s:bg, s:blue, "")
  54. call s:h("CursorColumn", "", s:cursor_line, "")
  55. call s:h("CursorLine", "", s:cursor_line, "")
  56. call s:h("LineNr", s:gutter_fg, s:gutter_bg, "")
  57. call s:h("CursorLineNr", s:fg, "", "")
  58. call s:h("DiffAdd", s:green, "", "")
  59. call s:h("DiffChange", s:yellow, "", "")
  60. call s:h("DiffDelete", s:red, "", "")
  61. call s:h("DiffText", s:blue, "", "")
  62. call s:h("IncSearch", s:bg, s:yellow, "")
  63. call s:h("Search", s:bg, s:yellow, "")
  64. call s:h("ErrorMsg", s:fg, "", "")
  65. call s:h("ModeMsg", s:fg, "", "")
  66. call s:h("MoreMsg", s:fg, "", "")
  67. call s:h("WarningMsg", s:red, "", "")
  68. call s:h("Question", s:purple, "", "")
  69. call s:h("Pmenu", s:bg, s:fg, "")
  70. call s:h("PmenuSel", s:fg, s:blue, "")
  71. call s:h("PmenuSbar", "", s:selection, "")
  72. call s:h("PmenuThumb", "", s:fg, "")
  73. call s:h("SpellBad", s:red, "", "")
  74. call s:h("SpellCap", s:yellow, "", "")
  75. call s:h("SpellLocal", s:yellow, "", "")
  76. call s:h("SpellRare", s:yellow, "", "")
  77. call s:h("StatusLine", s:blue, s:cursor_line, "")
  78. call s:h("StatusLineNC", s:comment_fg, s:cursor_line, "")
  79. call s:h("TabLine", s:comment_fg, s:cursor_line, "")
  80. call s:h("TabLineFill", s:comment_fg, s:cursor_line, "")
  81. call s:h("TabLineSel", s:fg, s:bg, "")
  82. call s:h("Visual", "", s:selection, "")
  83. call s:h("VisualNOS", "", s:selection, "")
  84. call s:h("ColorColumn", "", s:color_col, "")
  85. call s:h("Conceal", s:fg, "", "")
  86. call s:h("Directory", s:blue, "", "")
  87. call s:h("VertSplit", s:vertsplit, s:vertsplit, "")
  88. call s:h("Folded", s:fg, "", "")
  89. call s:h("FoldColumn", s:fg, "", "")
  90. call s:h("SignColumn", s:fg, "", "")
  91. call s:h("MatchParen", s:blue, "", "underline")
  92. call s:h("SpecialKey", s:fg, "", "")
  93. call s:h("Title", s:green, "", "")
  94. call s:h("WildMenu", s:fg, "", "")
  95. " }
  96. " Syntax colors {
  97. " Whitespace is defined in Neovim, not Vim.
  98. " See :help hl-Whitespace and :help hl-SpecialKey
  99. call s:h("Whitespace", s:non_text, "", "")
  100. call s:h("NonText", s:non_text, "", "")
  101. call s:h("Comment", s:comment_fg, "", "italic")
  102. call s:h("Constant", s:cyan, "", "")
  103. call s:h("String", s:green, "", "")
  104. call s:h("Character", s:green, "", "")
  105. call s:h("Number", s:yellow, "", "")
  106. call s:h("Boolean", s:yellow, "", "")
  107. call s:h("Float", s:yellow, "", "")
  108. call s:h("Identifier", s:red, "", "")
  109. call s:h("Function", s:blue, "", "")
  110. call s:h("Statement", s:purple, "", "")
  111. call s:h("Conditional", s:purple, "", "")
  112. call s:h("Repeat", s:purple, "", "")
  113. call s:h("Label", s:purple, "", "")
  114. call s:h("Operator", s:fg, "", "")
  115. call s:h("Keyword", s:red, "", "")
  116. call s:h("Exception", s:purple, "", "")
  117. call s:h("PreProc", s:yellow, "", "")
  118. call s:h("Include", s:purple, "", "")
  119. call s:h("Define", s:purple, "", "")
  120. call s:h("Macro", s:purple, "", "")
  121. call s:h("PreCondit", s:yellow, "", "")
  122. call s:h("Type", s:yellow, "", "")
  123. call s:h("StorageClass", s:yellow, "", "")
  124. call s:h("Structure", s:yellow, "", "")
  125. call s:h("Typedef", s:yellow, "", "")
  126. call s:h("Special", s:blue, "", "")
  127. call s:h("SpecialChar", s:fg, "", "")
  128. call s:h("Tag", s:fg, "", "")
  129. call s:h("Delimiter", s:fg, "", "")
  130. call s:h("SpecialComment", s:fg, "", "")
  131. call s:h("Debug", s:fg, "", "")
  132. call s:h("Underlined", s:fg, "", "")
  133. call s:h("Ignore", s:fg, "", "")
  134. call s:h("Error", s:red, s:gutter_bg, "")
  135. call s:h("Todo", s:purple, "", "")
  136. " }
  137. " Plugins {
  138. " GitGutter
  139. call s:h("GitGutterAdd", s:green, s:gutter_bg, "")
  140. call s:h("GitGutterDelete", s:red, s:gutter_bg, "")
  141. call s:h("GitGutterChange", s:yellow, s:gutter_bg, "")
  142. call s:h("GitGutterChangeDelete", s:red, s:gutter_bg, "")
  143. " Fugitive
  144. call s:h("diffAdded", s:green, "", "")
  145. call s:h("diffRemoved", s:red, "", "")
  146. " }
  147. " Git {
  148. call s:h("gitcommitComment", s:comment_fg, "", "")
  149. call s:h("gitcommitUnmerged", s:red, "", "")
  150. call s:h("gitcommitOnBranch", s:fg, "", "")
  151. call s:h("gitcommitBranch", s:purple, "", "")
  152. call s:h("gitcommitDiscardedType", s:red, "", "")
  153. call s:h("gitcommitSelectedType", s:green, "", "")
  154. call s:h("gitcommitHeader", s:fg, "", "")
  155. call s:h("gitcommitUntrackedFile", s:cyan, "", "")
  156. call s:h("gitcommitDiscardedFile", s:red, "", "")
  157. call s:h("gitcommitSelectedFile", s:green, "", "")
  158. call s:h("gitcommitUnmergedFile", s:yellow, "", "")
  159. call s:h("gitcommitFile", s:fg, "", "")
  160. hi link gitcommitNoBranch gitcommitBranch
  161. hi link gitcommitUntracked gitcommitComment
  162. hi link gitcommitDiscarded gitcommitComment
  163. hi link gitcommitSelected gitcommitComment
  164. hi link gitcommitDiscardedArrow gitcommitDiscardedFile
  165. hi link gitcommitSelectedArrow gitcommitSelectedFile
  166. hi link gitcommitUnmergedArrow gitcommitUnmergedFile
  167. " }
  168. " Fix colors in neovim terminal buffers {
  169. if has('nvim')
  170. let g:terminal_color_0 = s:black.gui
  171. let g:terminal_color_1 = s:red.gui
  172. let g:terminal_color_2 = s:green.gui
  173. let g:terminal_color_3 = s:yellow.gui
  174. let g:terminal_color_4 = s:blue.gui
  175. let g:terminal_color_5 = s:purple.gui
  176. let g:terminal_color_6 = s:cyan.gui
  177. let g:terminal_color_7 = s:white.gui
  178. let g:terminal_color_8 = s:black.gui
  179. let g:terminal_color_9 = s:red.gui
  180. let g:terminal_color_10 = s:green.gui
  181. let g:terminal_color_11 = s:yellow.gui
  182. let g:terminal_color_12 = s:blue.gui
  183. let g:terminal_color_13 = s:purple.gui
  184. let g:terminal_color_14 = s:cyan.gui
  185. let g:terminal_color_15 = s:white.gui
  186. let g:terminal_color_background = s:bg.gui
  187. let g:terminal_color_foreground = s:fg.gui
  188. endif
  189. " }