diff --git a/lua/catppuccino/core/cs.lua b/lua/catppuccino/core/cs.lua deleted file mode 100644 index c488724..0000000 --- a/lua/catppuccino/core/cs.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = {} -local remaps_mod = require("catppuccino.core.remaps") - -function M.get_color_scheme(cs) - cs = cs or "dark_catppuccino" - local remaps = remaps_mod.get_cs_remaps() or {} - local good, color_scheme = pcall(require, "catppuccino.color_schemes." .. cs) - - if not good then - return { - status = false, - msg = "Catppuccino: the colorscheme '" .. cs .. "' was not recognized. Defaulting to Dark Catppuccino.", - }, - require("catppuccino.color_schemes.dark_catppuccino") - end - - if not (next(remaps) == nil) then - return { status = true }, vim.tbl_deep_extend("force", color_scheme, remaps) - else - return { status = true }, color_scheme - end -end - -return M diff --git a/lua/catppuccino/core/integrations/gitsigns.lua b/lua/catppuccino/core/integrations/gitsigns.lua index beb4a22..ffa9801 100644 --- a/lua/catppuccino/core/integrations/gitsigns.lua +++ b/lua/catppuccino/core/integrations/gitsigns.lua @@ -2,9 +2,9 @@ local M = {} function M.get(cpt) return { - GitSignsAdd = { fg = cpt.diff.add, bg = cpc.transparency and cpt.none or cpt.bg }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = cpt.diff.change, bg = cpc.transparency and cpt.none or cpt.bg }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = cpt.diff.remove, bg = cpc.transparency and cpt.none or cpt.bg }, -- diff mode: Deleted line |diff.txt| + GitSignsAdd = { fg = cpt.diff.add, bg = cnf.transparency and cpt.none or cpt.bg }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = cpt.diff.change, bg = cnf.transparency and cpt.none or cpt.bg }, -- diff mode: Changed line |diff.txt| + GitSignsDelete = { fg = cpt.diff.remove, bg = cnf.transparency and cpt.none or cpt.bg }, -- diff mode: Deleted line |diff.txt| } end diff --git a/lua/catppuccino/core/integrations/indent_blankline.lua b/lua/catppuccino/core/integrations/indent_blankline.lua index df0c078..481731c 100644 --- a/lua/catppuccino/core/integrations/indent_blankline.lua +++ b/lua/catppuccino/core/integrations/indent_blankline.lua @@ -6,7 +6,7 @@ function M.get(cpt) IndentBlanklineChar = { fg = cpt.gray }, } - if cpc.integrations.indent_blankline.colored_indent_levels then + if cnf.integrations.indent_blankline.colored_indent_levels then hi["IndentBlanklineIndent6"] = {blend = "nocombine", fg = cpt.yellow} hi["IndentBlanklineIndent5"] = {blend = "nocombine", fg = cpt.red} hi["IndentBlanklineIndent4"] = {blend = "nocombine", fg = cpt.green} diff --git a/lua/catppuccino/core/integrations/native_lsp.lua b/lua/catppuccino/core/integrations/native_lsp.lua index fdf97b5..0ed3adc 100644 --- a/lua/catppuccino/core/integrations/native_lsp.lua +++ b/lua/catppuccino/core/integrations/native_lsp.lua @@ -2,8 +2,8 @@ local M = {} function M.get(cpt) - local virtual_text = cpc.integrations.native_lsp.virtual_text - local underlines = cpc.integrations.native_lsp.underlines + local virtual_text = cnf.integrations.native_lsp.virtual_text + local underlines = cnf.integrations.native_lsp.underlines return { -- These groups are for the native LSP cliencpt. Some other LSP clients may diff --git a/lua/catppuccino/core/integrations/treesitter.lua b/lua/catppuccino/core/integrations/treesitter.lua index db73f24..15df494 100644 --- a/lua/catppuccino/core/integrations/treesitter.lua +++ b/lua/catppuccino/core/integrations/treesitter.lua @@ -11,29 +11,29 @@ function M.get(cpt) -- 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 = { fg = cpt.orange_br, style = cpc.styles.keywords }, -- For booleans. + TSBoolean = { fg = cpt.orange_br, style = cnf.styles.keywords }, -- 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 = { fg = cpt.red, style = cpc.styles.keywords }, -- For keywords related to conditionnals. + TSConditional = { fg = cpt.red, style = cnf.styles.keywords }, -- For keywords related to conditionnals. TSConstant = { fg = cpt.orange }, -- For constants - TSConstBuiltin = { fg = cpt.orange_br, style = cpc.styles.keywords }, -- For constant that are built in the language: `nil` in Lua. + TSConstBuiltin = { fg = cpt.orange_br, style = cnf.styles.keywords }, -- 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 = { fg = cpt.magenta_br, style = cpc.styles.keywords }, -- For exception related keywords. + TSException = { fg = cpt.magenta_br, style = cnf.styles.keywords }, -- 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.blue, style = cpc.styles.functions }, -- For function (calls and definitions). + TSFunction = { fg = cpt.blue, style = cnf.styles.functions }, -- For function (calls and definitions). TSFuncBuiltin = { fg = cpt.cyan }, -- For builtin functions: `table.insert` in Lua. TSFuncMacro = { fg = cpt.red }, -- For macro defined functions (calls and definitions): each `macro_rules` in Ruscpt. - TSInclude = { fg = cpt.magenta, style = cpc.styles.keywords }, -- 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_br, style = cpc.styles.keywords }, -- For keywords used to define a fuction. - TSKeywordOperator = { fg = cpt.cyan, style = cpc.styles.keywords }, -- For `new` keyword operator + TSInclude = { fg = cpt.magenta, style = cnf.styles.keywords }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. + TSKeyword = { fg = cpt.magenta, style = cnf.styles.keywords }, -- For keywords that don't fall in previous categories. + TSKeywordFunction = { fg = cpt.magenta_br, style = cnf.styles.keywords }, -- For keywords used to define a fuction. + TSKeywordOperator = { fg = cpt.cyan, style = cnf.styles.keywords }, -- For `new` keyword operator 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. @@ -47,15 +47,15 @@ function M.get(cpt) TSPunctDelimiter = { fg = cpt.green_br }, -- 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 = { fg = cpt.red, style = cpc.styles.keywords }, -- For keywords related to loops. + TSRepeat = { fg = cpt.red, style = cnf.styles.keywords }, -- 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. + TSStringRegex = { fg = cpt.blue, style = cnf.styles.strings }, -- For regexes. + TSStringEscape = { fg = cpt.magenta, style = cnf.styles.strings }, -- For escape characters within a string. -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. -- TSType = { }; -- For types. - TSTypeBuiltin = { fg = cpt.cyan, style = cpc.styles.keywords }, -- For builtin types. - TSVariable = { style = cpc.styles.variables }, -- Any variable name that does not have another highlighcpt. - TSVariableBuiltin = { fg = cpt.red, style = cpc.styles.keywords }, -- Variable names that are defined by the languages, like `this` or `self`. + TSTypeBuiltin = { fg = cpt.cyan, style = cnf.styles.keywords }, -- For builtin types. + TSVariable = { style = cnf.styles.variables }, -- Any variable name that does not have another highlighcpt. + TSVariableBuiltin = { fg = cpt.red, style = cnf.styles.keywords }, -- 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. diff --git a/lua/catppuccino/core/mapper.lua b/lua/catppuccino/core/mapper.lua index 571840e..9d9a33b 100644 --- a/lua/catppuccino/core/mapper.lua +++ b/lua/catppuccino/core/mapper.lua @@ -1,76 +1,80 @@ local util = require("catppuccino.utils.util") local colors_util = require("catppuccino.utils.colors") +local color_palette = require("catppuccino.core.color_palette") local M = {} -local _cs +local function get_properties() + local props = { + termguicolors = true, + background = "dark", + } -local function get_cs() -- return a cleaned and parsed colorscheme - return _cs -end + if colors_util.assert_brightness(color_palette.bg) then + props["background"] = "light" + end -local function set_cs(val) - _cs = val + return props end local function get_base() - local cpt = get_cs() + local cp = color_palette return { - Comment = { fg = cpt.comment, style = cpc.styles.comments }, -- any comment - ColorColumn = { bg = cpt.bg_visual }, -- used for the columns set with 'colorcolumn' - Conceal = { fg = cpt.black }, -- placeholder characters substituted for concealed text (see 'conceallevel') - Cursor = { fg = cpt.bg, bg = cpt.fg }, -- character under the cursor - lCursor = { fg = cpt.bg, bg = cpt.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { fg = cpt.bg, bg = cpt.fg }, -- like Cursor, but used when in IME mode |CursorIM| - CursorColumn = { bg = cpt.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is secpt. - CursorLine = { bg = cpt.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is secpt. Low-priority if foreground (ctermfg OR guifg) is not secpt. - Directory = { fg = cpt.blue }, -- directory names (and other special names in listings) - EndOfBuffer = { fg = cpt.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - ErrorMsg = { fg = cpt.error }, -- error messages on the command line - VertSplit = { fg = cpt.border }, -- the column separating vertically split windows - Folded = { fg = cpt.blue, bg = cpt.fg_gutter }, -- line used for closed folds - FoldColumn = { bg = cpt.bg, fg = cpt.comment }, -- 'foldcolumn' - SignColumn = { bg = cpc.transparency and cpt.none or cpt.bg, fg = cpt.fg_gutter }, -- column where |signs| are displayed - SignColumnSB = { bg = cpt.bg_sidebar, fg = cpt.fg_gutter }, -- column where |signs| are displayed - Substitute = { bg = cpt.red, fg = cpt.black }, -- |:substitute| replacement text highlighting - LineNr = { fg = cpt.fg_gutter }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secpt. - CursorLineNr = { fg = cpt.fg_alt }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. highlights the number in numberline. - MatchParen = { fg = cpt.orange, style = "bold" }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| - ModeMsg = { fg = cpt.fg_alt, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ") - MsgArea = { fg = cpt.white_br }, -- Area for messages and cmdline + Comment = { fg = cp.comment, style = cnf.styles.comments }, -- any comment + ColorColumn = { bg = cp.bg_visual }, -- used for the columns set with 'colorcolumn' + Conceal = { fg = cp.black }, -- placeholder characters substituted for concealed text (see 'conceallevel') + Cursor = { fg = cp.bg, bg = cp.fg }, -- character under the cursor + lCursor = { fg = cp.bg, bg = cp.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM = { fg = cp.bg, bg = cp.fg }, -- like Cursor, but used when in IME mode |CursorIM| + CursorColumn = { bg = cp.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is secp. + CursorLine = { bg = cp.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if foreground (ctermfg OR guifg) is not secp. + Directory = { fg = cp.blue }, -- directory names (and other special names in listings) + EndOfBuffer = { fg = cp.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + ErrorMsg = { fg = cp.error }, -- error messages on the command line + VertSplit = { fg = cp.border }, -- the column separating vertically split windows + Folded = { fg = cp.blue, bg = cp.fg_gutter }, -- line used for closed folds + FoldColumn = { bg = cp.bg, fg = cp.comment }, -- 'foldcolumn' + SignColumn = { bg = cnf.transparency and cp.none or cp.bg, fg = cp.fg_gutter }, -- column where |signs| are displayed + SignColumnSB = { bg = cp.bg_sidebar, fg = cp.fg_gutter }, -- column where |signs| are displayed + Substitute = { bg = cp.red, fg = cp.black }, -- |:substitute| replacement text highlighting + LineNr = { fg = cp.fg_gutter }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp. + CursorLineNr = { fg = cp.fg_alt }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. highlights the number in numberline. + MatchParen = { fg = cp.orange, style = "bold" }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg = { fg = cp.fg_alt, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ") + MsgArea = { fg = cp.white_br }, -- Area for messages and cmdline MsgSeparator = {}, -- Separator for scrolled messages, `msgsep` flag of 'display' - MoreMsg = { fg = cpt.blue }, -- |more-prompt| - NonText = { fg = cpt.comment }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. - Normal = { fg = cpt.fg, bg = cpc.transparency and cpt.none or cpt.bg }, -- normal text - NormalNC = { fg = cpt.fg, bg = cpc.transparency and cpt.none or cpt.bg }, -- normal text in non-current windows - NormalSB = { fg = cpt.fg_sidebar, bg = cpt.bg_sidebar }, -- normal text in non-current windows - NormalFloat = { fg = cpt.fg, bg = cpt.bg_float }, -- Normal text in floating windows. - FloatBorder = { fg = cpt.border_highlight }, - Pmenu = { bg = cpt.bg_popup, fg = cpt.fg }, -- Popup menu: normal item. - PmenuSel = { fg = cpt.cyan, bg = util.darken(cpt.fg_gutter, 0.8) }, -- Popup menu: selected item. - PmenuSbar = { bg = util.lighten(cpt.bg_popup, 0.95) }, -- Popup menu: scrollbar. - PmenuThumb = { bg = cpt.fg_gutter }, -- Popup menu: Thumb of the scrollbar. - Question = { fg = cpt.blue }, -- |hit-enter| prompt and yes/no questions - QuickFixLine = { bg = cpt.bg_visual, style = "bold" }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. - Search = { bg = cpt.bg_search, fg = cpt.fg }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand oucpt. - IncSearch = { bg = cpt.cyan, fg = cpt.black }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" - SpecialKey = { fg = cpt.fg }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| - SpellBad = { sp = cpt.error, style = "undercurl" }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. - SpellCap = { sp = cpt.warning, style = "undercurl" }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. - SpellLocal = { sp = cpt.info, style = "undercurl" }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. - SpellRare = { sp = cpt.hint, style = "undercurl" }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. - StatusLine = { fg = cpt.fg_sidebar, bg = cpt.bg_statusline }, -- status line of current window - StatusLineNC = { fg = cpt.fg_gutter, bg = cpt.bg_statusline }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. - TabLine = { bg = cpt.bg_statusline, fg = cpt.fg_gutter }, -- tab pages line, not active tab page label - TabLineFill = { bg = cpt.black }, -- tab pages line, where there are no labels - TabLineSel = { fg = cpt.fg_alt, bg = cpt.fg_gutter }, -- tab pages line, active tab page label - Title = { fg = cpt.blue, style = "bold" }, -- titles for output from ":set all", ":autocmd" etcpt. - Visual = { bg = cpt.bg_visual }, -- Visual mode selection - VisualNOS = { bg = cpt.bg_visual }, -- Visual mode selection when vim is "Not Owning the Selection". - WarningMsg = { fg = cpt.warning }, -- warning messages - Whitespace = { fg = cpt.fg_gutter }, -- "nbsp", "space", "tab" and "trail" in 'listchars' - WildMenu = { bg = cpt.bg_visual }, -- current match in 'wildmenu' completion + MoreMsg = { fg = cp.blue }, -- |more-prompt| + NonText = { fg = cp.comment }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + Normal = { fg = cp.fg, bg = cnf.transparency and cp.none or cp.bg }, -- normal text + NormalNC = { fg = cp.fg, bg = cnf.transparency and cp.none or cp.bg }, -- normal text in non-current windows + NormalSB = { fg = cp.fg_sidebar, bg = cp.bg_sidebar }, -- normal text in non-current windows + NormalFloat = { fg = cp.fg, bg = cp.bg_float }, -- Normal text in floating windows. + FloatBorder = { fg = cp.border_highlight }, + Pmenu = { bg = cp.bg_popup, fg = cp.fg }, -- Popup menu: normal item. + PmenuSel = { fg = cp.cyan, bg = util.darken(cp.fg_gutter, 0.8) }, -- Popup menu: selected item. + PmenuSbar = { bg = util.lighten(cp.bg_popup, 0.95) }, -- Popup menu: scrollbar. + PmenuThumb = { bg = cp.fg_gutter }, -- Popup menu: Thumb of the scrollbar. + Question = { fg = cp.blue }, -- |hit-enter| prompt and yes/no questions + QuickFixLine = { bg = cp.bg_visual, style = "bold" }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + Search = { bg = cp.bg_search, fg = cp.fg }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand oucp. + IncSearch = { bg = cp.cyan, fg = cp.black }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + SpecialKey = { fg = cp.fg }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + SpellBad = { sp = cp.error, style = "undercurl" }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap = { sp = cp.warning, style = "undercurl" }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal = { sp = cp.info, style = "undercurl" }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + SpellRare = { sp = cp.hint, style = "undercurl" }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine = { fg = cp.fg_sidebar, bg = cp.bg_statusline }, -- status line of current window + StatusLineNC = { fg = cp.fg_gutter, bg = cp.bg_statusline }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + TabLine = { bg = cp.bg_statusline, fg = cp.fg_gutter }, -- tab pages line, not active tab page label + TabLineFill = { bg = cp.black }, -- tab pages line, where there are no labels + TabLineSel = { fg = cp.fg_alt, bg = cp.fg_gutter }, -- tab pages line, active tab page label + Title = { fg = cp.blue, style = "bold" }, -- titles for output from ":set all", ":autocmd" etcp. + Visual = { bg = cp.bg_visual }, -- Visual mode selection + VisualNOS = { bg = cp.bg_visual }, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg = { fg = cp.warning }, -- warning messages + Whitespace = { fg = cp.fg_gutter }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + WildMenu = { bg = cp.bg_visual }, -- current match in 'wildmenu' completion -- These groups are not listed as default vim groups, -- but they are defacto standard group names for syntax highlighting. -- commented out groups should chain up to their "preferred" group by @@ -79,33 +83,33 @@ local function get_base() -- code itself - Constant = { fg = cpt.orange }, -- (preferred) any constant - String = { fg = cpt.green, style = cpc.styles.strings }, -- a string constant: "this is a string" - Character = { fg = cpt.green }, -- a character constant: 'c', '\n' - Number = { fg = cpt.orange_br }, -- a number constant: 234, 0xff - Float = { fg = cpt.orange_br }, -- a floating point constant: 2.3e10 - Boolean = { fg = cpt.orange_br }, -- a boolean constant: TRUE, false - Identifier = { fg = cpt.cyan, style = cpc.styles.variables }, -- (preferred) any variable name - Function = { fg = cpt.blue, style = cpc.styles.functions }, -- function name (also: methods for classes) - Statement = { fg = cpt.magenta_br }, -- (preferred) any statement - Conditional = { fg = cpt.red }, -- if, then, else, endif, switch, etcpt. - Repeat = { fg = cpt.red }, -- for, do, while, etcpt. - Label = { fg = cpt.magenta_br }, -- case, default, etcpt. - Operator = { fg = cpt.fg_alt }, -- "sizeof", "+", "*", etcpt. - Keyword = { fg = cpt.magenta, style = cpc.styles.keywords }, -- any other keyword + Constant = { fg = cp.orange }, -- (preferred) any constant + String = { fg = cp.green, style = cnf.styles.strings }, -- a string constant: "this is a string" + Character = { fg = cp.green }, -- a character constant: 'c', '\n' + Number = { fg = cp.orange_br }, -- a number constant: 234, 0xff + Float = { fg = cp.orange_br }, -- a floating point constant: 2.3e10 + Boolean = { fg = cp.orange_br }, -- a boolean constant: TRUE, false + Identifier = { fg = cp.cyan, 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.magenta_br }, -- (preferred) any statement + Conditional = { fg = cp.red }, -- if, then, else, endif, switch, etcp. + Repeat = { fg = cp.red }, -- for, do, while, etcp. + Label = { fg = cp.magenta_br }, -- case, default, etcp. + Operator = { fg = cp.fg_alt }, -- "sizeof", "+", "*", etcp. + Keyword = { fg = cp.magenta, style = cnf.styles.keywords }, -- any other keyword -- Exception = { }, -- try, catch, throw - PreProc = { fg = cpt.pink }, -- (preferred) generic Preprocessor - Include = { fg = cpt.pink }, -- preprocessor #include + 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, etcpt. + -- PreCondit = { }, -- preprocessor #if, #else, #endif, etcp. - Type = { fg = cpt.yellow }, -- (preferred) int, long, char, etcpt. - StorageClass = { fg = cpt.yellow }, -- static, register, volatile, etcpt. - Structure = { fg = cpt.yellow }, -- struct, union, enum, etcpt. - Typedef = { fg = cpt.yellow }, -- A typedef - Special = { fg = cpt.blue }, -- (preferred) any special symbol + Type = { fg = cp.yellow }, -- (preferred) int, long, char, 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.blue }, -- (preferred) any special symbol -- SpecialChar = { }, -- special character in a constant -- Tag = { }, -- you can use CTRL-] on this -- Delimiter = { }, -- character that needs attention @@ -118,59 +122,59 @@ local function get_base() -- ("Ignore", below, may be invisible...) -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| - Error = { fg = cpt.error }, -- (preferred) any erroneous construct - Todo = { bg = cpt.yellow, fg = cpt.bg, style = "bold" }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX - qfLineNr = { fg = cpt.yellow }, - qfFileName = { fg = cpt.blue }, - htmlH1 = { fg = cpt.magenta, style = "bold" }, - htmlH2 = { fg = cpt.blue, style = "bold" }, - -- mkdHeading = { fg = cpt.orange, style = "bold" }, - -- mkdCode = { bg = cpt.terminal_black, fg = cpt.fg }, - mkdCodeDelimiter = { bg = cpt.terminal_black, fg = cpt.fg }, - mkdCodeStart = { fg = cpt.cyan, style = "bold" }, - mkdCodeEnd = { fg = cpt.cyan, style = "bold" }, - -- mkdLink = { fg = cpt.blue, style = "underline" }, + Error = { fg = cp.error }, -- (preferred) any erroneous construct + Todo = { bg = cp.yellow, fg = cp.bg, 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.magenta, style = "bold" }, + htmlH2 = { fg = cp.blue, style = "bold" }, + -- mkdHeading = { fg = cp.orange, style = "bold" }, + -- mkdCode = { bg = cp.terminal_black, fg = cp.fg }, + mkdCodeDelimiter = { bg = cp.terminal_black, fg = cp.fg }, + mkdCodeStart = { fg = cp.cyan, style = "bold" }, + mkdCodeEnd = { fg = cp.cyan, style = "bold" }, + -- mkdLink = { fg = cp.blue, style = "underline" }, -- debugging - debugPC = { bg = cpt.bg_sidebar }, -- used for highlighting the current line in terminal-debug - debugBreakpoint = { bg = util.darken(cpt.info, 0.1), fg = cpt.info }, -- used for breakpoint colors in terminal-debug + debugPC = { bg = cp.bg_sidebar }, -- used for highlighting the current line in terminal-debug + debugBreakpoint = { bg = util.darken(cp.info, 0.1), fg = cp.info }, -- used for breakpoint colors in terminal-debug -- illuminate - illuminatedWord = { bg = cpt.fg_gutter }, - illuminatedCurWord = { bg = cpt.fg_gutter }, + illuminatedWord = { bg = cp.fg_gutter }, + illuminatedCurWord = { bg = cp.fg_gutter }, -- diff - diffAdded = { fg = cpt.diff.add }, - diffRemoved = { fg = cpt.diff.delete }, - diffChanged = { fg = cpt.diff.change }, - diffOldFile = { fg = cpt.yellow }, - diffNewFile = { fg = cpt.orange }, - diffFile = { fg = cpt.blue }, - diffLine = { fg = cpt.comment }, - diffIndexLine = { fg = cpt.magenta }, - DiffAdd = { fg = cpt.diff.add, bg = cpt.bg }, -- diff mode: Added line |diff.txt| - DiffChange = { fg = cpt.diff.change, bg = cpt.bg }, -- diff mode: Changed line |diff.txt| - DiffDelete = { fg = cpt.diff.delete, bg = cpt.bg }, -- diff mode: Deleted line |diff.txt| - DiffText = { fg = cpt.diff.text, bg = cpt.bg }, -- diff mode: Changed text within a changed line |diff.txt| + diffAdded = { fg = cp.diff.add }, + diffRemoved = { fg = cp.diff.delete }, + diffChanged = { fg = cp.diff.change }, + diffOldFile = { fg = cp.yellow }, + diffNewFile = { fg = cp.orange }, + diffFile = { fg = cp.blue }, + diffLine = { fg = cp.comment }, + diffIndexLine = { fg = cp.magenta }, + DiffAdd = { fg = cp.diff.add, bg = cp.bg }, -- diff mode: Added line |diff.txt| + DiffChange = { fg = cp.diff.change, bg = cp.bg }, -- diff mode: Changed line |diff.txt| + DiffDelete = { fg = cp.diff.delete, bg = cp.bg }, -- diff mode: Deleted line |diff.txt| + DiffText = { fg = cp.diff.text, bg = cp.bg }, -- diff mode: Changed text within a changed line |diff.txt| -- NeoVim - healthError = { fg = cpt.error }, - healthSuccess = { fg = cpt.green_br }, - healthWarning = { fg = cpt.warning }, + healthError = { fg = cp.error }, + healthSuccess = { fg = cp.green_br }, + healthWarning = { fg = cp.warning }, -- misc -- glyphs - GlyphPalette1 = { fg = cpt.red }, - GlyphPalette2 = { fg = cpt.green }, - GlyphPalette3 = { fg = cpt.yellow }, - GlyphPalette4 = { fg = cpt.blue }, - GlyphPalette6 = { fg = cpt.green_br }, - GlyphPalette7 = { fg = cpt.fg }, - GlyphPalette9 = { fg = cpt.red }, + GlyphPalette1 = { fg = cp.red }, + GlyphPalette2 = { fg = cp.green }, + GlyphPalette3 = { fg = cp.yellow }, + GlyphPalette4 = { fg = cp.blue }, + GlyphPalette6 = { fg = cp.green_br }, + GlyphPalette7 = { fg = cp.fg }, + GlyphPalette9 = { fg = cp.red }, } end local function get_integrations() - local integrations = cpc["integrations"] + local integrations = cnf["integrations"] local final_integrations = {} - local cpt = get_cs() + local cp = color_palette for integration in pairs(integrations) do local cot = false @@ -185,50 +189,50 @@ local function get_integrations() end if cot then - final_integrations = vim.tbl_deep_extend("force", final_integrations, require("catppuccino.core.integrations." .. integration).get(cpt)) + final_integrations = vim.tbl_deep_extend( + "force", + final_integrations, + require("catppuccino.core.integrations." .. integration).get(cp) + ) end end - final_integrations = vim.tbl_deep_extend("force", final_integrations, require("catppuccino.core.remaps").get_hig_remaps() or {}) + final_integrations = vim.tbl_deep_extend( + "force", + final_integrations, + require("catppuccino.core.remaps").get_hig_remaps() or {} + ) return final_integrations end -local function get_properties() - local cpt = get_cs() - local props = { - termguicolors = true, - background = "dark", - } - - if colors_util.assert_brightness(cpt.bg) then - props["background"] = "light" - end - - return props +local function get_terminal() + local g = vim.g + local cp = color_palette + + g.terminal_color_0 = cp.catppuccino0 + g.terminal_color_1 = cp.catppuccino1 + g.terminal_color_2 = cp.catppuccino2 + g.terminal_color_3 = cp.catppuccino3 + g.terminal_color_4 = cp.catppuccino4 + g.terminal_color_5 = cp.catppuccino5 + g.terminal_color_6 = cp.catppuccino6 + g.terminal_color_7 = cp.catppuccino7 + g.terminal_color_8 = cp.catppuccino8 + g.terminal_color_9 = cp.catppuccino9 + g.terminal_color_10 = cp.catppuccino10 end -function M.apply(cs) - _G.cpc = require("catppuccino.config").options - cs = cs or cpc.colorscheme - local err, color_scheme = require("catppuccino.core.cs").get_color_scheme(cs) - - -- cpc (global): config; exists while settings are applied - -- cs (local): colorscheme; usually passed to integrations - - if not err.status then - vim.api.nvim_err_writeln(err.msg) - end - - set_cs(color_scheme) +function M.apply() + _G.cnf = require("catppuccino.config").options local theme = {} - theme.colors = get_cs() - theme.base = get_base() - theme.integrations = get_integrations() - theme.properties = get_properties() + 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.cpc = nil + _G.cnf = nil return theme end diff --git a/lua/catppuccino/core/remaps.lua b/lua/catppuccino/core/remaps.lua index 91dd092..be81241 100644 --- a/lua/catppuccino/core/remaps.lua +++ b/lua/catppuccino/core/remaps.lua @@ -1,16 +1,7 @@ local M = {} -local cs_remaps -- colorscheme local hig_remaps -- highlight groups -function M.get_cs_remaps() - return cs_remaps -end - -function M.set_cs_remaps(val) - cs_remaps = val -end - function M.get_hig_remaps() return hig_remaps end diff --git a/lua/catppuccino/init.lua b/lua/catppuccino/init.lua index 3bfc3c6..f59a198 100644 --- a/lua/catppuccino/init.lua +++ b/lua/catppuccino/init.lua @@ -1,17 +1,12 @@ local M = {} -function M.load(args) - require("catppuccino.main").main("load", args) +function M.load() + require("catppuccino.main").main("load") end -function M.remap(colorscheme, hi_groups) - colorscheme = colorscheme or {} +function M.remap(hi_groups) hi_groups = hi_groups or {} - - local remaps_mod = require("catppuccino.core.remaps") - - remaps_mod.set_cs_remaps(colorscheme) - remaps_mod.set_hig_remaps(hi_groups) + require("catppuccino.core.remaps").set_hig_remaps(hi_groups) end function M.setup(custom_opts) diff --git a/lua/catppuccino/main.lua b/lua/catppuccino/main.lua index e9966c8..4386aa1 100644 --- a/lua/catppuccino/main.lua +++ b/lua/catppuccino/main.lua @@ -2,7 +2,7 @@ local M = {} local utils = require("catppuccino.utils.util") -local function load(colorscheme) +local function load() local catppuccino = require("catppuccino") if catppuccino.before_loading ~= nil then @@ -10,7 +10,7 @@ local function load(colorscheme) end -- colorscheme gets evaluated from mapper.lua - local theme = require("catppuccino.core.mapper").apply(colorscheme) + local theme = require("catppuccino.core.mapper").apply() utils.load(theme) if catppuccino.after_loading ~= nil then @@ -22,11 +22,11 @@ local function clear() vim.cmd("hi clear") end -function M.main(option, args) +function M.main(option) option = option or "load" if option == "load" then - load(args) + load() elseif option == "clear" then clear() else diff --git a/lua/catppuccino/utils/util.lua b/lua/catppuccino/utils/util.lua index ab69997..307b313 100644 --- a/lua/catppuccino/utils/util.lua +++ b/lua/catppuccino/utils/util.lua @@ -149,7 +149,7 @@ function util.load(theme) util.syntax(theme.integrations) if require("catppuccino.config").options["term_colors"] then - util.terminal(theme.colors) + util.terminal(theme.terminal) end end