Closed adben27 closed 1 year ago
You need set background=light
in your vimrc. Neovim defaults to "dark".
In case this doesn't work, or if you prefer the light/dark background to be determined automatically, I recommend using an autocmd as the one below to reload lightline upon colorscheme changes (this will also be executed during the initial loading of the colorscheme):
-- Reload lightline on colorscheme change.
-- Must be declared before executing ':colorscheme'.
grpid = vim.api.nvim_create_augroup('lightline_reload_colorscheme', {})
vim.api.nvim_create_autocmd('ColorScheme', {
group = grpid,
pattern = '*',
command = 'call nviminit#lightline#SetColorscheme() | ' ..
'call nviminit#lightline#Reload()'
})
Where the two functions from the command are something like:
https://github.com/antoineco/dotfiles/blob/91d0e4b7/nvim/autoload/nviminit/lightline.vim
First, thanks for your answer. But I wonder if you could help me on this.
I want to set background
depending on the kitty theme (it's changed with the GNOME extension Night Theme Switcher at sunset/rise time)
So, i found a way to extract only the name of the current kitty theme, but i just can't figure out how to make it work. I'm quite a noob at vimscript.
So, here is my idea.
let ${KITTY_THEME}={grep -Po '## name: \K[^"]*' ~/.config/kitty/current-theme.conf}
if(KITTY_THEME == 'Gruvbox Material Light Medium')
set background=light
else
set background=dark
endif
A similar use case is described in details here: https://arslan.io/2021/02/15/automatic-dark-mode-for-terminal-applications/
I think you should be able to achieve something similar with your setup.
I have done the following steps before reporting this issue:
Operating system/version
Fedora 37
Terminal emulator/version
kitty 0.26.5
$TERM environment variable
xterm-kitty
Tmux version
No response
Feature matrix
Minimal vimrc that can reproduce this bug.
Steps to reproduce this bug using minimal vimrc
"Link" init.vim to .vimrc with
Launch vim and see that the theme of lightline is correct.
Launch nvim and see that the theme is dark even if background is light
Expected behavior
Having lightline light theme when background is light.
Actual behavior
The lightline theme is dark even if background is light