feat(color)!: Add theme.sh detection
Add support for checking if `theme.sh` is installed and if so attempt to choose a matching theme colour. Marked as breaking as this is untested outside of my environment
This commit is contained in:
parent
d249c8c9c6
commit
29e65ee8b1
|
|
@ -3,5 +3,28 @@ if not ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- default colourscheme settings
|
||||||
vim.o.background = "dark"
|
vim.o.background = "dark"
|
||||||
vim.cmd.colorscheme('gruvbox')
|
vim.cmd.colorscheme('gruvbox')
|
||||||
|
|
||||||
|
local function invertTheme()
|
||||||
|
if vim.o.background == "dark" then
|
||||||
|
vim.o.background = "light"
|
||||||
|
else
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n','<leader>i',invertTheme,{desc='Invert colourscheme'})
|
||||||
|
|
||||||
|
|
||||||
|
if vim.fn.executable('theme.sh') and vim.fn.exists('~/.config/.theme_history') then
|
||||||
|
local currentTheme = vim.fn.system('theme.sh -l | tail -n1', 'silent'):gsub('\n','')
|
||||||
|
local lightThemes = vim.fn.systemlist('theme.sh --light -l')
|
||||||
|
|
||||||
|
if vim.tbl_contains(lightThemes,currentTheme) then
|
||||||
|
vim.o.background = "light"
|
||||||
|
else
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user