diff --git a/lua/catppuccin/api/colors.lua b/lua/catppuccin/api/colors.lua index 7231428..a950c97 100644 --- a/lua/catppuccin/api/colors.lua +++ b/lua/catppuccin/api/colors.lua @@ -1,7 +1,7 @@ local M = {} function M.get_colors() - return require("catppuccin.core.palettes.init").get_palette() + return require("catppuccin.palettes.init").get_palette() end return M diff --git a/lua/catppuccin/core/mapper.lua b/lua/catppuccin/groups/editor.lua similarity index 53% rename from lua/catppuccin/core/mapper.lua rename to lua/catppuccin/groups/editor.lua index 6cefeb8..1498932 100644 --- a/lua/catppuccin/core/mapper.lua +++ b/lua/catppuccin/groups/editor.lua @@ -1,25 +1,10 @@ -local ucolors = require("catppuccin.utils.colors") -local lui = require("catppuccin.lib.ui") -local cp - local M = {} -local function get_properties() - local props = { - termguicolors = true, - background = "dark", - } - - if ucolors.assert_brightness(cp.base) then - props["background"] = "light" - end - - return props -end +local ucolors = require("catppuccin.utils.colors") +local lui = require("catppuccin.lib.ui") -local function get_base() +function M.get() return { - Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments ColorColumn = { bg = cp.surface0 }, -- used for the columns set with 'colorcolumn' Conceal = { fg = cp.overlay1 }, -- placeholder characters substituted for concealed text (see 'conceallevel') Cursor = { fg = cp.base, bg = cp.text }, -- character under the cursor @@ -91,146 +76,7 @@ local function get_base() -- overlay0ed out groups should chain up to their "preferred" group by -- default, -- Unoverlay0 and edit if you want more specific syntax highlighting. - - -- code itself - - Constant = { fg = cp.peach }, -- (preferred) any constant - String = { fg = cp.green, style = cnf.styles.strings }, -- a string constant: "this is a string" - Character = { fg = cp.teal }, -- a character constant: 'c', '\n' - Number = { fg = cp.peach }, -- a number constant: 234, 0xff - Float = { fg = cp.peach }, -- a floating point constant: 2.3e10 - Boolean = { fg = cp.peach }, -- a boolean constant: TRUE, false - Identifier = { fg = cp.flamingo, style = cnf.styles.variables }, -- (preferred) any variable name - Function = { fg = cp.blue, style = cnf.styles.functions }, -- function name (also: methods for classes) - Statement = { fg = cp.mauve }, -- (preferred) any statement - Conditional = { fg = cp.red }, -- if, then, else, endif, switch, etcp. - Repeat = { fg = cp.red }, -- for, do, while, etcp. - Label = { fg = cp.peach }, -- case, default, etcp. - Operator = { fg = cp.sky }, -- "sizeof", "+", "*", etcp. - Keyword = { fg = cp.pink, style = cnf.styles.keywords }, -- any other keyword - -- Exception = { }, -- try, catch, throw - - PreProc = { fg = cp.pink }, -- (preferred) generic Preprocessor - Include = { fg = cp.pink }, -- preprocessor #include - -- Define = { }, -- preprocessor #define - -- Macro = { }, -- same as Define - -- PreCondit = { }, -- preprocessor #if, #else, #endif, etcp. - - StorageClass = { fg = cp.yellow }, -- static, register, volatile, etcp. - Structure = { fg = cp.yellow }, -- struct, union, enum, etcp. - Typedef = { fg = cp.yellow }, -- A typedef - Special = { fg = cp.pink }, -- (preferred) any special symbol - Type = { fg = cp.blue }, -- (preferred) int, long, char, etcp. - -- SpecialChar = { }, -- special character in a constant - -- Tag = { }, -- you can use CTRL-] on this - -- Delimiter = { }, -- character that needs attention - -- Specialoverlay0= { }, -- special things inside a overlay0 - -- Debug = { }, -- debugging statements - - Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links - Bold = { style = { "bold" } }, - Italic = { style = { "italic" } }, - -- ("Ignore", below, may be invisible...) - -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| - - Error = { fg = cp.red }, -- (preferred) any erroneous construct - Todo = { bg = cp.yellow, fg = cp.base, style = { "bold" } }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX - qfLineNr = { fg = cp.yellow }, - qfFileName = { fg = cp.blue }, - htmlH1 = { fg = cp.pink, style = { "bold" } }, - htmlH2 = { fg = cp.blue, style = { "bold" } }, - -- mkdHeading = { fg = cp.peach, style = { "bold" } }, - -- mkdCode = { bg = cp.terminal_black, fg = cp.text }, - mkdCodeDelimiter = { bg = cp.base, fg = cp.text }, - mkdCodeStart = { fg = cp.flamingo, style = { "bold" } }, - mkdCodeEnd = { fg = cp.flamingo, style = { "bold" } }, - -- mkdLink = { fg = cp.blue, style = { "underline" } }, - - -- debugging - debugPC = { bg = cp.crust }, -- used for highlighting the current line in terminal-debug - debugBreakpoint = { bg = cp.base, fg = cp.overlay0 }, -- used for breakpoint colors in terminal-debug - -- illuminate - illuminatedWord = { bg = cp.surface1 }, - illuminatedCurWord = { bg = cp.surface1 }, - -- diff - diffAdded = { fg = cp.green }, - diffRemoved = { fg = cp.red }, - diffChanged = { fg = cp.yellow }, - diffOldFile = { fg = cp.yellow }, - diffNewFile = { fg = cp.peach }, - diffFile = { fg = cp.blue }, - diffLine = { fg = cp.overlay0 }, - diffIndexLine = { fg = cp.pink }, - DiffAdd = { fg = cp.green, bg = cp.base }, -- diff mode: Added line |diff.txt| - DiffChange = { fg = cp.yellow, bg = cp.base }, -- diff mode: Changed line |diff.txt| - DiffDelete = { fg = cp.red, bg = cp.base }, -- diff mode: Deleted line |diff.txt| - DiffText = { fg = cp.blue, bg = cp.base }, -- diff mode: Changed text within a changed line |diff.txt| - -- NeoVim - healthError = { fg = cp.red }, - healthSuccess = { fg = cp.teal }, - healthWarning = { fg = cp.yellow }, - -- misc - - -- glyphs - GlyphPalette1 = { fg = cp.red }, - GlyphPalette2 = { fg = cp.teal }, - GlyphPalette3 = { fg = cp.yellow }, - GlyphPalette4 = { fg = cp.blue }, - GlyphPalette6 = { fg = cp.teal }, - GlyphPalette7 = { fg = cp.text }, - GlyphPalette9 = { fg = cp.red }, } end -local function get_integrations() - local integrations = cnf["integrations"] - local final_integrations = {} - - for integration in pairs(integrations) do - local cot = false - if type(integrations[integration]) == "table" then - if integrations[integration]["enabled"] == true then - cot = true - end - else - if integrations[integration] == true then - cot = true - end - end - - if cot then - final_integrations = vim.tbl_deep_extend( - "force", - final_integrations, - require("catppuccin.core.integrations." .. integration).get(cp) - ) - end - end - - return final_integrations -end - -local function get_terminal() - return cp -end - -function M.apply() - _G.cnf = require("catppuccin.config").options - cp = require("catppuccin.core.palettes.init").get_palette() - - cp.none = "NONE" - cp.dim = lui.dim() - - local theme = {} - theme.properties = get_properties() -- nvim settings - theme.base = get_base() -- basic hi groups - theme.integrations = get_integrations() -- plugins - theme.terminal = get_terminal() -- terminal colors - - -- uninstantiate to avoid poluting global scope and because it's not needed anymore - _G.cnf = nil - - return theme -end - return M diff --git a/lua/catppuccin/core/integrations/barbar.lua b/lua/catppuccin/groups/integrations/barbar.lua similarity index 98% rename from lua/catppuccin/core/integrations/barbar.lua rename to lua/catppuccin/groups/integrations/barbar.lua index 1996a46..88bfeed 100644 --- a/lua/catppuccin/core/integrations/barbar.lua +++ b/lua/catppuccin/groups/integrations/barbar.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { BufferCurrent = { bg = cp.surface1, fg = cp.text }, BufferCurrentIndex = { bg = cp.surface1, fg = cp.blue }, diff --git a/lua/catppuccin/core/integrations/bufferline.lua b/lua/catppuccin/groups/integrations/bufferline.lua similarity index 98% rename from lua/catppuccin/core/integrations/bufferline.lua rename to lua/catppuccin/groups/integrations/bufferline.lua index c4f9128..0cf36d0 100644 --- a/lua/catppuccin/core/integrations/bufferline.lua +++ b/lua/catppuccin/groups/integrations/bufferline.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local cnf = require("catppuccin.config").options local transparent_background = cnf.transparent_background local bg_highlight = (transparent_background and cnf.dim_inactive.enable and cp.dim) diff --git a/lua/catppuccin/core/integrations/cmp.lua b/lua/catppuccin/groups/integrations/cmp.lua similarity index 98% rename from lua/catppuccin/core/integrations/cmp.lua rename to lua/catppuccin/groups/integrations/cmp.lua index 513aeb9..a67e106 100644 --- a/lua/catppuccin/core/integrations/cmp.lua +++ b/lua/catppuccin/groups/integrations/cmp.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { CmpItemAbbr = { fg = cp.overlay2 }, CmpItemAbbrDeprecated = { fg = cp.overlay0, style = { "strikethrough" } }, diff --git a/lua/catppuccin/core/integrations/coc_nvim.lua b/lua/catppuccin/groups/integrations/coc_nvim.lua similarity index 92% rename from lua/catppuccin/core/integrations/coc_nvim.lua rename to lua/catppuccin/groups/integrations/coc_nvim.lua index b04563f..4029d14 100644 --- a/lua/catppuccin/core/integrations/coc_nvim.lua +++ b/lua/catppuccin/groups/integrations/coc_nvim.lua @@ -1,8 +1,6 @@ local M = {} -local util = require("catppuccin.utils.util") - -function M.get(cp) +function M.get() local error = cp.red local warning = cp.yellow local info = cp.sky diff --git a/lua/catppuccin/core/integrations/dashboard.lua b/lua/catppuccin/groups/integrations/dashboard.lua similarity index 92% rename from lua/catppuccin/core/integrations/dashboard.lua rename to lua/catppuccin/groups/integrations/dashboard.lua index b5d2c08..b4aafef 100644 --- a/lua/catppuccin/core/integrations/dashboard.lua +++ b/lua/catppuccin/groups/integrations/dashboard.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { DashboardShortCut = { fg = cp.pink }, DashboardHeader = { fg = cp.blue }, diff --git a/lua/catppuccin/core/integrations/feline.lua b/lua/catppuccin/groups/integrations/feline.lua similarity index 99% rename from lua/catppuccin/core/integrations/feline.lua rename to lua/catppuccin/groups/integrations/feline.lua index aff1094..ef44e8e 100644 --- a/lua/catppuccin/core/integrations/feline.lua +++ b/lua/catppuccin/groups/integrations/feline.lua @@ -26,7 +26,7 @@ local assets = { slim_dot = "•", } -local clrs = require("catppuccin.core.palettes.init").get_palette() +local clrs = require("catppuccin.palettes.init").get_palette() -- settings local sett = { diff --git a/lua/catppuccin/core/integrations/fern.lua b/lua/catppuccin/groups/integrations/fern.lua similarity index 80% rename from lua/catppuccin/core/integrations/fern.lua rename to lua/catppuccin/groups/integrations/fern.lua index 1f8b741..f840cc5 100644 --- a/lua/catppuccin/core/integrations/fern.lua +++ b/lua/catppuccin/groups/integrations/fern.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { FernBranchText = { fg = cp.blue }, } diff --git a/lua/catppuccin/core/integrations/gitgutter.lua b/lua/catppuccin/groups/integrations/gitgutter.lua similarity index 88% rename from lua/catppuccin/core/integrations/gitgutter.lua rename to lua/catppuccin/groups/integrations/gitgutter.lua index 5e06e69..c30bb17 100644 --- a/lua/catppuccin/core/integrations/gitgutter.lua +++ b/lua/catppuccin/groups/integrations/gitgutter.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { GitGutterAdd = { fg = cp.green }, GitGutterChange = { fg = cp.yellow }, diff --git a/lua/catppuccin/core/integrations/gitsigns.lua b/lua/catppuccin/groups/integrations/gitsigns.lua similarity index 96% rename from lua/catppuccin/core/integrations/gitsigns.lua rename to lua/catppuccin/groups/integrations/gitsigns.lua index 1642107..845eecf 100644 --- a/lua/catppuccin/core/integrations/gitsigns.lua +++ b/lua/catppuccin/groups/integrations/gitsigns.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local cnf = require("catppuccin.config").options local bg_highlight = (cnf.transparent_background and cnf.dim_inactive.enable and cp.dim) or (cnf.transparent_background and "NONE") diff --git a/lua/catppuccin/core/integrations/hop.lua b/lua/catppuccin/groups/integrations/hop.lua similarity index 94% rename from lua/catppuccin/core/integrations/hop.lua rename to lua/catppuccin/groups/integrations/hop.lua index 192a78b..3b36f83 100644 --- a/lua/catppuccin/core/integrations/hop.lua +++ b/lua/catppuccin/groups/integrations/hop.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } }, HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } }, diff --git a/lua/catppuccin/core/integrations/indent_blankline.lua b/lua/catppuccin/groups/integrations/indent_blankline.lua similarity index 96% rename from lua/catppuccin/core/integrations/indent_blankline.lua rename to lua/catppuccin/groups/integrations/indent_blankline.lua index 920aa0d..484ae17 100644 --- a/lua/catppuccin/core/integrations/indent_blankline.lua +++ b/lua/catppuccin/groups/integrations/indent_blankline.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local hi = { IndentBlanklineChar = { fg = cp.surface0 }, diff --git a/lua/catppuccin/core/integrations/leap.lua b/lua/catppuccin/groups/integrations/leap.lua similarity index 97% rename from lua/catppuccin/core/integrations/leap.lua rename to lua/catppuccin/groups/integrations/leap.lua index 9846568..f4f75f8 100644 --- a/lua/catppuccin/core/integrations/leap.lua +++ b/lua/catppuccin/groups/integrations/leap.lua @@ -10,7 +10,7 @@ local function get_prepared() return is_prepared end -function M.get(cp) +function M.get() if not get_prepared() then local catppuccin = require("catppuccin") diff --git a/lua/catppuccin/core/integrations/lightspeed.lua b/lua/catppuccin/groups/integrations/lightspeed.lua similarity index 98% rename from lua/catppuccin/core/integrations/lightspeed.lua rename to lua/catppuccin/groups/integrations/lightspeed.lua index e8ccf02..f4b09bb 100644 --- a/lua/catppuccin/core/integrations/lightspeed.lua +++ b/lua/catppuccin/groups/integrations/lightspeed.lua @@ -10,7 +10,7 @@ local function get_prepared() return is_prepared end -function M.get(cp) +function M.get() if not get_prepared() then set_prepared(vim.api.nvim_create_autocmd("User", { diff --git a/lua/catppuccin/core/integrations/lsp_saga.lua b/lua/catppuccin/groups/integrations/lsp_saga.lua similarity index 97% rename from lua/catppuccin/core/integrations/lsp_saga.lua rename to lua/catppuccin/groups/integrations/lsp_saga.lua index 672b0a5..5580fa6 100644 --- a/lua/catppuccin/core/integrations/lsp_saga.lua +++ b/lua/catppuccin/groups/integrations/lsp_saga.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { DiagnosticError = { fg = cp.red }, DiagnosticWarning = { fg = cp.yellow }, diff --git a/lua/catppuccin/core/integrations/lsp_trouble.lua b/lua/catppuccin/groups/integrations/lsp_trouble.lua similarity index 90% rename from lua/catppuccin/core/integrations/lsp_trouble.lua rename to lua/catppuccin/groups/integrations/lsp_trouble.lua index 62b5a74..e54547c 100644 --- a/lua/catppuccin/core/integrations/lsp_trouble.lua +++ b/lua/catppuccin/groups/integrations/lsp_trouble.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { LspTroubleText = { fg = cp.green }, LspTroubleCount = { fg = cp.pink, bg = cp.surface1 }, diff --git a/lua/catppuccin/core/integrations/markdown.lua b/lua/catppuccin/groups/integrations/markdown.lua similarity index 96% rename from lua/catppuccin/core/integrations/markdown.lua rename to lua/catppuccin/groups/integrations/markdown.lua index cb80ff4..5520735 100644 --- a/lua/catppuccin/core/integrations/markdown.lua +++ b/lua/catppuccin/groups/integrations/markdown.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { markdownHeadingDelimiter = { fg = cp.peach, style = { "bold" } }, markdownCode = { fg = cp.flamingo }, diff --git a/lua/catppuccin/core/integrations/mini.lua b/lua/catppuccin/groups/integrations/mini.lua similarity index 99% rename from lua/catppuccin/core/integrations/mini.lua rename to lua/catppuccin/groups/integrations/mini.lua index 0bc9507..0c99363 100644 --- a/lua/catppuccin/core/integrations/mini.lua +++ b/lua/catppuccin/groups/integrations/mini.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local transparent_background = require("catppuccin.config").options.transparent_background local bg_highlight = transparent_background and "NONE" or cp.base diff --git a/lua/catppuccin/core/integrations/native_lsp.lua b/lua/catppuccin/groups/integrations/native_lsp.lua similarity index 99% rename from lua/catppuccin/core/integrations/native_lsp.lua rename to lua/catppuccin/groups/integrations/native_lsp.lua index 22c675e..3394e9c 100644 --- a/lua/catppuccin/core/integrations/native_lsp.lua +++ b/lua/catppuccin/groups/integrations/native_lsp.lua @@ -1,7 +1,7 @@ local M = {} local ucolors = require("catppuccin.utils.colors") -function M.get(cp) +function M.get() local options = require("catppuccin.config").options local virtual_text = options.integrations.native_lsp.virtual_text diff --git a/lua/catppuccin/core/integrations/neogit.lua b/lua/catppuccin/groups/integrations/neogit.lua similarity index 95% rename from lua/catppuccin/core/integrations/neogit.lua rename to lua/catppuccin/groups/integrations/neogit.lua index e368b60..9cc146b 100644 --- a/lua/catppuccin/core/integrations/neogit.lua +++ b/lua/catppuccin/groups/integrations/neogit.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { NeogitBranch = { fg = cp.pink }, NeogitRemote = { fg = cp.pink }, diff --git a/lua/catppuccin/core/integrations/neotree.lua b/lua/catppuccin/groups/integrations/neotree.lua similarity index 97% rename from lua/catppuccin/core/integrations/neotree.lua rename to lua/catppuccin/groups/integrations/neotree.lua index 6befc5f..88bf9ca 100644 --- a/lua/catppuccin/core/integrations/neotree.lua +++ b/lua/catppuccin/groups/integrations/neotree.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local config = require("catppuccin.config").options local neotree = config.integrations.neotree diff --git a/lua/catppuccin/core/integrations/notify.lua b/lua/catppuccin/groups/integrations/notify.lua similarity index 97% rename from lua/catppuccin/core/integrations/notify.lua rename to lua/catppuccin/groups/integrations/notify.lua index 24748b3..2ab418c 100644 --- a/lua/catppuccin/core/integrations/notify.lua +++ b/lua/catppuccin/groups/integrations/notify.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { NotifyERRORBorder = { fg = cp.red }, NotifyERRORIcon = { fg = cp.red }, diff --git a/lua/catppuccin/core/integrations/nvimtree.lua b/lua/catppuccin/groups/integrations/nvimtree.lua similarity index 98% rename from lua/catppuccin/core/integrations/nvimtree.lua rename to lua/catppuccin/groups/integrations/nvimtree.lua index 7be4a5b..f5bd237 100644 --- a/lua/catppuccin/core/integrations/nvimtree.lua +++ b/lua/catppuccin/groups/integrations/nvimtree.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local config = require("catppuccin.config").options local nvimtree = config.integrations.nvimtree diff --git a/lua/catppuccin/core/integrations/symbols_outline.lua b/lua/catppuccin/groups/integrations/symbols_outline.lua similarity index 83% rename from lua/catppuccin/core/integrations/symbols_outline.lua rename to lua/catppuccin/groups/integrations/symbols_outline.lua index 5b9e53f..9197ff6 100644 --- a/lua/catppuccin/core/integrations/symbols_outline.lua +++ b/lua/catppuccin/groups/integrations/symbols_outline.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { FocusedSymbol = { fg = cp.yellow, bg = cp.base }, } diff --git a/lua/catppuccin/core/integrations/telekasten.lua b/lua/catppuccin/groups/integrations/telekasten.lua similarity index 87% rename from lua/catppuccin/core/integrations/telekasten.lua rename to lua/catppuccin/groups/integrations/telekasten.lua index 9174588..9ff353d 100644 --- a/lua/catppuccin/core/integrations/telekasten.lua +++ b/lua/catppuccin/groups/integrations/telekasten.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { tkLink = { fg = cp.blue }, tkBrackets = { fg = cp.pink }, diff --git a/lua/catppuccin/core/integrations/telescope.lua b/lua/catppuccin/groups/integrations/telescope.lua similarity index 97% rename from lua/catppuccin/core/integrations/telescope.lua rename to lua/catppuccin/groups/integrations/telescope.lua index de1db92..0b776d6 100644 --- a/lua/catppuccin/core/integrations/telescope.lua +++ b/lua/catppuccin/groups/integrations/telescope.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { TelescopeBorder = { fg = cp.blue }, TelescopeSelectionCaret = { fg = cp.flamingo }, diff --git a/lua/catppuccin/core/integrations/treesitter.lua b/lua/catppuccin/groups/integrations/treesitter.lua similarity index 99% rename from lua/catppuccin/core/integrations/treesitter.lua rename to lua/catppuccin/groups/integrations/treesitter.lua index 7729bed..3528de4 100644 --- a/lua/catppuccin/core/integrations/treesitter.lua +++ b/lua/catppuccin/groups/integrations/treesitter.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() -- local delimeters = cp.overlay2 local operators = cp.sky local cl = cp.mauve -- conditionals, loops diff --git a/lua/catppuccin/core/integrations/ts_rainbow.lua b/lua/catppuccin/groups/integrations/ts_rainbow.lua similarity index 97% rename from lua/catppuccin/core/integrations/ts_rainbow.lua rename to lua/catppuccin/groups/integrations/ts_rainbow.lua index ef0061e..f6dea4a 100644 --- a/lua/catppuccin/core/integrations/ts_rainbow.lua +++ b/lua/catppuccin/groups/integrations/ts_rainbow.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() local cnf = require("catppuccin.config").options local transparent_background = cnf.transparent_background local bg_highlight = (transparent_background and cnf.dim_inactive.enable and cp.dim) diff --git a/lua/catppuccin/core/integrations/vim_sneak.lua b/lua/catppuccin/groups/integrations/vim_sneak.lua similarity index 86% rename from lua/catppuccin/core/integrations/vim_sneak.lua rename to lua/catppuccin/groups/integrations/vim_sneak.lua index 4c8f9cb..1853512 100644 --- a/lua/catppuccin/core/integrations/vim_sneak.lua +++ b/lua/catppuccin/groups/integrations/vim_sneak.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { Sneak = { fg = cp.overlay2, bg = cp.pink }, SneakScope = { bg = cp.text }, diff --git a/lua/catppuccin/core/integrations/which_key.lua b/lua/catppuccin/groups/integrations/which_key.lua similarity index 94% rename from lua/catppuccin/core/integrations/which_key.lua rename to lua/catppuccin/groups/integrations/which_key.lua index fd80ee8..203e114 100644 --- a/lua/catppuccin/core/integrations/which_key.lua +++ b/lua/catppuccin/groups/integrations/which_key.lua @@ -1,6 +1,6 @@ local M = {} -function M.get(cp) +function M.get() return { WhichKey = { fg = cp.flamingo }, WhichKeyGroup = { fg = cp.blue }, diff --git a/lua/catppuccin/groups/properties.lua b/lua/catppuccin/groups/properties.lua new file mode 100644 index 0000000..128ad0b --- /dev/null +++ b/lua/catppuccin/groups/properties.lua @@ -0,0 +1,18 @@ +local M = {} + +local ucolors = require("catppuccin.utils.colors") + +function M.get() + local props = { + termguicolors = true, + background = "dark", + } + + if ucolors.assert_brightness(cp.base) then + props["background"] = "light" + end + + return props +end + +return M diff --git a/lua/catppuccin/groups/syntax.lua b/lua/catppuccin/groups/syntax.lua new file mode 100644 index 0000000..e1539b1 --- /dev/null +++ b/lua/catppuccin/groups/syntax.lua @@ -0,0 +1,104 @@ +local M = {} + +function M.get() + return { + Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments + Constant = { fg = cp.peach }, -- (preferred) any constant + String = { fg = cp.green, style = cnf.styles.strings }, -- a string constant: "this is a string" + Character = { fg = cp.teal }, -- a character constant: 'c', '\n' + Number = { fg = cp.peach }, -- a number constant: 234, 0xff + Float = { fg = cp.peach }, -- a floating point constant: 2.3e10 + Boolean = { fg = cp.peach }, -- a boolean constant: TRUE, false + Identifier = { fg = cp.flamingo, style = cnf.styles.variables }, -- (preferred) any variable name + Function = { fg = cp.blue, style = cnf.styles.functions }, -- function name (also: methods for classes) + Statement = { fg = cp.mauve }, -- (preferred) any statement + Conditional = { fg = cp.red }, -- if, then, else, endif, switch, etcp. + Repeat = { fg = cp.red }, -- for, do, while, etcp. + Label = { fg = cp.peach }, -- case, default, etcp. + Operator = { fg = cp.sky }, -- "sizeof", "+", "*", etcp. + Keyword = { fg = cp.pink, style = cnf.styles.keywords }, -- any other keyword + -- Exception = { }, -- try, catch, throw + + PreProc = { fg = cp.pink }, -- (preferred) generic Preprocessor + Include = { fg = cp.pink }, -- preprocessor #include + -- Define = { }, -- preprocessor #define + -- Macro = { }, -- same as Define + -- PreCondit = { }, -- preprocessor #if, #else, #endif, etcp. + + StorageClass = { fg = cp.yellow }, -- static, register, volatile, etcp. + Structure = { fg = cp.yellow }, -- struct, union, enum, etcp. + Typedef = { fg = cp.yellow }, -- A typedef + Special = { fg = cp.pink }, -- (preferred) any special symbol + Type = { fg = cp.blue }, -- (preferred) int, long, char, etcp. + -- SpecialChar = { }, -- special character in a constant + -- Tag = { }, -- you can use CTRL-] on this + -- Delimiter = { }, -- character that needs attention + -- Specialoverlay0= { }, -- special things inside a overlay0 + -- Debug = { }, -- debugging statements + + Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links + Bold = { style = { "bold" } }, + Italic = { style = { "italic" } }, + -- ("Ignore", below, may be invisible...) + -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| + + Error = { fg = cp.red }, -- (preferred) any erroneous construct + Todo = { bg = cp.yellow, fg = cp.base, style = { "bold" } }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX + qfLineNr = { fg = cp.yellow }, + qfFileName = { fg = cp.blue }, + htmlH1 = { fg = cp.pink, style = { "bold" } }, + htmlH2 = { fg = cp.blue, style = { "bold" } }, + -- mkdHeading = { fg = cp.peach, style = { "bold" } }, + -- mkdCode = { bg = cp.terminal_black, fg = cp.text }, + mkdCodeDelimiter = { bg = cp.base, fg = cp.text }, + mkdCodeStart = { fg = cp.flamingo, style = { "bold" } }, + mkdCodeEnd = { fg = cp.flamingo, style = { "bold" } }, + -- mkdLink = { fg = cp.blue, style = { "underline" } }, + + -- debugging + debugPC = { bg = cp.crust }, -- used for highlighting the current line in terminal-debug + debugBreakpoint = { bg = cp.base, fg = cp.overlay0 }, -- used for breakpoint colors in terminal-debug + -- illuminate + illuminatedWord = { bg = cp.surface1 }, + illuminatedCurWord = { bg = cp.surface1 }, + -- diff + diffAdded = { fg = cp.green }, + diffRemoved = { fg = cp.red }, + diffChanged = { fg = cp.yellow }, + diffOldFile = { fg = cp.yellow }, + diffNewFile = { fg = cp.peach }, + diffFile = { fg = cp.blue }, + diffLine = { fg = cp.overlay0 }, + diffIndexLine = { fg = cp.pink }, + DiffAdd = { fg = cp.green, bg = cp.base }, -- diff mode: Added line |diff.txt| + DiffChange = { fg = cp.yellow, bg = cp.base }, -- diff mode: Changed line |diff.txt| + DiffDelete = { fg = cp.red, bg = cp.base }, -- diff mode: Deleted line |diff.txt| + DiffText = { fg = cp.blue, bg = cp.base }, -- diff mode: Changed text within a changed line |diff.txt| + -- NeoVim + healthError = { fg = cp.red }, + healthSuccess = { fg = cp.teal }, + healthWarning = { fg = cp.yellow }, + -- misc + + -- glyphs + GlyphPalette1 = { fg = cp.red }, + GlyphPalette2 = { fg = cp.teal }, + GlyphPalette3 = { fg = cp.yellow }, + GlyphPalette4 = { fg = cp.blue }, + GlyphPalette6 = { fg = cp.teal }, + GlyphPalette7 = { fg = cp.text }, + GlyphPalette9 = { fg = cp.red }, + + Define = { link = "PreProc" }, -- preprocessor #define + Macro = { link = "PreProc" }, -- same as Define + PreCondit = { link = "PreProc" }, -- preprocessor #if, #else, #endif, etc. + + SpecialChar = { link = "Special" }, -- special character in a constant + Tag = { link = "Special" }, -- you can use CTRL-] on this + Delimiter = { link = "Special" }, -- character that needs attention + SpecialComment = { link = "Special" }, -- special things inside a comment + Debug = { link = "Special" }, -- debugging statements + } +end + +return M diff --git a/lua/catppuccin/groups/terminal.lua b/lua/catppuccin/groups/terminal.lua new file mode 100644 index 0000000..ef677cf --- /dev/null +++ b/lua/catppuccin/groups/terminal.lua @@ -0,0 +1,31 @@ +local M = {} + +function M.get() + return { + terminal_color_0 = cp.overlay0, + terminal_color_8 = cp.overlay1, + + terminal_color_1 = cp.red, + terminal_color_9 = cp.red, + + terminal_color_2 = cp.green, + terminal_color_10 = cp.green, + + terminal_color_3 = cp.yellow, + terminal_color_11 = cp.yellow, + + terminal_color_4 = cp.blue, + terminal_color_12 = cp.blue, + + terminal_color_5 = cp.pink, + terminal_color_13 = cp.pink, + + terminal_color_6 = cp.sky, + terminal_color_14 = cp.sky, + + terminal_color_7 = cp.text, + terminal_color_15 = cp.text, + } +end + +return M diff --git a/lua/catppuccin/utils/util.lua b/lua/catppuccin/lib/compiler.lua similarity index 64% rename from lua/catppuccin/utils/util.lua rename to lua/catppuccin/lib/compiler.lua index cc7f8db..9717faa 100644 --- a/lua/catppuccin/utils/util.lua +++ b/lua/catppuccin/lib/compiler.lua @@ -1,78 +1,4 @@ -local g = vim.g -local util = {} - -function util.highlight(group, color) - if color.link then - vim.api.nvim_set_hl(0, group, { - link = color.link, - }) - else - if color.style then - for _, style in ipairs(color.style) do - color[style] = true - end - end - - color.style = nil - vim.api.nvim_set_hl(0, group, color) - end -end - -function util.syntax(tbl) - for group, colors in pairs(tbl) do - util.highlight(group, colors) - end -end - -function util.properties(tbl) - for property, value in pairs(tbl) do - vim.o[property] = value - end -end - -function util.terminal(cp) - g.terminal_color_0 = cp.overlay0 - g.terminal_color_8 = cp.overlay1 - - g.terminal_color_1 = cp.red - g.terminal_color_9 = cp.red - - g.terminal_color_2 = cp.green - g.terminal_color_10 = cp.green - - g.terminal_color_3 = cp.yellow - g.terminal_color_11 = cp.yellow - - g.terminal_color_4 = cp.blue - g.terminal_color_12 = cp.blue - - g.terminal_color_5 = cp.pink - g.terminal_color_13 = cp.pink - - g.terminal_color_6 = cp.sky - g.terminal_color_14 = cp.sky - - g.terminal_color_7 = cp.text - g.terminal_color_15 = cp.text -end - -function util.load(theme) - vim.cmd("hi clear") - if vim.fn.exists("syntax_on") then - vim.cmd("syntax reset") - end - g.colors_name = "catppuccin" - local custom_highlights = require("catppuccin.config").options.custom_highlights - - util.properties(theme.properties) - util.syntax(theme.base) - util.syntax(theme.integrations) - util.syntax(custom_highlights) - - if require("catppuccin.config").options["term_colors"] then - util.terminal(theme.terminal) - end -end +local M = {} -- Credit: https://github.com/EdenEast/nightfox.nvim local fmt = string.format @@ -151,5 +77,3 @@ function util.clean() local compiled_path = config.compile.path .. (vim.loop.os_uname().sysname == 'Windows' and "\\" or "/") .. vim.g.catppuccin_flavour .. config.compile.suffix .. ".lua" os.remove(compiled_path) end - -return util diff --git a/lua/catppuccin/lib/highlighter.lua b/lua/catppuccin/lib/highlighter.lua new file mode 100644 index 0000000..3ab5287 --- /dev/null +++ b/lua/catppuccin/lib/highlighter.lua @@ -0,0 +1,52 @@ +local M = {} +local g = vim.g + +function M.highlight(group, color) + if color.link then + vim.api.nvim_set_hl(0, group, { + link = color.link, + }) + else + if color.style then + for _, style in ipairs(color.style) do + color[style] = true + end + end + + color.style = nil + vim.api.nvim_set_hl(0, group, color) + end +end + +function M.syntax(tbl) + for group, colors in pairs(tbl) do + M.highlight(group, colors) + end +end + +function M.properties(tbl) + for property, value in pairs(tbl) do + vim.o[property] = value + end +end + +function M.load(theme) + vim.cmd("hi clear") + if vim.fn.exists("syntax_on") then + vim.cmd("syntax reset") + end + g.colors_name = "catppuccin" + local custom_highlights = require("catppuccin.config").options.custom_highlights + + M.properties(theme.properties) + M.syntax(theme.editor) + M.syntax(theme.syntax) + M.syntax(theme.integrations) + M.syntax(custom_highlights) + + if require("catppuccin.config").options["term_colors"] then + M.properties(theme.terminal) + end +end + +return M diff --git a/lua/catppuccin/utils/hsluv.lua b/lua/catppuccin/lib/hsluv.lua similarity index 100% rename from lua/catppuccin/utils/hsluv.lua rename to lua/catppuccin/lib/hsluv.lua diff --git a/lua/catppuccin/lib/mapper.lua b/lua/catppuccin/lib/mapper.lua new file mode 100644 index 0000000..3439e02 --- /dev/null +++ b/lua/catppuccin/lib/mapper.lua @@ -0,0 +1,54 @@ +local M = {} + +local lui = require("catppuccin.lib.ui") + +local function get_integrations() + local integrations = cnf["integrations"] + local final_integrations = {} + + for integration in pairs(integrations) do + local cot = false + if type(integrations[integration]) == "table" then + if integrations[integration]["enabled"] == true then + cot = true + end + else + if integrations[integration] == true then + cot = true + end + end + + if cot then + final_integrations = vim.tbl_deep_extend( + "force", + final_integrations, + require("catppuccin.groups.integrations." .. integration).get() + ) + end + end + + return final_integrations +end + +function M.apply() + _G.cnf = require("catppuccin.config").options + _G.cp = require("catppuccin.palettes.init").get_palette() + + cp.none = "NONE" + cp.dim = lui.dim() + + local theme = {} + theme.properties = require("catppuccin.groups.properties").get() -- nvim settings + theme.syntax = require("catppuccin.groups.syntax").get() + theme.editor = require("catppuccin.groups.editor").get() + theme.integrations = get_integrations() -- plugins + theme.terminal = require("catppuccin.groups.terminal").get() -- terminal colors + + -- uninstantiate to avoid poluting global scope and because it's not needed anymore + _G.cnf = nil + _G.cp = nil + + return theme +end + +return M diff --git a/lua/catppuccin/lib/ui.lua b/lua/catppuccin/lib/ui.lua index 2af44fe..b69b37e 100644 --- a/lua/catppuccin/lib/ui.lua +++ b/lua/catppuccin/lib/ui.lua @@ -1,10 +1,10 @@ local M = {} -local cp = require("catppuccin.core.palettes.init").get_palette() +local cp = require("catppuccin.palettes.init").get_palette() local cnf = require("catppuccin.config").options local dim_percentage = cnf.dim_inactive.percentage local ucolors = require("catppuccin.utils.colors") -local latte = require("catppuccin.core.palettes.latte") +local latte = require("catppuccin.palettes.latte") function M.dim() if cnf.dim_inactive.shade == "dark" then diff --git a/lua/catppuccin/core/palettes/frappe.lua b/lua/catppuccin/palettes/frappe.lua similarity index 100% rename from lua/catppuccin/core/palettes/frappe.lua rename to lua/catppuccin/palettes/frappe.lua diff --git a/lua/catppuccin/core/palettes/init.lua b/lua/catppuccin/palettes/init.lua similarity index 74% rename from lua/catppuccin/core/palettes/init.lua rename to lua/catppuccin/palettes/init.lua index 203e67c..1d5712e 100644 --- a/lua/catppuccin/core/palettes/init.lua +++ b/lua/catppuccin/palettes/init.lua @@ -6,9 +6,9 @@ local echo = require("catppuccin.utils.echo") function M.get_palette() local flvr = vim.g.catppuccin_flavour - local palette = require("catppuccin.core.palettes.mocha") + local palette = require("catppuccin.palettes.mocha") if flvr == "mocha" or flvr == "latte" or flvr == "macchiato" or flvr == "frappe" then - palette = require("catppuccin.core.palettes." .. flvr) + palette = require("catppuccin.palettes." .. flvr) end if type(cnf.color_overrides) == "table" then @@ -18,7 +18,7 @@ function M.get_palette() if palette[k] then palette[k] = v else - echo('Warning: "' .. k .. '" is not a valid catppucin palette color') + echo('"'..k .. '" is not a valid catppucin palette color', "warn") end end end diff --git a/lua/catppuccin/core/palettes/latte.lua b/lua/catppuccin/palettes/latte.lua similarity index 100% rename from lua/catppuccin/core/palettes/latte.lua rename to lua/catppuccin/palettes/latte.lua diff --git a/lua/catppuccin/core/palettes/macchiato.lua b/lua/catppuccin/palettes/macchiato.lua similarity index 100% rename from lua/catppuccin/core/palettes/macchiato.lua rename to lua/catppuccin/palettes/macchiato.lua diff --git a/lua/catppuccin/core/palettes/mocha.lua b/lua/catppuccin/palettes/mocha.lua similarity index 100% rename from lua/catppuccin/core/palettes/mocha.lua rename to lua/catppuccin/palettes/mocha.lua diff --git a/lua/catppuccin/utils/colors.lua b/lua/catppuccin/utils/colors.lua index efe8901..3d0b77c 100644 --- a/lua/catppuccin/utils/colors.lua +++ b/lua/catppuccin/utils/colors.lua @@ -1,6 +1,6 @@ local M = {} -local hsluv = require("catppuccin.utils.hsluv") +local hsluv = require("catppuccin.lib.hsluv") M.bg = "#000000" M.fg = "#ffffff" diff --git a/lua/lightline/colorscheme/catppuccin.lua b/lua/lightline/colorscheme/catppuccin.lua index 69bb604..2837ac4 100644 --- a/lua/lightline/colorscheme/catppuccin.lua +++ b/lua/lightline/colorscheme/catppuccin.lua @@ -1,4 +1,4 @@ -local cp = require("catppuccin.core.palettes.init").get_palette() +local cp = require("catppuccin.palettes.init").get_palette() local catppuccin = {} catppuccin.normal = { diff --git a/lua/lualine/themes/catppuccin.lua b/lua/lualine/themes/catppuccin.lua index 8b3241d..ebb177f 100644 --- a/lua/lualine/themes/catppuccin.lua +++ b/lua/lualine/themes/catppuccin.lua @@ -1,4 +1,4 @@ -local cp = require("catppuccin.core.palettes.init").get_palette() +local cp = require("catppuccin.palettes.init").get_palette() local catppuccin = {} catppuccin.normal = {