feat: added color remapping

dev-assets
Pocco81 3 years ago
parent 0b9e1e36fc
commit a336b62ca7

@ -0,0 +1,22 @@
local M = {}
local cs_remaps
function M.get_remaps()
return cs_remaps
end
function M.set_remaps(val)
cs_remaps = val
end
function M.get_color_scheme(cs)
local remaps = M.get_remaps()
if not (next(remaps) == nil) then
return vim.tbl_deep_extend("force", require("catppuccino.color_schemes." .. cs), remaps)
else
return require("catppuccino.color_schemes." .. cs)
end
end
return M

@ -182,11 +182,13 @@ local function get_integrations()
return final_integrations return final_integrations
end end
function M.apply() function M.apply(cs)
local theme = {}
_G.cpc = require("catppuccino.config").options _G.cpc = require("catppuccino.config").options
_G.cpt = require("catppuccino.color_schemes." .. cpc.colorscheme) cs = cs or cpc.colorscheme
-- _G.cpt = require("catppuccino.color_schemes." .. cs)
_G.cpt = require("catppuccino.core.cs").get_color_scheme(cs)
local theme = {}
theme.base = get_base() theme.base = get_base()
theme.plugins = get_integrations() theme.plugins = get_integrations()

@ -15,8 +15,10 @@ function M.load()
end end
end end
function M.setup(custom_opts) function M.setup(custom_opts, remaps)
remaps = remaps or {}
require("catppuccino.config").set_options(custom_opts) require("catppuccino.config").set_options(custom_opts)
require("catppuccino.core.cs").set_remaps(remaps)
end end
return M return M

@ -2,11 +2,11 @@ local M = {}
local utils = require("catppuccino.utils.util") local utils = require("catppuccino.utils.util")
function M.main(option) function M.main(option, args)
option = option or "load" option = option or "load"
if (option == "load") then if (option == "load") then
utils.load(require("catppuccino.core.mapper").apply()) utils.load(require("catppuccino.core.mapper").apply(args))
else else
print("Catppuccino: Command was not recognized") print("Catppuccino: Command was not recognized")
end end

Loading…
Cancel
Save