Getting the same Neovim colors in terminal and tmux

One problem I ran into lately is getting the same Neovim colors in a terminal, and tmux. In the end, Neovim was setting a light background in the terminal, and a dark background in tmux, even with a light theme such as Solarized. The solution was to set the following in my Neovim config:

vim.opt.background = "light" 

This forces Vim to always have a light background.

It uses onedark theme which is ok. I like dracula theme more but for now I did something like this

  122 -- vim.cmd [[colorscheme onedark]]
  123 require('onedark').setup {
  124 ┊ ┊ -- style = 'light',
  125 ┊ ┊ toggle_style_key = '<space>ts',
  126 ┊ ┊ toggle_style_list = {'dark', 'light'}, -- List of styles to toggle between
  127 ┊ ┊ -- toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between
  128 }

now I can toggle with space+ts cmd strokes

1 Like