morhetz / gruvbox

Retro groove color scheme for Vim
13.63k stars 1.11k forks source link

How can I change some colors for some file types? #272

Closed azat-io closed 5 years ago

azat-io commented 5 years ago

Could you help me, is there any way to change some colors? For example if I need to change colors of JSON file, like this:

highlight! link jsonKeyword GruvboxAqua
highlight! link jsonQuote GruvboxAqua
highlight! link jsonBraces GruvboxYellow
highlight! link jsonString GruvboxYellow
BlakeWilliams commented 5 years ago

I customize a good number of colors in my dotfiles, this may help: https://github.com/BlakeWilliams/dotfiles/blob/master/config/nvim/colors.vim#L4-L27

azat-io commented 5 years ago

@BlakeWilliams Thank you for response

This code works for me:

function! s:setColors()
  if (&t_Co >= 256)
    execute 'highlight jsonKeyword ctermfg=14'
    execute 'highlight jsonQuote ctermfg=14'
    execute 'highlight jsonBraces ctermfg=11'
    execute 'highlight jsonString ctermfg=11'
  endif
endfunction

autocmd ColorScheme * call s:setColors()