nvim: select colorscheme based on alacritty theme

the theme is read from file so this also works in tmux
This commit is contained in:
Łukasz Pankowski 2024-06-15 12:05:24 +02:00
parent bfe74b7499
commit afc7829f1f
2 changed files with 13 additions and 7 deletions

View File

@ -112,10 +112,8 @@ vim.keymap.set("n", "<leader>ss", "<cmd>source ~/.config/nvim/after/plugin/luasn
key('n', '<F6>', function()
if vim.o.background == "dark" then
vim.cmd.colorscheme("bamboo-light")
-- vim.o.background = "light"
vim.o.background = "light"
else
vim.cmd.colorscheme("bamboo-vulgaris")
-- vim.o.background = "dark"
vim.o.background = "dark"
end
end)

View File

@ -1,5 +1,13 @@
local function cwd()
return vim.fn.getcwd()
local function termnalbg()
local ok, lines = pcall(io.lines, os.getenv('HOME') .. '/.config/alacritty/alacritty.toml')
if ok then
for line in lines do
if string.find(line, 'light.toml') then
return "light"
end
end
end
return "dark"
end
return {
@ -13,7 +21,7 @@ return {
-- optional configuration here
}
require('bamboo').load()
vim.cmd.colorscheme("bamboo-vulgaris")
vim.o.background = termnalbg()
end,
},
{