Updated theme selector

This commit is contained in:
2025-05-04 14:49:59 +02:00
parent 12648eef7d
commit df5be31636
2 changed files with 8 additions and 8 deletions

View File

@@ -13,18 +13,17 @@ local filechange = augroup("filechange", { clear = true })
cmd("SetTheme", function(arg) cmd("SetTheme", function(arg)
local themeselected = arg.fargs[1] local themeselected = arg.fargs[1]
local getallthemes = themefuncs.getAllThemes() local allthemes = themefuncs.get_all_themes()
for _, theme in ipairs(getallthemes) do if vim.tbl_contains(allthemes, themeselected) then
if theme == themeselected then themefuncs.change_theme(themeselected)
vim.cmd("colorscheme " .. themeselected) else
themefuncs.applytofile(themeselected) vim.notify("Invalid selection", vim.log.levels.ERROR)
end
end end
end, { end, {
desc = "Select a theme", desc = "Select a theme",
nargs = 1, nargs = 1,
complete = function() complete = function()
local getallthemes = themefuncs.getAllThemes() local getallthemes = themefuncs.get_all_themes()
return getallthemes return getallthemes
end, end,
}) })

View File

@@ -9,11 +9,12 @@ function M.themeselector(opts)
local action_state = require("telescope.actions.state") local action_state = require("telescope.actions.state")
local action_set = require("telescope.actions.set") local action_set = require("telescope.actions.set")
local ivytheme = require("telescope.themes").get_ivy() local ivytheme = require("telescope.themes").get_ivy()
local prefs = require("taken.prefs")
local themes = themefuncs.get_all_themes() local themes = themefuncs.get_all_themes()
local change_theme = themefuncs.change_theme local change_theme = themefuncs.change_theme
local current_theme = vim.g.colors_name local current_theme = prefs.colorscheme
opts = opts or {} opts = opts or {}
local combined = vim.tbl_extend("force", ivytheme, { local combined = vim.tbl_extend("force", ivytheme, {