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

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

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

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

@ -1,32 +1,38 @@
return { local M = {}
-- 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
-- documentation.
LspReferenceText = {bg = cpt.fg_gutter}, -- used for highlighting "text" references
LspReferenceRead = {bg = cpt.fg_gutter}, -- used for highlighting "read" references
LspReferenceWrite = {bg = cpt.fg_gutter}, -- used for highlighting "write" references
-- hightlight diagnostics in numberline
LspDiagnosticsDefaultError = {fg = cpt.error}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning = {fg = cpt.warning}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultInformation = {fg = cpt.info}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultHint = {fg = cpt.hint}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspSignatureActiveParameter = {fg = cpt.orange},
-- LspDiagnosticsFloatingError = { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning = { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation = { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint = { }, -- Used to color "Hint" diagnostic messages in diagnostics float
LspDiagnosticsError = {fg = cpt.error}, function M.get(cpt)
LspDiagnosticsWarning = {fg = cpt.warning}, return {
LspDiagnosticsInformation = {fg = cpt.info}, -- These groups are for the native LSP cliencpt. Some other LSP clients may
LspDiagnosticsHint = {fg = cpt.hint}, -- use these groups, or use their own. Consult your LSP client's
LspDiagnosticsVirtualTextError = {fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors}, -- Used for "Error" diagnostic virtual text -- documentation.
LspDiagnosticsVirtualTextWarning = {fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings}, -- Used for "Warning" diagnostic virtual text LspReferenceText = {bg = cpt.fg_gutter}, -- used for highlighting "text" references
LspDiagnosticsVirtualTextInformation = {fg = cpt.info, style = cpc.integrations.native_lsp.styles.information}, -- Used for "Information" diagnostic virtual text LspReferenceRead = {bg = cpt.fg_gutter}, -- used for highlighting "read" references
LspDiagnosticsVirtualTextHint = {fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints}, -- Used for "Hint" diagnostic virtual text LspReferenceWrite = {bg = cpt.fg_gutter}, -- used for highlighting "write" references
LspDiagnosticsUnderlineError = {style = "underline", sp = cpt.error}, -- Used to underline "Error" diagnostics -- hightlight diagnostics in numberline
LspDiagnosticsUnderlineWarning = {style = "underline", sp = cpt.warning}, -- Used to underline "Warning" diagnostics LspDiagnosticsDefaultError = {fg = cpt.error}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsUnderlineInformation = {style = "underline", sp = cpt.info}, -- Used to underline "Information" diagnostics LspDiagnosticsDefaultWarning = {fg = cpt.warning}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsUnderlineHint = {style = "underline", sp = cpt.hint}, -- Used to underline "Hint" diagnostics LspDiagnosticsDefaultInformation = {fg = cpt.info}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens LspDiagnosticsDefaultHint = {fg = cpt.hint}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
} LspSignatureActiveParameter = {fg = cpt.orange},
-- LspDiagnosticsFloatingError = { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning = { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation = { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint = { }, -- Used to color "Hint" diagnostic messages in diagnostics float
LspDiagnosticsError = {fg = cpt.error},
LspDiagnosticsWarning = {fg = cpt.warning},
LspDiagnosticsInformation = {fg = cpt.info},
LspDiagnosticsHint = {fg = cpt.hint},
LspDiagnosticsVirtualTextError = {fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors}, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning = {fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings}, -- Used for "Warning" diagnostic virtual text
LspDiagnosticsVirtualTextInformation = {fg = cpt.info, style = cpc.integrations.native_lsp.styles.information}, -- Used for "Information" diagnostic virtual text
LspDiagnosticsVirtualTextHint = {fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints}, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError = {style = "underline", sp = cpt.error}, -- Used to underline "Error" diagnostics
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
}
end
return M

@ -1,18 +1,24 @@
return { local M = {}
NvimTreeFolderName = {fg = cpt.blue},
NvimTreeFolderIcon = {fg = cpt.blue}, function M.get(cpt)
NvimTreeNormal = {fg = cpt.fg, bg = cpt.bg_sidebar}, return {
NvimTreeOpenedFolderName = {fg = cpt.blue}, NvimTreeFolderName = {fg = cpt.blue},
NvimTreeEmptyFolderName = {fg = cpt.blue_br}, NvimTreeFolderIcon = {fg = cpt.blue},
NvimTreeIndentMarker = {fg = cpt.comment}, NvimTreeNormal = {fg = cpt.fg, bg = cpt.bg_sidebar},
NvimTreeVertSplit = {fg = cpt.black, bg = cpt.black}, NvimTreeOpenedFolderName = {fg = cpt.blue},
NvimTreeRootFolder = {fg = cpt.black, style = "bold"}, NvimTreeEmptyFolderName = {fg = cpt.blue_br},
NvimTreeSymlink = {fg = cpt.magenta}, NvimTreeIndentMarker = {fg = cpt.comment},
NvimTreeStatuslineNc = {fg = cpt.black, bg = cpt.black}, NvimTreeVertSplit = {fg = cpt.black, bg = cpt.black},
NvimTreeGitDirty = {fg = cpt.git.change}, NvimTreeRootFolder = {fg = cpt.black, style = "bold"},
NvimTreeGitNew = {fg = cpt.git.add}, NvimTreeSymlink = {fg = cpt.magenta},
NvimTreeGitDeleted = {fg = cpt.git.delete}, NvimTreeStatuslineNc = {fg = cpt.black, bg = cpt.black},
NvimTreeSpecialFile = {fg = cpt.cyan}, NvimTreeGitDirty = {fg = cpt.git.change},
NvimTreeImageFile = {fg = cpt.fg_sidebar}, NvimTreeGitNew = {fg = cpt.git.add},
NvimTreeOpenedFile = {fg = cpt.magenta}, NvimTreeGitDeleted = {fg = cpt.git.delete},
} NvimTreeSpecialFile = {fg = cpt.cyan},
NvimTreeImageFile = {fg = cpt.fg_sidebar},
NvimTreeOpenedFile = {fg = cpt.magenta}
}
end
return M

@ -1,66 +1,72 @@
local util = require("catppuccino.utils.util") local util = require("catppuccino.utils.util")
local M = {}
return { function M.get(cpt)
-- These groups are for the neovim tree-sitter highlights. return {
-- As of writing, tree-sitter support is a WIP, group names may change. -- These groups are for the neovim tree-sitter highlights.
-- By default, most of these groups link to an appropriate Vim group, -- As of writing, tree-sitter support is a WIP, group names may change.
-- TSError -> Error for example, so you do not have to define these unless -- By default, most of these groups link to an appropriate Vim group,
-- you explicitly want to support Treesitter's improved syntax awareness. -- TSError -> Error for example, so you do not have to define these unless
-- you explicitly want to support Treesitter's improved syntax awareness.
-- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
-- TSAttribute = { }; -- (unstable) TODO: docs
-- TSBoolean = { }; -- For booleans.
-- TSCharacter = { }; -- For characters.
-- TSComment = { }; -- For comment blocks.
TSNote = {fg = cpt.bg, bg = cpt.info},
TSWarning = {fg = cpt.bg, bg = cpt.warning},
TSDanger = {fg = cpt.bg, bg = cpt.error},
TSConstructor = {fg = cpt.magenta}, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
-- TSConditional = { }; -- For keywords related to conditionnals.
TSConstant = {fg = cpt.orange}, -- For constants
TSConstBuiltin = {fg = cpt.orange_br}, -- For constant that are built in the language: `nil` in Lua.
-- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in cpt.
-- TSError = { }; -- For syntax/parser errors.
-- TSException = { }; -- For exception related keywords.
TSField = {fg = cpt.red}, -- For fields.
rustTSField = {fg = util.darken(cpt.white, 0.75)}, -- For fields.
-- TSFloat = { }; -- For floats.
-- TSFunction = { fg = cpt.fg_gutter }, -- For function (calls and definitions).
TSFuncBuiltin = {fg = cpt.cyan}, -- For builtin functions: `table.insert` in Lua.
TSFuncMacro = {fg = cpt.red}, -- For macro defined fuctions (calls and definitions): each `macro_rules` in Ruscpt.
-- TSInclude = { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
TSKeyword = {fg = cpt.magenta, style = cpc.styles.keywords}, -- For keywords that don't fall in previous categories.
TSKeywordFunction = {fg = cpt.magenta, style = cpc.styles.fuctions}, -- For keywords used to define a fuction.
TSLabel = {fg = cpt.blue}, -- For labels: `label:` in C and `:label:` in Lua.
-- TSMethod = { }; -- For method calls and definitions.
TSNamespace = {fg = cpt.cyan}, -- For identifiers referring to modules and namespaces.
-- TSNone = { }; -- TODO: docs
-- TSNumber = { }; -- For all numbers
TSOperator = {fg = cpt.fg}, -- For any operator: `+`, but also `->` and `*` in cpt.
TSParameter = {fg = cpt.orange_br}, -- For parameters of a function.
-- TSParameterReference= { }; -- For references to parameters of a function.
TSProperty = {fg = cpt.red_bg}, -- Same as `TSField`.
tomlTSProperty = {fg = cpt.blue}, -- Differentiates between string and properties
TSPunctDelimiter = {fg = util.string_to_color(cpt, "", cpt.fg_alt)}, -- For delimiters ie: `.`
TSPunctBracket = {fg = cpt.red}, -- For brackets and parenthesis.
TSPunctSpecial = {fg = cpt.white}, -- For special punctutation that does not fall in the catagories before.
-- TSRepeat = { }; -- For keywords related to loops.
-- TSString = { }; -- For strings.
TSStringRegex = {fg = cpt.blue, style = cpc.styles.strings}, -- For regexes.
TSStringEscape = {fg = cpt.magenta, style = cpc.styles.strings}, -- For escape characters within a string.
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
-- TSType = { }; -- For types.
TSTypeBuiltin = {fg = cpt.cyan}, -- For builtin types.
TSVariable = {style = cpc.styles.variables}, -- Any variable name that does not have another highlighcpt.
TSVariableBuiltin = {fg = cpt.red}, -- Variable names that are defined by the languages, like `this` or `self`.
-- TSTag = { }; -- Tags like html tag names.
-- TSTagDelimiter = { }; -- Tag delimiter like `<` `>` `/`
-- TSText = { }; -- For strings considered text in a markup language.
TSTextReference = {fg = cpt.cyan}
-- TSEmphasis = { }; -- For text to be represented with emphasis.
-- TSUnderline = { }; -- For text to be represented with an underline.
-- TSStrike = { }; -- For strikethrough texcpt.
-- TSTitle = { }; -- Text that is part of a title.
-- TSLiteral = { }; -- Literal texcpt.
-- TSURI = { }; -- Any URI like a link or email.
}
end
return M
-- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
-- TSAttribute = { }; -- (unstable) TODO: docs
-- TSBoolean = { }; -- For booleans.
-- TSCharacter = { }; -- For characters.
-- TSComment = { }; -- For comment blocks.
TSNote = {fg = cpt.bg, bg = cpt.info},
TSWarning = {fg = cpt.bg, bg = cpt.warning},
TSDanger = {fg = cpt.bg, bg = cpt.error},
TSConstructor = {fg = cpt.magenta}, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
-- TSConditional = { }; -- For keywords related to conditionnals.
TSConstant = {fg = cpt.orange}, -- For constants
TSConstBuiltin = {fg = cpt.orange_br}, -- For constant that are built in the language: `nil` in Lua.
-- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in cpt.
-- TSError = { }; -- For syntax/parser errors.
-- TSException = { }; -- For exception related keywords.
TSField = {fg = cpt.red}, -- For fields.
rustTSField = {fg = util.darken(cpt.white, 0.75)}, -- For fields.
-- TSFloat = { }; -- For floats.
-- TSFunction = { fg = cpt.fg_gutter }, -- For function (calls and definitions).
TSFuncBuiltin = {fg = cpt.cyan}, -- For builtin functions: `table.insert` in Lua.
TSFuncMacro = {fg = cpt.red}, -- For macro defined fuctions (calls and definitions): each `macro_rules` in Ruscpt.
-- TSInclude = { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
TSKeyword = {fg = cpt.magenta, style = cpc.styles.keywords}, -- For keywords that don't fall in previous categories.
TSKeywordFunction = {fg = cpt.magenta, style = cpc.styles.fuctions}, -- For keywords used to define a fuction.
TSLabel = {fg = cpt.blue}, -- For labels: `label:` in C and `:label:` in Lua.
-- TSMethod = { }; -- For method calls and definitions.
TSNamespace = {fg = cpt.cyan}, -- For identifiers referring to modules and namespaces.
-- TSNone = { }; -- TODO: docs
-- TSNumber = { }; -- For all numbers
TSOperator = {fg = cpt.fg}, -- For any operator: `+`, but also `->` and `*` in cpt.
TSParameter = {fg = cpt.orange_br}, -- For parameters of a function.
-- TSParameterReference= { }; -- For references to parameters of a function.
TSProperty = {fg = cpt.red_bg}, -- Same as `TSField`.
tomlTSProperty = {fg = cpt.blue}, -- Differentiates between string and properties
TSPunctDelimiter = {fg = util.string_to_color(cpt, "", cpt.fg_alt)}, -- For delimiters ie: `.`
TSPunctBracket = {fg = cpt.red}, -- For brackets and parenthesis.
TSPunctSpecial = {fg = cpt.white}, -- For special punctutation that does not fall in the catagories before.
-- TSRepeat = { }; -- For keywords related to loops.
-- TSString = { }; -- For strings.
TSStringRegex = {fg = cpt.blue, style = cpc.styles.strings}, -- For regexes.
TSStringEscape = {fg = cpt.magenta, style = cpc.styles.strings}, -- For escape characters within a string.
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
-- TSType = { }; -- For types.
TSTypeBuiltin = {fg = cpt.cyan}, -- For builtin types.
TSVariable = {style = cpc.styles.variables}, -- Any variable name that does not have another highlighcpt.
TSVariableBuiltin = {fg = cpt.red}, -- Variable names that are defined by the languages, like `this` or `self`.
-- TSTag = { }; -- Tags like html tag names.
-- TSTagDelimiter = { }; -- Tag delimiter like `<` `>` `/`
-- TSText = { }; -- For strings considered text in a markup language.
TSTextReference = {fg = cpt.cyan}
-- TSEmphasis = { }; -- For text to be represented with emphasis.
-- TSUnderline = { }; -- For text to be represented with an underline.
-- TSStrike = { }; -- For strikethrough texcpt.
-- TSTitle = { }; -- Text that is part of a title.
-- TSLiteral = { }; -- Literal texcpt.
-- TSURI = { }; -- Any URI like a link or email.
}

@ -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