0

I run Neovim on tmux on iTerm2, but now I'm struggling to change the color of my Python code. I use python-mode library to change the syntax of the Python code.

However, many colors I try to set got me the error:

Color name or number not recognized: ctermfg=DarkSeaGreen3

The DarkSeaGreen3 color is available according to the following website, but in my case it does not work.

My $TERM is xterm-256color and I set the following to my vim init script.

filetype plugin indent on
syntax on
set t_Co=256
set background=dark

How can I make the color working on my vim?

3

That list is not proof that you have one particular color or another. Color availability is highly dependent on environment. If you follow the link provided on that page you'll find scripts that allow you to generate your own list.

That being said ctermfg is for setting colors for consoles which invariably can display just a fraction of the number of colors that are available to GUIs. It's unlikely that your console has a color mapped to "DarkSeaGreen3". If you use gvim, on the other hand, then guifg=DarkSeaGreen3 will likely work.

Did that ctermfg line come from a third party file, e.g. a color scheme, or is it just something you tried? If the former I suggest you find some schemes that are portable/console-friendly. (FYI, I have a handful of color schemes that reference DarkSeaGreen3 but none of them attempt to use it with the console.) If, on the other hand, you just entered that line yourself then rest assured that it won't work for a lot of other people either (including myself...same error message).

See also :h :colo, :h highlight-args, :h highlight-ctermfg.

  • The ctermfg is what I tried to write, and I use neovim via tmux on iTerm2, which I found should be guifg. The linked script worked perfectly. Thanks! – Blaszard Jul 6 '18 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.