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 util = require("catppuccino.utils.util")
local M = {}
function M.get(cpt)
return { return {
BufferLineFill = {bg = util.brighten(cpt.bg, 0.04)}, BufferLineFill = {bg = util.brighten(cpt.bg, 0.04)},
BufferLineBackground = {fg = cpt.gray, bg = cpt.black}, BufferLineBackground = {fg = cpt.gray, bg = cpt.black},
@ -9,14 +12,15 @@ return {
BufferLineTabSelected = {fg = cpt.red, bg = cpt.blue}, BufferLineTabSelected = {fg = cpt.red, bg = cpt.blue},
BufferLineTabClose = {fg = cpt.red, bg = cpt.black}, BufferLineTabClose = {fg = cpt.red, bg = cpt.black},
BufferLineIndicatorSelected = {fg = cpt.bg, bg = cpt.bg}, BufferLineIndicatorSelected = {fg = cpt.bg, bg = cpt.bg},
-- separators -- separators
BufferLineSeparator = {fg = cpt.black, bg = cpt.black}, BufferLineSeparator = {fg = cpt.black, bg = cpt.black},
BufferLineSeparatorVisible = {fg = cpt.black, bg = cpt.black}, BufferLineSeparatorVisible = {fg = cpt.black, bg = cpt.black},
BufferLineSeparatorSelected = {fg = cpt.black, bg = cpt.black}, BufferLineSeparatorSelected = {fg = cpt.black, bg = cpt.black},
-- close buttons -- close buttons
BufferLineCloseButton = {fg = cpt.gray, bg = cpt.black}, BufferLineCloseButton = {fg = cpt.gray, bg = cpt.black},
BufferLineCloseButtonVisible = {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 { return {
IndentBlanklineChar = {fg = cpt.gray} IndentBlanklineChar = {fg = cpt.gray}
} }
end
return M

@ -1,3 +1,6 @@
local M = {}
function M.get(cpt)
return { return {
-- These groups are for the native LSP cliencpt. Some other LSP clients may -- 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 -- 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 LspDiagnosticsUnderlineWarning = {style = "underline", sp = cpt.warning}, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation = {style = "underline", sp = cpt.info}, -- Used to underline "Information" diagnostics LspDiagnosticsUnderlineInformation = {style = "underline", sp = cpt.info}, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint = {style = "underline", sp = cpt.hint}, -- Used to underline "Hint" 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 { return {
NvimTreeFolderName = {fg = cpt.blue}, NvimTreeFolderName = {fg = cpt.blue},
NvimTreeFolderIcon = {fg = cpt.blue}, NvimTreeFolderIcon = {fg = cpt.blue},
@ -14,5 +17,8 @@ return {
NvimTreeGitDeleted = {fg = cpt.git.delete}, NvimTreeGitDeleted = {fg = cpt.git.delete},
NvimTreeSpecialFile = {fg = cpt.cyan}, NvimTreeSpecialFile = {fg = cpt.cyan},
NvimTreeImageFile = {fg = cpt.fg_sidebar}, 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 util = require("catppuccino.utils.util")
local M = {}
function M.get(cpt)
return { return {
-- These groups are for the neovim tree-sitter highlights. -- These groups are for the neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change. -- As of writing, tree-sitter support is a WIP, group names may change.
@ -64,3 +66,7 @@ return {
-- TSLiteral = { }; -- Literal texcpt. -- TSLiteral = { }; -- Literal texcpt.
-- TSURI = { }; -- Any URI like a link or email. -- TSURI = { }; -- Any URI like a link or email.
} }
end
return M

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

Loading…
Cancel
Save