Updated theme func
This commit is contained in:
@@ -3,7 +3,7 @@ local configDir = vim.fn.stdpath("config")
|
||||
local prefsFile = configDir .. "/lua/taken/prefs.lua"
|
||||
|
||||
--- @return Themes
|
||||
local getAllThemes = function()
|
||||
local get_all_themes = function()
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "ThemeSwitcher", modeline = false })
|
||||
|
||||
local colors = vim.fn.globpath(vim.o.rtp, "colors/*", true, true)
|
||||
@@ -33,7 +33,7 @@ end
|
||||
--- change theme
|
||||
--- @param old string
|
||||
--- @param new string
|
||||
local change_theme = function(old, new)
|
||||
local write_to_file = function(old, new)
|
||||
-- function from nvchad
|
||||
local file = io.open(prefsFile, "r")
|
||||
|
||||
@@ -58,7 +58,7 @@ end
|
||||
|
||||
--- applytofile
|
||||
--- @param choice string
|
||||
local applytofile = function(choice)
|
||||
local change_theme = function(choice)
|
||||
if choice == nil then
|
||||
vim.notify("No theme selected!", 4)
|
||||
return
|
||||
@@ -66,7 +66,7 @@ local applytofile = function(choice)
|
||||
|
||||
vim.cmd("colorscheme " .. choice)
|
||||
local newstring = 'M.colorscheme = "' .. choice .. '"'
|
||||
change_theme(oldstring, newstring)
|
||||
write_to_file(oldstring, newstring)
|
||||
|
||||
local cursorcolumncolor = vim.fn.synIDattr(vim.fn.hlID("CursorColumn"), "bg")
|
||||
if cursorcolumncolor ~= "" then
|
||||
@@ -75,7 +75,6 @@ local applytofile = function(choice)
|
||||
end
|
||||
|
||||
return {
|
||||
getAllThemes = getAllThemes,
|
||||
get_all_themes = get_all_themes,
|
||||
change_theme = change_theme,
|
||||
applytofile = applytofile,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user