fix: refactor to be able to properly reload all hi groups

dev-assets
Pocco81 3 years ago
parent 159037858b
commit 0dec7a2049

@ -1,5 +1,8 @@
local util = require("catppuccino.utils.util")
local M = {}
function M.get(cpt)
return {
BufferLineFill = {bg = util.brighten(cpt.bg, 0.04)},
BufferLineBackground = {fg = cpt.gray, bg = cpt.black},
@ -9,14 +12,15 @@ return {
BufferLineTabSelected = {fg = cpt.red, bg = cpt.blue},
BufferLineTabClose = {fg = cpt.red, bg = cpt.black},
BufferLineIndicatorSelected = {fg = cpt.bg, bg = cpt.bg},
-- separators
BufferLineSeparator = {fg = cpt.black, bg = cpt.black},
BufferLineSeparatorVisible = {fg = cpt.black, bg = cpt.black},
BufferLineSeparatorSelected = {fg = cpt.black, bg = cpt.black},
-- close buttons
BufferLineCloseButton = {fg = cpt.gray, bg = cpt.black},
BufferLineCloseButtonVisible = {fg = cpt.gray, bg = cpt.black},
BufferLineCloseButtonSelected = {fg = cpt.red, bg = cpt.bg},
BufferLineCloseButtonSelected = {fg = cpt.red, bg = cpt.bg}
}
end
return M

@ -1,3 +1,9 @@
local M = {}
function M.get(cpt)
return {
IndentBlanklineChar = {fg = cpt.gray}
}
end
return M

@ -1,3 +1,6 @@
local M = {}
function M.get(cpt)
return {
-- These groups are for the native LSP cliencpt. Some other LSP clients may
-- use these groups, or use their own. Consult your LSP client's
@ -28,5 +31,8 @@ return {
LspDiagnosticsUnderlineWarning = {style = "underline", sp = cpt.warning}, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation = {style = "underline", sp = cpt.info}, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint = {style = "underline", sp = cpt.hint}, -- Used to underline "Hint" diagnostics
LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens
LspCodeLens = {fg = cpt.comment} -- virtual text of the codelens
}
end
return M

@ -1,3 +1,6 @@
local M = {}
function M.get(cpt)
return {
NvimTreeFolderName = {fg = cpt.blue},
NvimTreeFolderIcon = {fg = cpt.blue},
@ -14,5 +17,8 @@ return {
NvimTreeGitDeleted = {fg = cpt.git.delete},
NvimTreeSpecialFile = {fg = cpt.cyan},
NvimTreeImageFile = {fg = cpt.fg_sidebar},
NvimTreeOpenedFile = {fg = cpt.magenta},
NvimTreeOpenedFile = {fg = cpt.magenta}
}
end
return M

@ -1,5 +1,7 @@
local util = require("catppuccino.utils.util")
local M = {}
function M.get(cpt)
return {
-- These groups are for the neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change.
@ -64,3 +66,7 @@ return {
-- TSLiteral = { }; -- Literal texcpt.
-- TSURI = { }; -- Any URI like a link or email.
}
end
return M

@ -2,7 +2,20 @@ local util = require("catppuccino.utils.util")
local M = {}
local _cs
local function get_cs() -- return a cleaned and parsed colorscheme
return _cs
end
local function set_cs(val)
_cs = val
end
local function get_base()
local cpt = get_cs()
return {
Comment = {fg = cpt.comment, style = cpc.styles.comments}, -- any comment
ColorColumn = {bg = cpt.bg_visual}, -- used for the columns set with 'colorcolumn'
@ -163,6 +176,7 @@ end
local function get_integrations()
local integrations = cpc["integrations"]
local final_integrations = {}
local cpt = get_cs()
for integration in pairs(integrations) do
local cot = false
@ -177,13 +191,14 @@ local function get_integrations()
end
if (cot) then
table.insert(final_integrations, require("catppuccino.core.integrations." .. integration))
table.insert(final_integrations, require("catppuccino.core.integrations." .. integration).get(cpt))
end
end
return final_integrations
end
function M.apply(cs)
_G.cpc = require("catppuccino.config").options
cs = cs or cpc.colorscheme
@ -193,7 +208,7 @@ function M.apply(cs)
return false, color_scheme -- error message
end
_G.cpt = color_scheme
set_cs(color_scheme)
local theme = {}
theme.base = get_base()
@ -201,7 +216,6 @@ function M.apply(cs)
-- uninstantiate to avoid poluting global scope and because they are not needed anymore
_G.cpc = nil
_G.cpt = nil
return true, theme
end

Loading…
Cancel
Save