From 9941af1d6f0911e57e10588ef1c3e02154181c29 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Wed, 13 Jul 2022 14:03:28 +0700 Subject: [PATCH] refactor(highlight): Deprecating style = string. Use style = table --- README.md | 40 +++++------ lua/catppuccin/config.lua | 40 +++++------ lua/catppuccin/core/integrations/cmp.lua | 6 +- .../core/integrations/dashboard.lua | 2 +- lua/catppuccin/core/integrations/feline.lua | 2 +- lua/catppuccin/core/integrations/hop.lua | 2 +- lua/catppuccin/core/integrations/leap.lua | 2 +- .../core/integrations/lightspeed.lua | 16 ++--- lua/catppuccin/core/integrations/markdown.lua | 4 +- lua/catppuccin/core/integrations/mini.lua | 28 ++++---- lua/catppuccin/core/integrations/neotree.lua | 2 +- lua/catppuccin/core/integrations/notify.lua | 10 +-- lua/catppuccin/core/integrations/nvimtree.lua | 2 +- .../core/integrations/telescope.lua | 2 +- .../core/integrations/treesitter.lua | 66 +++++++++---------- lua/catppuccin/core/mapper.lua | 42 ++++++------ lua/catppuccin/utils/util.lua | 17 ++--- 17 files changed, 138 insertions(+), 145 deletions(-) diff --git a/README.md b/README.md index 026913d..4ac9355 100644 --- a/README.md +++ b/README.md @@ -87,34 +87,34 @@ dim_inactive = false, transparent_background = false, term_colors = false, styles = { - comments = "italic", - conditionals = "italic", - loops = "NONE", - functions = "NONE", - keywords = "NONE", - strings = "NONE", - variables = "NONE", - numbers = "NONE", - booleans = "NONE", - properties = "NONE", - types = "NONE", - operators = "NONE", + comments = { "italic" }, + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, }, integrations = { treesitter = true, native_lsp = { enabled = true, virtual_text = { - errors = "italic", - hints = "italic", - warnings = "italic", - information = "italic", + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, }, underlines = { - errors = "underline", - hints = "underline", - warnings = "underline", - information = "underline", + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, }, }, coc_nvim = false, diff --git a/lua/catppuccin/config.lua b/lua/catppuccin/config.lua index b29ae42..ae9dcb8 100644 --- a/lua/catppuccin/config.lua +++ b/lua/catppuccin/config.lua @@ -10,34 +10,34 @@ config.options = { percentage = 0.15 }, styles = { - comments = "italic", - conditionals = "italic", - loops = "NONE", - functions = "NONE", - keywords = "NONE", - strings = "NONE", - variables = "NONE", - numbers = "NONE", - booleans = "NONE", - properties = "NONE", - types = "NONE", - operators = "NONE", + comments = { "italic" }, + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, }, integrations = { treesitter = true, native_lsp = { enabled = true, virtual_text = { - errors = "italic", - hints = "italic", - warnings = "italic", - information = "italic", + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, }, underlines = { - errors = "underline", - hints = "underline", - warnings = "underline", - information = "underline", + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, }, }, coc_nvim = false, diff --git a/lua/catppuccin/core/integrations/cmp.lua b/lua/catppuccin/core/integrations/cmp.lua index 57b0afb..513aeb9 100644 --- a/lua/catppuccin/core/integrations/cmp.lua +++ b/lua/catppuccin/core/integrations/cmp.lua @@ -3,11 +3,11 @@ local M = {} function M.get(cp) return { CmpItemAbbr = { fg = cp.overlay2 }, - CmpItemAbbrDeprecated = { fg = cp.overlay0, style = "strikethrough" }, + CmpItemAbbrDeprecated = { fg = cp.overlay0, style = { "strikethrough" } }, CmpItemKind = { fg = cp.blue }, CmpItemMenu = { fg = cp.text }, - CmpItemAbbrMatch = { fg = cp.text, style = "bold" }, - CmpItemAbbrMatchFuzzy = { fg = cp.text, style = "bold" }, + CmpItemAbbrMatch = { fg = cp.text, style = { "bold" } }, + CmpItemAbbrMatchFuzzy = { fg = cp.text, style = { "bold" } }, -- kind support CmpItemKindSnippet = { fg = cp.mauve }, diff --git a/lua/catppuccin/core/integrations/dashboard.lua b/lua/catppuccin/core/integrations/dashboard.lua index 4620800..b5d2c08 100644 --- a/lua/catppuccin/core/integrations/dashboard.lua +++ b/lua/catppuccin/core/integrations/dashboard.lua @@ -5,7 +5,7 @@ function M.get(cp) DashboardShortCut = { fg = cp.pink }, DashboardHeader = { fg = cp.blue }, DashboardCenter = { fg = cp.green }, - DashboardFooter = { fg = cp.yellow, style = "italic" }, + DashboardFooter = { fg = cp.yellow, style = { "italic" } }, } end diff --git a/lua/catppuccin/core/integrations/feline.lua b/lua/catppuccin/core/integrations/feline.lua index b2a347c..aff1094 100644 --- a/lua/catppuccin/core/integrations/feline.lua +++ b/lua/catppuccin/core/integrations/feline.lua @@ -114,7 +114,7 @@ local vi_mode_hl = function() return { fg = sett.bkg, bg = mode_colors[vim.fn.mode()][2], - style = "bold", + style = { "bold" }, } end diff --git a/lua/catppuccin/core/integrations/hop.lua b/lua/catppuccin/core/integrations/hop.lua index f4ed799..192a78b 100644 --- a/lua/catppuccin/core/integrations/hop.lua +++ b/lua/catppuccin/core/integrations/hop.lua @@ -3,7 +3,7 @@ local M = {} function M.get(cp) return { HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } }, - HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" }, + HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } }, HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } }, HopUnmatched = { bg = cp.base, fg = cp.overlay0 }, } diff --git a/lua/catppuccin/core/integrations/leap.lua b/lua/catppuccin/core/integrations/leap.lua index ae84e99..9846568 100644 --- a/lua/catppuccin/core/integrations/leap.lua +++ b/lua/catppuccin/core/integrations/leap.lua @@ -31,7 +31,7 @@ function M.get(cp) LeapLabelPrimary = {bg = cp.surface1, fg = cp.text}, LeapLabelSecondary = {bg = cp.surface1, fg = cp.text}, LeapBackdrop = {bg = cp.base, fg = cp.overlay0}, - LeapMatch = {bg = cp.base, fg = cp.red, style = "underline"}, + LeapMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, } end diff --git a/lua/catppuccin/core/integrations/lightspeed.lua b/lua/catppuccin/core/integrations/lightspeed.lua index 4b90a9e..e8ccf02 100644 --- a/lua/catppuccin/core/integrations/lightspeed.lua +++ b/lua/catppuccin/core/integrations/lightspeed.lua @@ -28,15 +28,15 @@ function M.get(cp) LightspeedOverlapped = {bg = cp.surface1, fg = cp.text}, LightspeedLabelDistant = {bg = cp.mauve, fg = cp.text}, LightspeedLabelDistantOverlapped = {bg = cp.mauve, fg = cp.text}, - LightspeedShortcut = {bg = cp.base, fg = cp.peach, style = "italic"}, - LightspeedShortcutOverlapped = {bg = cp.base, fg = cp.peach, style = "bold"}, - LightspeedMaskedChar = {bg = cp.base, fg = cp.red, style = "undercurl"}, + LightspeedShortcut = {bg = cp.base, fg = cp.peach, style = { "italic" }}, + LightspeedShortcutOverlapped = {bg = cp.base, fg = cp.peach, style = { "bold" }}, + LightspeedMaskedChar = {bg = cp.base, fg = cp.red, style = { "undercurl" }}, LightspeedGreyWash = {bg = cp.base, fg = cp.overlay0}, - LightspeedUnlabeledMatch = {bg = cp.base, fg = cp.red, style = "underline"}, - LightspeedOneCharMatch = {bg = cp.base, fg = cp.red, style = "underline"}, - LightspeedUniqueChar = {bg = cp.base, fg = cp.green, style = "strikethrough"}, - LightspeedPendingOpArea = {bg = cp.base, fg = cp.green, style = "strikethrough"}, - LightspeedPendingChangeOpArea = {bg = cp.base, fg = cp.green, style = "strikethrough"}, + LightspeedUnlabeledMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, + LightspeedOneCharMatch = {bg = cp.base, fg = cp.red, style = { "underline" }}, + LightspeedUniqueChar = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, + LightspeedPendingOpArea = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, + LightspeedPendingChangeOpArea = {bg = cp.base, fg = cp.green, style = { "strikethrough" }}, LightspeedCursor = {fg = cp.base, bg = cp.text}, } end diff --git a/lua/catppuccin/core/integrations/markdown.lua b/lua/catppuccin/core/integrations/markdown.lua index bdd68d2..cb80ff4 100644 --- a/lua/catppuccin/core/integrations/markdown.lua +++ b/lua/catppuccin/core/integrations/markdown.lua @@ -2,10 +2,10 @@ local M = {} function M.get(cp) return { - markdownHeadingDelimiter = { fg = cp.peach, style = "bold" }, + markdownHeadingDelimiter = { fg = cp.peach, style = { "bold" } }, markdownCode = { fg = cp.flamingo }, markdownCodeBlock = { fg = cp.flamingo }, - markdownLinkText = { fg = cp.blue, style = "underline" }, + markdownLinkText = { fg = cp.blue, style = { "underline" } }, markdownH1 = { fg = cp.lavender }, markdownH2 = { fg = cp.mauve }, markdownH3 = { fg = cp.green }, diff --git a/lua/catppuccin/core/integrations/mini.lua b/lua/catppuccin/core/integrations/mini.lua index 4280394..0bc9507 100644 --- a/lua/catppuccin/core/integrations/mini.lua +++ b/lua/catppuccin/core/integrations/mini.lua @@ -7,20 +7,20 @@ function M.get(cp) local inactive_bg = transparent_background and "NONE" or cp.mantle return { - MiniCompletionActiveParameter = { style = "underline" }, + MiniCompletionActiveParameter = { style = { "underline" } }, - MiniCursorword = { style = "underline" }, - MiniCursorwordCurrent = { style = "underline" }, + MiniCursorword = { style = { "underline" } }, + MiniCursorwordCurrent = { style = { "underline" } }, MiniIndentscopeSymbol = { fg = cp.text }, - MiniIndentscopePrefix = { style = "nocombine" }, -- Make it invisible + MiniIndentscopePrefix = { style = { "nocombine" } }, -- Make it invisible MiniJump = { fg = cp.overlay2, bg = cp.pink }, MiniJump2dSpot = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } }, MiniStarterCurrent = {}, - MiniStarterFooter = { fg = cp.yellow, style = "italic" }, + MiniStarterFooter = { fg = cp.yellow, style = { "italic" } }, MiniStarterHeader = { fg = cp.blue }, MiniStarterInactive = { fg = cp.surface2, style = cnf.styles.comments }, MiniStarterItem = { fg = cp.text }, @@ -33,12 +33,12 @@ function M.get(cp) MiniStatuslineFileinfo = { fg = cp.subtext1, bg = cp.surface1 }, MiniStatuslineFilename = { fg = cp.text, bg = cp.mantle }, MiniStatuslineInactive = { fg = cp.blue, bg = cp.mantle }, - MiniStatuslineModeCommand = { fg = cp.base, bg = cp.peach, style = "bold" }, - MiniStatuslineModeInsert = { fg = cp.base, bg = cp.green, style = "bold" }, - MiniStatuslineModeNormal = { fg = cp.mantle, bg = cp.blue, style = "bold" }, - MiniStatuslineModeOther = { fg = cp.base, bg = cp.teal, style = "bold" }, - MiniStatuslineModeReplace = { fg = cp.base, bg = cp.red, style = "bold" }, - MiniStatuslineModeVisual = { fg = cp.base, bg = cp.mauve, style = "bold" }, + MiniStatuslineModeCommand = { fg = cp.base, bg = cp.peach, style = { "bold" } }, + MiniStatuslineModeInsert = { fg = cp.base, bg = cp.green, style = { "bold" } }, + MiniStatuslineModeNormal = { fg = cp.mantle, bg = cp.blue, style = { "bold" } }, + MiniStatuslineModeOther = { fg = cp.base, bg = cp.teal, style = { "bold" } }, + MiniStatuslineModeReplace = { fg = cp.base, bg = cp.red, style = { "bold" } }, + MiniStatuslineModeVisual = { fg = cp.base, bg = cp.mauve, style = { "bold" } }, MiniSurround = { bg = cp.pink, fg = cp.surface1 }, @@ -51,9 +51,9 @@ function M.get(cp) MiniTablineTabpagesection = { fg = cp.surface1, bg = cp.base }, MiniTablineVisible = { fg = cp.subtext1, bg = cp.surface1 }, - MiniTestEmphasis = { style = "bold" }, - MiniTestFail = { fg = cp.red, style = "bold" }, - MiniTestPass = { fg = cp.green, style = "bold" }, + MiniTestEmphasis = { style = { "bold" } }, + MiniTestFail = { fg = cp.red, style = { "bold" } }, + MiniTestPass = { fg = cp.green, style = { "bold" } }, MiniTrailspace = { bg = cp.red }, } diff --git a/lua/catppuccin/core/integrations/neotree.lua b/lua/catppuccin/core/integrations/neotree.lua index 2bc12a6..6befc5f 100644 --- a/lua/catppuccin/core/integrations/neotree.lua +++ b/lua/catppuccin/core/integrations/neotree.lua @@ -15,7 +15,7 @@ function M.get(cp) NeoTreeDirectoryIcon = { fg = cp.blue }, NeoTreeNormal = { fg = cp.text, bg = neotree.transparent_panel and "NONE" or cp.mantle }, NeoTreeIndentMarker = { fg = cp.overlay0 }, - NeoTreeRootName = { fg = root_dir_color, style = "bold" }, + NeoTreeRootName = { fg = root_dir_color, style = { "bold" } }, NeoTreeSymbolicLinkTarget = { fg = cp.pink }, NeoTreeGitModified = { fg = cp.yellow }, NeoTreeUntracked = { fg = cp.blue }, diff --git a/lua/catppuccin/core/integrations/notify.lua b/lua/catppuccin/core/integrations/notify.lua index 4088ee8..24748b3 100644 --- a/lua/catppuccin/core/integrations/notify.lua +++ b/lua/catppuccin/core/integrations/notify.lua @@ -4,19 +4,19 @@ function M.get(cp) return { NotifyERRORBorder = { fg = cp.red }, NotifyERRORIcon = { fg = cp.red }, - NotifyERRORTitle = { fg = cp.red, style = "italic" }, + NotifyERRORTitle = { fg = cp.red, style = { "italic" } }, NotifyWARNBorder = { fg = cp.yellow }, NotifyWARNIcon = { fg = cp.yellow }, - NotifyWARNTitle = { fg = cp.yellow, style = "italic" }, + NotifyWARNTitle = { fg = cp.yellow, style = { "italic" } }, NotifyINFOBorder = { fg = cp.blue }, NotifyINFOIcon = { fg = cp.blue }, - NotifyINFOTitle = { fg = cp.blue, style = "italic" }, + NotifyINFOTitle = { fg = cp.blue, style = { "italic" } }, NotifyDEBUGBorder = { fg = cp.peach }, NotifyDEBUGIcon = { fg = cp.peach }, - NotifyDEBUGTitle = { fg = cp.peach, style = "italic" }, + NotifyDEBUGTitle = { fg = cp.peach, style = { "italic" } }, NotifyTRACEBorder = { fg = cp.rosewater }, NotifyTRACEIcon = { fg = cp.rosewater }, - NotifyTRACETitle = { fg = cp.rosewater, style = "italic" }, + NotifyTRACETitle = { fg = cp.rosewater, style = { "italic" } }, } end diff --git a/lua/catppuccin/core/integrations/nvimtree.lua b/lua/catppuccin/core/integrations/nvimtree.lua index 3e83973..7be4a5b 100644 --- a/lua/catppuccin/core/integrations/nvimtree.lua +++ b/lua/catppuccin/core/integrations/nvimtree.lua @@ -18,7 +18,7 @@ function M.get(cp) NvimTreeEmptyFolderName = { fg = cp.blue }, NvimTreeIndentMarker = { fg = cp.overlay0 }, NvimTreeVertSplit = { fg = cp.base, bg = cp.base }, - NvimTreeRootFolder = { fg = root_dir_color, style = "bold" }, + NvimTreeRootFolder = { fg = root_dir_color, style = { "bold" } }, NvimTreeSymlink = { fg = cp.pink }, NvimTreeStatuslineNc = { fg = cp.mantle, bg = cp.mantle }, NvimTreeGitDirty = { fg = cp.yellow }, diff --git a/lua/catppuccin/core/integrations/telescope.lua b/lua/catppuccin/core/integrations/telescope.lua index 4321323..de1db92 100644 --- a/lua/catppuccin/core/integrations/telescope.lua +++ b/lua/catppuccin/core/integrations/telescope.lua @@ -4,7 +4,7 @@ function M.get(cp) return { TelescopeBorder = { fg = cp.blue }, TelescopeSelectionCaret = { fg = cp.flamingo }, - TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = "bold" }, + TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = { "bold" } }, TelescopeMatching = { fg = cp.blue }, TelescopePromptPrefix = { bg = cp.crust }, TelescopePromptNormal = { bg = cp.crust}, diff --git a/lua/catppuccin/core/integrations/treesitter.lua b/lua/catppuccin/core/integrations/treesitter.lua index 3340774..7729bed 100644 --- a/lua/catppuccin/core/integrations/treesitter.lua +++ b/lua/catppuccin/core/integrations/treesitter.lua @@ -14,38 +14,38 @@ function M.get(cp) -- TSError -> Error for example, so you do not have to define these unless -- you explicitly want to support Treesitter's improved syntax awareness. TSField = { fg = cp.teal }, -- For fields. - TSProperty = { fg = cp.teal, style = cnf.styles.properties or "NONE" }, -- Same as TSField. + TSProperty = { fg = cp.teal, style = cnf.styles.properties or {} }, -- Same as TSField. - TSInclude = { fg = cp.mauve, style = cnf.styles.keywords or "NONE" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. - TSOperator = { fg = operators, style = cnf.styles.operators or "NONE" }, -- For any operator: +, but also -> and * in cp. - TSKeywordOperator = { fg = cp.mauve, style = cnf.styles.operators or "NONE" }, -- For new keyword operator - TSPunctSpecial = { fg = cp.sky, style = cnf.styles.operators or "NONE" }, -- For special punctutation that does not fall in the catagories before. + TSInclude = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. + TSOperator = { fg = operators, style = cnf.styles.operators or {} }, -- For any operator: +, but also -> and * in cp. + TSKeywordOperator = { fg = cp.mauve, style = cnf.styles.operators or {} }, -- For new keyword operator + TSPunctSpecial = { fg = cp.sky, style = cnf.styles.operators or {} }, -- For special punctutation that does not fall in the catagories before. - TSFloat = { fg = math_logic, style = cnf.styles.numbers or "NONE" }, -- For floats. - TSNumber = { fg = math_logic, style = cnf.styles.numbers or "NONE" }, -- For all numbers - TSBoolean = { fg = math_logic, style = cnf.styles.booleans or "NONE" }, -- For booleans. + TSFloat = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For floats. + TSNumber = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For all numbers + TSBoolean = { fg = math_logic, style = cnf.styles.booleans or {} }, -- For booleans. TSConstructor = { fg = cp.sapphire }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. TSConstant = { fg = cp.peach }, -- For constants - TSConditional = { fg = cl, style = cnf.styles.conditionals or "NONE" }, -- For keywords related to conditionnals. - TSRepeat = { fg = cl, style = cnf.styles.loops or "NONE" }, -- For keywords related to loops. - TSException = { fg = cp.mauve, style = cnf.styles.keywords or "NONE" }, -- For exception related keywords. + TSConditional = { fg = cl, style = cnf.styles.conditionals or {} }, -- For keywords related to conditionnals. + TSRepeat = { fg = cl, style = cnf.styles.loops or {} }, -- For keywords related to loops. + TSException = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For exception related keywords. -- builtin - TSConstBuiltin = { fg = cp.peach, style = cnf.styles.keywords or "NONE" }, -- For constant that are built in the language: nil in Lua. - TSFuncBuiltin = { fg = cp.peach, style = cnf.styles.functions or "NONE" }, -- For builtin functions: table.insert in Lua. + TSConstBuiltin = { fg = cp.peach, style = cnf.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua. + TSFuncBuiltin = { fg = cp.peach, style = cnf.styles.functions or {} }, -- For builtin functions: table.insert in Lua. - TSNamespace = { fg = cp.blue, style = "italic" }, -- For identifiers referring to modules and namespaces. - TSType = { fg = cp.yellow, style = cnf.styles.types or "NONE" }, -- For types. + TSNamespace = { fg = cp.blue, style = { "italic" } }, -- For identifiers referring to modules and namespaces. + TSType = { fg = cp.yellow, style = cnf.styles.types or {} }, -- For types. TSTypeBuiltin = { fg = cp.yellow, style = cnf.styles.properties or "italic" }, -- For builtin types. TSVariableBuiltin = { fg = cp.red }, -- Variable names that are defined by the languages, like this or self. - TSFunction = { fg = cp.blue, style = cnf.styles.functions or "NONE" }, -- For function (calls and definitions). - TSFuncMacro = { fg = cp.teal, style = cnf.styles.functions or "NONE" }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp. - TSParameter = { fg = cp.maroon, style = "italic" }, -- For parameters of a function. - TSKeywordFunction = { fg = cp.mauve, style = cnf.styles.keywords or "NONE" }, -- For keywords used to define a fuction. - TSKeyword = { fg = keywords, style = cnf.styles.keywords or "NONE" }, -- For keywords that don't fall in previous categories. - TSKeywordReturn = { fg = cp.mauve, style = cnf.styles.keywords or "NONE" }, + TSFunction = { fg = cp.blue, style = cnf.styles.functions or {} }, -- For function (calls and definitions). + TSFuncMacro = { fg = cp.teal, style = cnf.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp. + TSParameter = { fg = cp.maroon, style = { "italic" } }, -- For parameters of a function. + TSKeywordFunction = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For keywords used to define a fuction. + TSKeyword = { fg = keywords, style = cnf.styles.keywords or {} }, -- For keywords that don't fall in previous categories. + TSKeywordReturn = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. -- TSAttribute = { }; -- (unstable) TODO: docs -- TSCharacter = { }; -- For characters. @@ -57,18 +57,18 @@ function M.get(cp) -- TSError = { fg = cp.red }, -- For syntax/parser errors. -- rustTSField = { fg = cp.surface1 }, -- For fields. TSLabel = { fg = cp.sapphire }, -- For labels: label: in C and :label: in Lua. - TSMethod = { fg = cp.blue, style = cnf.styles.functions or "NONE" }, -- For method calls and definitions. + TSMethod = { fg = cp.blue, style = cnf.styles.functions or {} }, -- For method calls and definitions. -- TSNone = { }; -- TODO: docs -- TSParameterReference= { }; -- For references to parameters of a function. tomlTSProperty = { fg = cp.blue }, -- Differentiates between string and properties TSPunctDelimiter = { fg = cp.overlay2 }, -- For delimiters ie: . -- TSPunctBracket = { fg = delimeters }, -- For brackets and parenthesis. TSPunctBracket = { fg = cp.overlay2 }, -- For brackets and parenthesis. - TSString = { fg = cp.green, style = cnf.styles.strings or "NONE" }, -- For strings. - TSStringRegex = { fg = cp.peach, style = cnf.styles.strings or "NONE" }, -- For regexes. + TSString = { fg = cp.green, style = cnf.styles.strings or {} }, -- For strings. + TSStringRegex = { fg = cp.peach, style = cnf.styles.strings or {} }, -- For regexes. -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. - TSVariable = { fg = cp.text, style = cnf.styles.variables or "NONE" }, -- Any variable name that does not have another highlighcp. - TSTagAttribute = { fg = cp.teal, style = "italic" }, -- Tags like html tag names. + TSVariable = { fg = cp.text, style = cnf.styles.variables or {} }, -- Any variable name that does not have another highlighcp. + TSTagAttribute = { fg = cp.teal, style = { "italic" } }, -- Tags like html tag names. TSTag = { fg = cp.mauve }, -- Tags like html tag names. TSTagDelimiter = { fg = cp.sky }, -- Tag delimiter like < > / TSText = { fg = cp.text }, -- For strings considerated text in a markup language. @@ -81,16 +81,16 @@ function M.get(cp) -- -- Markdown tresitter parser support TSURI = { fg = cp.rosewater, style = { "italic", "underline" } }, -- urls, links and emails - TSLiteral = { fg = cp.teal, style = "italic" }, -- used for inline code in markdown and for doc in python (""") - TSTextReference = { fg = cp.lavender, style = "bold" }, -- references - TSTitle = { fg = cp.blue, style = "bold" }, -- titles like: # Example - TSEmphasis = { fg = cp.maroon, style = "italic" }, -- bold - TSStrong = { fg = cp.maroon, style = "bold" }, -- italic + TSLiteral = { fg = cp.teal, style = { "italic" } }, -- used for inline code in markdown and for doc in python (""") + TSTextReference = { fg = cp.lavender, style = { "bold" } }, -- references + TSTitle = { fg = cp.blue, style = { "bold" } }, -- titles like: # Example + TSEmphasis = { fg = cp.maroon, style = { "italic" } }, -- bold + TSStrong = { fg = cp.maroon, style = { "bold" } }, -- italic TSStringEscape = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string. -- bash - -- bashTSFuncBuiltin = { fg = cp.red, style = "italic" }, - -- bashTSParameter = { fg = cp.yellow, style = "italic" }, + -- bashTSFuncBuiltin = { fg = cp.red, style = { "italic" } }, + -- bashTSParameter = { fg = cp.yellow, style = { "italic" } }, -- json jsonTSLabel = { fg = cp.blue }, -- For labels: label: in C and :label: in Lua. diff --git a/lua/catppuccin/core/mapper.lua b/lua/catppuccin/core/mapper.lua index 3359662..6cefeb8 100644 --- a/lua/catppuccin/core/mapper.lua +++ b/lua/catppuccin/core/mapper.lua @@ -43,8 +43,8 @@ local function get_base() Substitute = { bg = cp.surface1, fg = cp.pink }, -- |:substitute| replacement text highlighting LineNr = { fg = ucolors.vary_color({ latte = cp.base0 }, cp.surface1) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp. CursorLineNr = { fg = cp.lavender }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. highlights the number in numberline. - MatchParen = { fg = cp.peach, 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.text, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ") + MatchParen = { fg = cp.peach, 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.text, style = { "bold" } }, -- 'showmode' message (e.g., "-- INSERT -- ") MsgArea = { fg = cp.text }, -- Area for messages and cmdline MsgSeparator = {}, -- Separator for scrolled messages, `msgsep` flag of 'display' MoreMsg = { fg = cp.blue }, -- |more-prompt| @@ -61,27 +61,27 @@ local function get_base() NormalFloat = { fg = cp.text, bg = cp.mantle }, -- Normal text in floating windows. FloatBorder = { fg = cp.blue }, Pmenu = { bg = cp.surface0, fg = cp.overlay2 }, -- Popup menu: normal item. - PmenuSel = { fg = cp.text, bg = cp.surface1, style = "bold" }, -- Popup menu: selected item. + PmenuSel = { fg = cp.text, bg = cp.surface1, style = { "bold" } }, -- Popup menu: selected item. PmenuSbar = { bg = cp.surface1 }, -- Popup menu: scrollbar. PmenuThumb = { bg = cp.overlay0 }, -- Popup menu: Thumb of the scrollbar. Question = { fg = cp.blue }, -- |hit-enter| prompt and yes/no questions - QuickFixLine = { bg = cp.surface1, style = "bold" }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + QuickFixLine = { bg = cp.surface1, style = { "bold" } }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. Search = { bg = ucolors.darken(cp.sky, 0.30, cp.base), fg = cp.text }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand oucp. IncSearch = { bg = ucolors.darken(cp.sky, 0.90, cp.base), fg = cp.mantle }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" CurSearch = { bg = cp.red, fg = cp.mantle }, -- 'cursearch' highlighting: highlights the current search you're on differently SpecialKey = { fg = cp.text }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' textspace. |hl-Whitespace| - SpellBad = { sp = cp.red, style = "undercurl" }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. - SpellCap = { sp = cp.yellow, style = "undercurl" }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. - SpellLocal = { sp = cp.blue, 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.green, style = "undercurl" }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + SpellBad = { sp = cp.red, style = { "undercurl" } }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap = { sp = cp.yellow, style = { "undercurl" } }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal = { sp = cp.blue, 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.green, 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.text, bg = cp.mantle }, -- status line of current window StatusLineNC = { fg = cp.surface1, bg = cp.mantle }, -- 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.mantle, fg = cp.surface1 }, -- tab pages line, not active tab page label TabLineFill = { bg = cp.black }, -- tab pages line, where there are no labels TabLineSel = { fg = cp.green, bg = cp.surface1 }, -- tab pages line, active tab page label - Title = { fg = cp.blue, style = "bold" }, -- titles for output from ":set all", ":autocmd" etcp. - Visual = { bg = cp.surface1, style = "bold" }, -- Visual mode selection - VisualNOS = { bg = cp.surface1, style = "bold" }, -- Visual mode selection when vim is "Not Owning the Selection". + Title = { fg = cp.blue, style = { "bold" } }, -- titles for output from ":set all", ":autocmd" etcp. + Visual = { bg = cp.surface1, style = { "bold" } }, -- Visual mode selection + VisualNOS = { bg = cp.surface1, style = { "bold" } }, -- Visual mode selection when vim is "Not Owning the Selection". WarningMsg = { fg = cp.yellow }, -- warning messages Whitespace = { fg = cp.surface1 }, -- "nbsp", "space", "tab" and "trail" in 'listchars' WildMenu = { bg = cp.overlay0 }, -- current match in 'wildmenu' completion @@ -127,24 +127,24 @@ local function get_base() -- 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" }, + 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 + 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" }, + 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" }, + 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 diff --git a/lua/catppuccin/utils/util.lua b/lua/catppuccin/utils/util.lua index be3e05b..f9a2bf1 100644 --- a/lua/catppuccin/utils/util.lua +++ b/lua/catppuccin/utils/util.lua @@ -11,26 +11,19 @@ function util.highlight(group, color) }) else if color.style then - if color.style ~= "NONE" then - if type(color.style) == "table" then - for _, style in ipairs(color.style) do - color[style] = true - end - else - color[color.style] = true - end + for _, style in ipairs(color.style) do + color[style] = true end end color.style = nil vim.api.nvim_set_hl(0, group, color) end - else - -- Doc: :h highlight-gui - if color.style and type(color.style) == "table" then + else -- Doc: :h highlight-gui + if color.style then color.style = table.concat(color.style, ",") end - local style = color.style and "gui=" .. color.style or "gui=NONE" + local style = (color.style and color.style ~= "") and "gui=" .. color.style or "gui=NONE" local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE" local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE" local sp = color.sp and "guisp=" .. color.sp or ""