Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

E421: Getting color name not recognized in perfectly valid statement

Tags:

vim

hex

colors

I want to change the colors of my parentheses colorized with Better Rainbow Parentheses.

The colors are specified like this:

let g:rbpt_colorpairs = [
    \ ['brown',       'RoyalBlue3'],
    \ ['Darkblue',    'SeaGreen3'],
    \ ['darkgray',    'DarkOrchid3'],
    \ ['darkgreen',   'firebrick3'],
    \ ['darkcyan',    'RoyalBlue3'],
    \ ['darkred',     'SeaGreen3'],
    \ ['darkmagenta', 'DarkOrchid3'],
    …
    \ ]

The function changing the colors in the plugin is this:

func! rainbow_parentheses#toggle()
    if !exists('s:active')
        cal rainbow_parentheses#load(0)
    endif
    let afunc = exists('s:active') && s:active ? 'clear' : 'activate'
    cal call('rainbow_parentheses#'.afunc, [])
endfunc

Since I’m using Solarized I want specific hex colors, so I got this:

let g:rbpt_colorpairs = [
    \ ['yellow',    '#b58900'],
    \ ['orange',       '#cb4b16'],
    \ ['red',    '#dc322f'],
    \ ['magenta',   '#d33682'],
    \ ['violet',    '#6c71c4'],
    \ ['blue',     '#268bd2'],
    \ ['cyan', '#2aa198'],
    …
    \ ]

Yet, on restart and turning the plugin on, I get this error multiple times:

E421: Color name or number not recognized: cterm=orange guifg=#cb4b16

Even better, doing the :exe done in the function manually works like a charm, like:

:exe 'hi default level4c ctermfg=orange guifg=#cb4b16'

Even with concatenation it works:

:let foo = '#cb4b16
:exe 'hi default level4c ctermfg=orange guifg='.foo

What could be wrong?!

like image 570
Profpatsch Avatar asked Mar 26 '13 09:03

Profpatsch


1 Answers

The problem is not in the GUI RGB color, it's in the cterm=orange definition.

See :help cterm-colors for recognized values; orange is not one of them.

like image 63
Ingo Karkat Avatar answered Oct 23 '22 06:10

Ingo Karkat