Add gui colors

Replace string concatination with a custom function `Hightlight()`
This commit is contained in:
Patrick Stockwell
2018-12-14 14:46:42 +11:00
committed by Patrick Stockwell
parent 3415c90d98
commit 4ae3524d08

View File

@@ -16,177 +16,192 @@ if !exists("g:vim_monokai_tasty_italic")
endif endif
if g:vim_monokai_tasty_italic if g:vim_monokai_tasty_italic
let s:italic = "italic" let s:italic = { "cterm": "italic", "gui": "italic" }
else else
let s:italic = "NONE" let s:italic = { "cterm": "none", "gui": "none" }
endif endif
" prefix with s: for local script-only functions or variables let s:yellow = { "cterm": 228, "gui": "#E7DC6D" }
let s:purple = { "cterm": 141, "gui": "#AC7CFF" }
let s:light_green = { "cterm": 148, "gui": "#A4E400" }
let s:light_blue = { "cterm": 81, "gui": "#62D8F1" }
let s:magenta = { "cterm": 197, "gui": "#FC1A70" }
let s:orange = { "cterm": 208, "gui": "#FF9700" }
let s:fg = " ctermfg=" " foreground let s:white = { "cterm": 231, "gui": "#ffffff" }
let s:bg = " ctermbg=" " background let s:light_grey = { "cterm": 250, "gui": "#bcbcbc" }
let s:style = " cterm=" let s:grey = { "cterm": 245, "gui": "#8a8a8a" }
let s:dark_grey = { "cterm": 59, "gui": "#5f5f5f" }
let s:darker_grey = { "cterm": 238, "gui": "#444444" }
let s:charcoal = { "cterm": 235, "gui": "#262626" }
let s:danger = { "cterm": 197, "gui": "#ff005f" }
let s:olive = { "cterm": 64, "gui": "#5f8700" }
let s:dark_red = { "cterm": 88, "gui": "#870000" }
let s:blood_red = { "cterm": 52, "gui": "#5f0000" }
let s:dark_green = { "cterm": 22, "gui": "#005f00" }
let s:light_sea_blue = { "cterm": 33, "gui": "#0087ff" }
let s:sea_blue = { "cterm": 25, "gui": "#005faf" }
let s:yellow = 228 let s:none = { "cterm": "none", "gui": "none" }
let s:purple = 141 let s:bold = { "cterm": "bold", "gui": "bold" }
let s:light_green = 148 let s:underline = { "cterm": "underline", "gui": "underline" }
let s:light_blue = 81 let s:bold_underline = { "cterm": "bold,underline", "gui": "bold,underline" }
let s:magenta = 197
let s:orange = 208
let s:white = 231 function! Highlight(group, fg, bg, style)
let s:light_grey = 250 exec "hi " . a:group
let s:grey = 245 \ . " ctermfg=" . a:fg["cterm"]
let s:dark_grey = 59 \ . " ctermbg=" . a:bg["cterm"]
let s:darker_grey = 238 \ . " cterm=" . a:style["cterm"]
let s:charcoal = 235 \ . " guifg=" . a:fg["gui"]
let s:pale_yellow = 186 \ . " guibg=" . a:bg["gui"]
let s:danger = 197 \ . " gui=" . a:style["gui"]
let s:olive = 64 endfunction
let s:dark_red = 88
let s:blood_red = 52
let s:dark_green = 22
let s:light_sea_blue = 33
let s:sea_blue = 25
let s:none = " ctermfg=NONE ctermbg=NONE cterm=NONE" call Highlight("vimParenSep", s:white, s:none, s:bold)
call Highlight("vimOperParen", s:light_blue, s:none, s:italic)
call Highlight("vimUserFunc", s:purple, s:none, s:none)
call Highlight("vimFunction", s:orange, s:none, s:none)
exec "hi Cursor" . s:fg . s:charcoal . s:bg . s:light_blue . s:style . "NONE" call Highlight("Cursor", s:charcoal, s:light_blue, s:none)
exec "hi Normal" . s:fg . s:white . s:bg . s:charcoal . s:style . "NONE" call Highlight("Normal", s:white, s:charcoal, s:none)
exec "hi Special" . s:fg . s:purple . s:style . "NONE" call Highlight("Normal", s:white, s:charcoal, s:none)
exec "hi Title" . s:fg . s:white . s:style . "bold" call Highlight("Special", s:purple, s:none, s:none)
call Highlight("Title", s:white, s:none, s:bold)
exec "hi DiffChange" . s:fg . s:white . s:bg . s:sea_blue . s:style . "NONE" call Highlight("DiffChange", s:white, s:sea_blue, s:none)
exec "hi DiffText" . s:fg . s:white . s:bg . s:light_sea_blue . s:style . "NONE" call Highlight("DiffText", s:white, s:light_sea_blue, s:none)
exec "hi DiffDelete" . s:fg . s:dark_red . s:bg . s:blood_red . s:style . "NONE" call Highlight("DiffDelete", s:dark_red, s:blood_red, s:none)
exec "hi DiffAdd" . s:fg . s:white . s:bg . s:dark_green . s:style . "NONE" call Highlight("DiffAdd", s:white, s:dark_green, s:none)
exec "hi Error" . s:fg . s:white . s:bg . s:danger . s:style . "NONE" call Highlight("Error", s:white, s:danger, s:none)
exec "hi ErrorMsg" . s:fg . s:white . s:bg . s:danger . s:style . "NONE" call Highlight("ErrorMsg", s:white, s:danger, s:none)
exec "hi WarningMsg" . s:fg . s:white . s:bg . s:danger . s:style . "NONE" call Highlight("WarningMsg", s:white, s:danger, s:none)
exec "hi SpellBad" . s:fg . s:white . s:bg . s:danger . s:style . "NONE" call Highlight("SpellBad", s:white, s:danger, s:none)
exec "hi SpellRare" . s:fg . s:white . s:bg . s:danger . s:style . "NONE" call Highlight("SpellRare", s:white, s:danger, s:none)
exec "hi CursorLineNR" . s:fg . s:pale_yellow . s:style . "NONE" call Highlight("CursorLineNR", s:yellow, s:none, s:none)
exec "hi CursorColumn" . s:none call Highlight("CursorColumn", s:none, s:none, s:none)
exec "hi ColorColumn" . s:none call Highlight("ColorColumn", s:none, s:none, s:none)
exec "hi Conceal" . s:none call Highlight("Conceal", s:none, s:none, s:none)
exec "hi CursorLine" . s:none call Highlight("CursorLine", s:none, s:none, s:none)
exec "hi ColorColumn" . s:none call Highlight("Type", s:none, s:none, s:none)
exec "hi Type" . s:none
exec "hi Visual " . s:bg . s:dark_grey . s:style . "NONE" call Highlight("Visual", s:none, s:dark_grey, s:none)
exec "hi TabLine" . s:fg . s:light_grey . s:bg . s:dark_grey . s:style . "underline" call Highlight("TabLine", s:light_grey, s:dark_grey, s:underline)
call Highlight("Whitespace", s:dark_grey, s:none, s:none)
exec "hi TabLineSel" . s:bg . s:charcoal . s:style . "bold" call Highlight("TabLineSel", s:none, s:charcoal, s:bold)
exec "hi SignColumn" . s:fg . s:grey . s:bg . s:darker_grey . s:style . "NONE" call Highlight("SignColumn", s:grey, s:darker_grey, s:none)
exec "hi NonText" . s:fg . s:darker_grey . s:style . "NONE" call Highlight("NonText", s:darker_grey, s:none, s:none)
exec "hi TabLineFill" . s:bg . s:darker_grey . s:style . "NONE" call Highlight("TabLineFill", s:none, s:darker_grey, s:none)
exec "hi LineNr" . s:fg . s:darker_grey . s:style . "NONE" call Highlight("LineNr", s:darker_grey, s:none, s:none)
exec "hi VertSplit" . s:fg . s:darker_grey . s:bg . s:charcoal . s:style . "NONE" call Highlight("VertSplit", s:darker_grey, s:charcoal, s:none)
exec "hi StatusLine" . s:fg . s:white . s:bg . s:darker_grey . s:style . "NONE" call Highlight("StatusLine", s:white, s:darker_grey, s:none)
exec "hi StatusLineNC" . s:fg . s:white . s:bg . s:darker_grey . s:style . "NONE" call Highlight("StatusLineNC", s:white, s:darker_grey, s:none)
exec "hi Exception" . s:fg . s:magenta . s:style . "bold" call Highlight("Exception", s:magenta, s:none, s:bold)
exec "hi MatchParen" . s:fg . s:magenta . s:bg . "NONE" . s:style . "underline" call Highlight("MatchParen", s:magenta, s:none, s:underline)
exec "hi Include" . s:fg . s:magenta . s:style . "NONE" call Highlight("Include", s:magenta, s:none, s:none)
exec "hi Conditional" . s:fg . s:magenta . s:style . "NONE" call Highlight("Conditional", s:magenta, s:none, s:none)
exec "hi Define" . s:fg . s:magenta . s:style . "NONE" call Highlight("Define", s:magenta, s:none, s:none)
exec "hi Debug" . s:fg . s:magenta . s:style . "NONE" call Highlight("Debug", s:magenta, s:none, s:none)
exec "hi Delimiter" . s:fg . s:magenta . s:style . "NONE" call Highlight("Delimiter", s:magenta, s:none, s:none)
exec "hi Keyword" . s:fg . s:magenta . s:style . "NONE" call Highlight("Keyword", s:magenta, s:none, s:none)
exec "hi Macro" . s:fg . s:magenta . s:style . "NONE" call Highlight("Macro", s:magenta, s:none, s:none)
exec "hi Operator" . s:fg . s:magenta . s:style . "NONE" call Highlight("Operator", s:magenta, s:none, s:none)
exec "hi PreProc" . s:fg . s:magenta . s:style . "NONE" call Highlight("PreProc", s:magenta, s:none, s:none)
exec "hi Statement" . s:fg . s:magenta . s:style . "NONE" call Highlight("Statement", s:magenta, s:none, s:none)
exec "hi Repeat" . s:fg . s:magenta . s:style . "NONE" call Highlight("Repeat", s:magenta, s:none, s:none)
exec "hi SpecialKey" . s:fg . s:dark_grey . s:bg . s:darker_grey . s:style . "NONE" call Highlight("SpecialKey", s:dark_grey, s:darker_grey, s:none)
exec "hi IncSearch" . s:fg . s:white . s:bg . s:purple . s:style . "bold,underline" call Highlight("IncSearch", s:white, s:purple, s:bold_underline)
exec "hi Search" . s:fg . s:white . s:bg . s:purple . s:style . "bold,underline" call Highlight("Search", s:white, s:purple, s:bold_underline)
exec "hi Identifier" . s:fg . s:light_blue . s:style . "NONE" call Highlight("Identifier", s:light_blue, s:none, s:none)
exec "hi Question" . s:fg . s:light_blue . s:style . "NONE" call Highlight("Question", s:light_blue, s:none, s:none)
exec "hi StorageClass" . s:fg . s:light_blue . s:style . s:italic call Highlight("StorageClass", s:light_blue, s:none, s:italic)
exec "hi Structure" . s:fg . s:light_blue . s:style . "NONE" call Highlight("Structure", s:light_blue, s:none, s:none)
exec "hi Function" . s:fg . s:light_green . s:style . "NONE" call Highlight("Function", s:light_green, s:none, s:none)
exec "hi Constant" . s:fg . s:purple . s:style . "NONE" call Highlight("Constant", s:purple, s:none, s:none)
exec "hi Directory" . s:fg . s:purple . s:style . "NONE" call Highlight("Directory", s:purple, s:none, s:none)
exec "hi Tag" . s:fg . s:purple . s:style . "NONE" call Highlight("Tag", s:purple, s:none, s:none)
call Highlight("Boolean", s:purple, s:none, s:none)
call Highlight("Character", s:purple, s:none, s:none)
call Highlight("Float", s:purple, s:none, s:none)
call Highlight("Number", s:purple, s:none, s:none)
exec "hi Folded" . s:fg . s:grey . s:bg . s:charcoal call Highlight("Folded", s:grey, s:charcoal, s:none)
exec "hi Comment" . s:fg . s:grey . s:style . s:italic call Highlight("Comment", s:grey, s:none, s:italic)
exec "hi Boolean" . s:fg . s:purple . s:style . "NONE" call Highlight("Label", s:yellow, s:none, s:none)
exec "hi Character" . s:fg . s:purple . s:style . "NONE" call Highlight("String", s:yellow, s:none, s:none)
exec "hi Float" . s:fg . s:purple . s:style . "NONE"
exec "hi Number" . s:fg . s:purple . s:style . "NONE"
exec "hi Label" . s:fg . s:yellow . s:style . "NONE" call Highlight("Todo", s:yellow, s:dark_grey, s:bold)
exec "hi String" . s:fg . s:yellow . s:style . "NONE" call Highlight("Underlined", s:none, s:none, s:underline)
exec "hi Todo" . s:fg . s:yellow . s:bg . s:dark_grey . s:style . "bold" call Highlight("Pmenu", s:light_blue, s:darker_grey, s:none)
exec "hi Underlined" . s:style . "underline" call Highlight("PmenuSel", s:yellow, s:dark_grey, s:none)
call Highlight("PmenuSbar", s:none, s:grey, s:none)
exec "hi Pmenu" . s:fg . s:light_blue . s:bg . s:darker_grey . s:style . "NONE" call Highlight("PmenuThumb", s:none, s:white, s:none)
exec "hi PmenuSel" . s:fg . s:yellow . s:bg . s:dark_grey . s:style . "NONE"
exec "hi PmenuSbar" . s:bg . s:grey . s:style . "NONE"
exec "hi PmenuThumb" . s:bg . s:white . s:style . "NONE"
" Javascript syntax overwrites from vim-javascript plugin " Javascript syntax overwrites from vim-javascript plugin
syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsTemplateString,jsDecorator,jsAsyncKeyword extend fold syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsTemplateString,jsDecorator,jsAsyncKeyword extend fold
" Javascript colour highlighting rules " Javascript colour highlighting rules
exec "hi Noise" . s:fg . s:magenta . s:style . "NONE" call Highlight("Noise", s:magenta, s:none, s:none)
call Highlight("jsParensIfElse", s:white, s:none, s:none)
call Highlight("jsParensRepeat", s:white, s:none, s:none)
call Highlight("jsParensSwitch", s:white, s:none, s:none)
call Highlight("jsParensCatch", s:white, s:none, s:none)
call Highlight("jsArrowFunction", s:light_blue, s:none, s:none)
call Highlight("jsArrowFuncArgs", s:orange, s:none, s:italic)
call Highlight("jsBrackets", s:light_green, s:none, s:none)
call Highlight("jsBraces", s:white, s:none, s:none)
call Highlight("jsFuncBraces", s:white, s:none, s:none)
call Highlight("jsClassBraces", s:white, s:none, s:none)
call Highlight("jsIfElseBraces", s:white, s:none, s:none)
call Highlight("jsTryCatchBraces", s:white, s:none, s:none)
call Highlight("jsModuleBraces", s:white, s:none, s:none)
call Highlight("jsObjectBraces", s:white, s:none, s:none)
call Highlight("jsFinallyBraces", s:white, s:none, s:none)
call Highlight("jsRepeatBraces", s:white, s:none, s:none)
call Highlight("jsSwitchBraces", s:white, s:none, s:none)
call Highlight("jsTemplateBraces", s:white, s:none, s:none)
call Highlight("jsDestructuringBraces", s:white, s:none, s:none)
call Highlight("jsFuncName", s:light_green, s:none, s:none)
call Highlight("jsFuncCall", s:light_blue, s:none, s:none)
call Highlight("jsClassFuncName", s:light_green, s:none, s:none)
call Highlight("jsArguments", s:orange, s:none, s:italic)
call Highlight("jsFuncArgs", s:orange, s:none, s:italic)
call Highlight("jsClassKeyword", s:light_blue, s:none, s:italic)
call Highlight("jsThis", s:orange, s:none, s:italic)
call Highlight("jsUndefined", s:purple, s:none, s:none)
call Highlight("jsParens", s:white, s:none, s:none)
call Highlight("jsFuncParens", s:white, s:none, s:none)
call Highlight("jsGlobalObjects", s:light_blue, s:none, s:none)
call Highlight("jsFunction", s:light_blue, s:none, s:italic)
call Highlight("jsClassMethodType", s:light_blue, s:none, s:italic)
hi def link jsComment Comment hi def link jsComment Comment
hi def link jsEnvComment Comment hi def link jsEnvComment Comment
exec "hi jsParensIfElse" . s:fg . s:white . s:style . "NONE"
exec "hi jsParensRepeat" . s:fg . s:white . s:style . "NONE"
exec "hi jsParensSwitch" . s:fg . s:white . s:style . "NONE"
exec "hi jsParensCatch" . s:fg . s:white . s:style . "NONE"
hi def link jsCommentTodo Todo hi def link jsCommentTodo Todo
hi def link jsString String hi def link jsString String
hi def link jsObjectKeyString String hi def link jsObjectKeyString String
hi def link jsTemplateString String hi def link jsTemplateString String
hi def link jsObjectStringKey String hi def link jsObjectStringKey String
hi def link jsClassStringKey String hi def link jsClassStringKey String
exec "hi jsArrowFunction" . s:fg . s:light_blue . s:style . "NONE"
exec "hi jsArrowFuncArgs" . s:fg . s:orange . s:style . s:italic
hi def link jsStorageClass StorageClass hi def link jsStorageClass StorageClass
hi def link jsNumber Number hi def link jsNumber Number
exec "hi jsBrackets" . s:fg . s:light_green . s:style . "NONE"
exec "hi jsBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsFuncBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsClassBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsIfElseBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsTryCatchBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsModuleBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsObjectBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsFinallyBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsRepeatBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsSwitchBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsTemplateBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsDestructuringBraces" . s:fg . s:white . s:style . "NONE"
exec "hi jsFuncName" . s:fg . s:light_green . s:style . "NONE"
exec "hi jsFuncCall" . s:fg . s:light_blue . s:style . "NONE"
exec "hi jsClassFuncName" . s:fg . s:light_green . s:style . "NONE"
exec "hi jsArguments" . s:fg . s:orange . s:style . s:italic
exec "hi jsFuncArgs" . s:fg . s:orange . s:style . s:italic
exec "hi jsClassKeyword" . s:fg . s:light_blue . s:style . s:italic
exec "hi jsThis" . s:fg . s:orange . s:style . s:italic
exec "hi jsUndefined" . s:fg . s:purple . s:style . "NONE"
exec "hi jsParens" . s:fg . s:white . s:style . "NONE"
exec "hi jsFuncParens" . s:fg . s:white . s:style . "NONE"
exec "hi jsGlobalObjects" . s:fg . s:light_blue . s:style . "NONE"
exec "hi jsFunction" . s:fg . s:light_blue . s:style . s:italic
exec "hi jsClassMethodType" . s:fg . s:light_blue . s:style . s:italic
hi def link jsImport Include hi def link jsImport Include
hi def link jsExport Include hi def link jsExport Include
hi def link jsModuleComma Operator hi def link jsModuleComma Operator
@@ -276,17 +291,16 @@ hi def link jsHtmlElemAttrs Label
hi def link jsHtmlElemFuncs PreProc hi def link jsHtmlElemFuncs PreProc
hi def link jsCssStyles Label hi def link jsCssStyles Label
" XML highlighting. " XML highlighting.
hi def link xmlTodo Todo hi def link xmlTodo Todo
exec "hi xmlTag" . s:fg . s:light_blue call Highlight("xmlTag", s:light_blue, s:none, s:none)
exec "hi xmlTagName" . s:fg . s:light_blue call Highlight("xmlTagName", s:light_blue, s:none, s:none)
exec "hi xmlEndTag" . s:fg . s:light_blue call Highlight("xmlEndTag", s:light_blue, s:none, s:none)
exec "hi xmlEqual" . s:fg . s:magenta call Highlight("xmlEqual", s:magenta, s:none, s:none)
" JSON highlighting " JSON highlighting
exec "hi jsonKeyword" . s:fg . s:light_blue call Highlight("jsonKeyword", s:light_blue, s:none, s:none)
exec "hi jsonString" . s:fg . s:pale_yellow call Highlight("jsonString", s:yellow, s:none, s:none)
" Must be at the end, because of ctermbg=234 bug. " Must be at the end, because of ctermbg=234 bug.
" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ " https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ