macosterminalneovimcolor-scheme

Neovim color schemes fail on Mac terminal


Switching from VSCode-Vim to Neovim on my Mac, I'm trying to change some color schemes.

However, when I change with :colorscheme <color>, the changes in the window don't reflect what they should.

I originally found this error while trying to load a separate color scheme from github and it didn't work, then tried others and builtin ones and they all are wrong:

Choosing a scheme: choosing scheme

After chosen: after chosen

It seems all these default schemes are derivative of green highlight on white text on black background.

I figured it probably has something to do with Terminal preferences, but couldn't find any solutions.

Thanks!


Solution

  • So you are using the builtin terminal of macOS? If that is the case, probably because the builtin terminal does not support true colors. Get yourself a decent terminal emulator, like, kitty terminal, wezterm, iterm2, ghostty.

    Add the following to your nvim config init.lua:

    vim.o.termguicolors=true
    

    Install a color scheme supporting true color, like gruvbox-material.

    Switch to it vim.cmd[[colorsheme gruvbox-material]]. It should work.