diff --git a/README.md b/README.md index 38339a6..9527f1c 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,10 @@ integrations = { gitgutter = false, gitsigns = false, telescope = false, - nvimtree = false, + nvimtree = { + enabled = false, + show_root = false, + }, which_key = false, indent_blankline = false, dashboard = false, @@ -204,7 +207,10 @@ catppuccino.setup( gitgutter = false, gitsigns = false, telescope = false, - nvimtree = false, + nvimtree = { + enabled = false, + show_root = false, + }, which_key = false, indent_blankline = false, dashboard = false, @@ -261,7 +267,10 @@ catppuccino.setup( gitgutter = false, gitsigns = false, telescope = false, - nvimtree = false, + nvimtree = { + enabled = false, + show_root = false, + }, which_key = false, indent_blankline = false, dashboard = false, @@ -350,6 +359,17 @@ let g:lightline = {'colorscheme': 'catppuccino'} - **Kitty:** Copy and paste the file corresponding to theme you want to use from [this directory](https://github.com/Pocco81/Catppuccino.nvim/tree/main/extra/kitty) on your Kitty config. - **Alacritty:** Copy and paste the file corresponding to theme you want to use from [this directory](https://github.com/Pocco81/Catppuccino.nvim/tree/main/extra/alacritty) on your Alacritty config. +- **NvimTree:** setting `enabled` to `true` enables this integration: + +```lua +integration = { + nvimtree = { + enabled = true, + show_root = true, -- makes the root folder not transparent + } +} +``` +>>>>>>> main ## List of colorschemes diff --git a/lua/catppuccino/color_schemes/catppuccino.lua b/lua/catppuccino/color_schemes/catppuccino.lua index 77fc8a3..7705cb6 100644 --- a/lua/catppuccino/color_schemes/catppuccino.lua +++ b/lua/catppuccino/color_schemes/catppuccino.lua @@ -1,38 +1,38 @@ local util = require("catppuccino.utils.util") local colors = { - none = "NONE", - bg = "#0e171c", -- nvim bg - fg = "#abb2bf", -- fg color (text) - fg_gutter = "#3b4261", - black = "#393b44", - gray = "#2a2e36", - red = "#c94f6d", - green = "#97c374", - yellow = "#dbc074", - blue = "#61afef", - magenta = "#c678dd", - cyan = "#63cdcf", - white = "#dfdfe0", - orange = "#F4A261", - pink = "#D67AD2", - black_br = "#7f8c98", - red_br = "#e06c75", - green_br = "#58cd8b", - yellow_br = "#FFE37E", - blue_br = "#84CEE4", - magenta_br = "#B8A1E3", - cyan_br = "#59F0FF", - white_br = "#FDEBC3", - orange_br = "#F6A878", - pink_br = "#DF97DB", - comment = "#526175", - git = { - add = "#dfdfe0", - change = "#F6A878", - delete = "#e06c75", - conflict = "#FFE37E" - }, + none = "NONE", + bg = "#0e171c", -- nvim bg + fg = "#abb2bf", -- fg color (text) + fg_gutter = "#3b4261", + black = "#393b44", + gray = "#2a2e36", + red = "#c94f6d", + green = "#97c374", + yellow = "#dbc074", + blue = "#61afef", + magenta = "#c678dd", + cyan = "#63cdcf", + white = "#dfdfe0", + orange = "#F4A261", + pink = "#D67AD2", + black_br = "#7f8c98", + red_br = "#e06c75", + green_br = "#58cd8b", + yellow_br = "#FFE37E", + blue_br = "#84CEE4", + magenta_br = "#B8A1E3", + cyan_br = "#59F0FF", + white_br = "#FDEBC3", + orange_br = "#F6A878", + pink_br = "#DF97DB", + comment = "#526175", + git = { + add = "#dfdfe0", + change = "#F6A878", + delete = "#e06c75", + conflict = "#FFE37E", + }, } util.bg = colors.bg @@ -41,10 +41,10 @@ colors.bg_highlight = util.brighten(colors.bg, 0.05) colors.fg_alt = util.darken(colors.fg, 0.80, "#000000") colors.diff = { -- also used for gitsigns - add = util.darken(colors.blue, 0.50), - delete = util.darken(colors.red, 0.50), - change = util.darken(colors.yellow, 0.50), - text = colors.blue + add = util.darken(colors.blue, 0.50), + delete = util.darken(colors.red, 0.50), + change = util.darken(colors.yellow, 0.50), + text = colors.blue, } colors.git.ignore = colors.black diff --git a/lua/catppuccino/color_schemes/light_melya.lua b/lua/catppuccino/color_schemes/light_melya.lua index e4ebf8c..2c42ac7 100644 --- a/lua/catppuccino/color_schemes/light_melya.lua +++ b/lua/catppuccino/color_schemes/light_melya.lua @@ -1,38 +1,38 @@ local util = require("catppuccino.utils.util") local colors = { - none = "NONE", - bg = "#fbfbfb", -- nvim bg - fg = "#0E171C", -- fg color (text) - fg_gutter = "#3b4261", - black = "#393b44", - gray = "#2a2e36", - red = "#B0304E", - green = "#76AB49", - yellow = "#FFCE1F", - blue = "#157C8E", - magenta = "#A414CC", - cyan = "#63cdcf", - white = "#dfdfe0", - orange = "#A414CC", - pink = "#D67AD2", - black_br = "#7f8c98", - red_br = "#D84652", - green_br = "#58cd8b", - yellow_br = "#FFE37E", - blue_br = "#84CEE4", - magenta_br = "#B8A1E3", - cyan_br = "#59F0FF", - white_br = "#0E171C", - orange_br = "#F3843F", - pink_br = "#DF97DB", - comment = "#526175", - git = { - add = "#dfdfe0", - change = "#F4843E", - delete = "#e06c75", - conflict = "#FFE070", - } + none = "NONE", + bg = "#fbfbfb", -- nvim bg + fg = "#0E171C", -- fg color (text) + fg_gutter = "#3b4261", + black = "#393b44", + gray = "#2a2e36", + red = "#B0304E", + green = "#76AB49", + yellow = "#FFCE1F", + blue = "#157C8E", + magenta = "#A414CC", + cyan = "#63cdcf", + white = "#dfdfe0", + orange = "#A414CC", + pink = "#D67AD2", + black_br = "#7f8c98", + red_br = "#D84652", + green_br = "#58cd8b", + yellow_br = "#FFE37E", + blue_br = "#84CEE4", + magenta_br = "#B8A1E3", + cyan_br = "#59F0FF", + white_br = "#0E171C", + orange_br = "#F3843F", + pink_br = "#DF97DB", + comment = "#526175", + git = { + add = "#dfdfe0", + change = "#F4843E", + delete = "#e06c75", + conflict = "#FFE070", + }, } util.bg = colors.bg @@ -41,11 +41,11 @@ colors.bg_highlight = util.darken(colors.bg, 0.85, "#000000") colors.fg_alt = util.darken(colors.fg, 0.80, "#000000") colors.diff = { - -- also used for gitsigns - add = util.darken(colors.blue, 0.50), - delete = util.darken(colors.red, 0.50), - change = util.darken(colors.yellow, 0.50), - text = colors.blue + -- also used for gitsigns + add = util.darken(colors.blue, 0.50), + delete = util.darken(colors.red, 0.50), + change = util.darken(colors.yellow, 0.50), + text = colors.blue, } colors.git.ignore = colors.black diff --git a/lua/catppuccino/color_schemes/neon_latte.lua b/lua/catppuccino/color_schemes/neon_latte.lua index bb15731..306d1ab 100644 --- a/lua/catppuccino/color_schemes/neon_latte.lua +++ b/lua/catppuccino/color_schemes/neon_latte.lua @@ -1,38 +1,38 @@ local util = require("catppuccino.utils.util") local colors = { - none = "NONE", - bg = "#150b26", -- nvim bg - fg = "#FDEBC3", -- fg color (text) - fg_gutter = "#3b4261", - black = "#393b44", - gray = "#2a2e36", - red = "#CF4F6D", - green = "#51ee72", - yellow = "#FFE070", - blue = "#96e2f0", - magenta = "#d97bf2", - cyan = "#63cdcf", - white = "#dfdfe0", - orange = "#EDC580", - pink = "#D67AD2", - black_br = "#7f8c98", - red_br = "#e06c75", - green_br = "#58cd8b", - yellow_br = "#FFE37E", - blue_br = "#84CEE4", - magenta_br = "#B8A1E3", - cyan_br = "#59F0FF", - white_br = "#FDEBC3", - orange_br = "#F6A878", - pink_br = "#DF97DB", - comment = "#526175", - git = { - add = "#dfdfe0", - change = "#F8B58C", - delete = "#e06c75", - conflict = "#FFE070" - }, + none = "NONE", + bg = "#150b26", -- nvim bg + fg = "#FDEBC3", -- fg color (text) + fg_gutter = "#3b4261", + black = "#393b44", + gray = "#2a2e36", + red = "#CF4F6D", + green = "#51ee72", + yellow = "#FFE070", + blue = "#96e2f0", + magenta = "#d97bf2", + cyan = "#63cdcf", + white = "#dfdfe0", + orange = "#EDC580", + pink = "#D67AD2", + black_br = "#7f8c98", + red_br = "#e06c75", + green_br = "#58cd8b", + yellow_br = "#FFE37E", + blue_br = "#84CEE4", + magenta_br = "#B8A1E3", + cyan_br = "#59F0FF", + white_br = "#FDEBC3", + orange_br = "#F6A878", + pink_br = "#DF97DB", + comment = "#526175", + git = { + add = "#dfdfe0", + change = "#F8B58C", + delete = "#e06c75", + conflict = "#FFE070", + }, } util.bg = colors.bg @@ -41,10 +41,10 @@ colors.bg_highlight = util.brighten(colors.bg, 0.05) colors.fg_alt = util.darken(colors.fg, 0.80, "#000000") colors.diff = { -- also used for gitsigns - add = util.darken(colors.blue, 0.50), - delete = util.darken(colors.red, 0.50), - change = util.darken(colors.yellow, 0.50), - text = colors.blue + add = util.darken(colors.blue, 0.50), + delete = util.darken(colors.red, 0.50), + change = util.darken(colors.yellow, 0.50), + text = colors.blue, } colors.git.ignore = colors.black diff --git a/lua/catppuccino/config.lua b/lua/catppuccino/config.lua index 4dbb8f9..0f7d511 100644 --- a/lua/catppuccino/config.lua +++ b/lua/catppuccino/config.lua @@ -2,8 +2,8 @@ local config = {} config.options = { - colorscheme = "catppuccino", - transparency = false, + colorscheme = "catppuccino", + transparency = false, styles = { comments = "italic", functions = "italic", @@ -19,15 +19,18 @@ config.options = { errors = "italic", hints = "italic", warnings = "italic", - information = "italic" - } + information = "italic", + }, }, lsp_trouble = false, lsp_saga = false, gitgutter = false, gitsigns = false, telescope = false, - nvimtree = false, + nvimtree = { + enabled = false, + show_root = false, + }, which_key = false, indent_blankline = false, dashboard = false, @@ -37,12 +40,12 @@ config.options = { barbar = false, bufferline = false, markdown = false, - } + }, } function config.set_options(opts) - opts = opts or {} - config.options = vim.tbl_deep_extend("force", config.options, opts) + opts = opts or {} + config.options = vim.tbl_deep_extend("force", config.options, opts) end return config diff --git a/lua/catppuccino/core/cs.lua b/lua/catppuccino/core/cs.lua index a987043..17356cb 100644 --- a/lua/catppuccino/core/cs.lua +++ b/lua/catppuccino/core/cs.lua @@ -15,13 +15,17 @@ function M.get_color_scheme(cs) 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 Catppuccino Dark."}, require("catppuccino.color_schemes.catppuccino") + return { + status = false, + msg = "Catppuccino: the colorscheme '" .. cs .. "' was not recognized. Defaulting to Catppuccino Dark.", + }, + require("catppuccino.color_schemes.catppuccino") end if not (next(remaps) == nil) then - return {status = true}, vim.tbl_deep_extend("force", color_scheme, remaps) + return { status = true }, vim.tbl_deep_extend("force", color_scheme, remaps) else - return {status = true}, color_scheme + return { status = true }, color_scheme end end diff --git a/lua/catppuccino/core/integrations/barbar.lua b/lua/catppuccino/core/integrations/barbar.lua index 8ead618..200af47 100644 --- a/lua/catppuccino/core/integrations/barbar.lua +++ b/lua/catppuccino/core/integrations/barbar.lua @@ -3,25 +3,25 @@ local util = require("catppuccino.utils.util") local M = {} function M.get(cpt) - return { - BufferCurrent = {bg = cpt.fg_gutter, fg = cpt.fg}, - BufferCurrentIndex = {bg = cpt.fg_gutter, fg = cpt.info}, - BufferCurrentMod = {bg = cpt.fg_gutter, fg = cpt.warning}, - BufferCurrentSign = {bg = cpt.fg_gutter, fg = cpt.info}, - BufferCurrentTarget = {bg = cpt.fg_gutter, fg = cpt.red}, - BufferVisible = {bg = cpt.bg_statusline, fg = cpt.fg}, - BufferVisibleIndex = {bg = cpt.bg_statusline, fg = cpt.info}, - BufferVisibleMod = {bg = cpt.bg_statusline, fg = cpt.warning}, - BufferVisibleSign = {bg = cpt.bg_statusline, fg = cpt.info}, - BufferVisibleTarget = {bg = cpt.bg_statusline, fg = cpt.red}, - BufferInactive = {bg = cpt.bg_statusline, fg = cpt.comment}, - BufferInactiveIndex = {bg = cpt.bg_statusline, fg = cpt.comment}, - BufferInactiveMod = {bg = cpt.bg_statusline, fg = util.darken(cpt.warning, 0.7)}, - BufferInactiveSign = {bg = cpt.bg_statusline, fg = cpt.border_highlight}, - BufferInactiveTarget = {bg = cpt.bg_statusline, fg = cpt.red}, - BufferTabpages = {bg = cpt.bg_statusline, fg = cpt.none}, - BufferTabpage = {bg = cpt.bg_statusline, fg = cpt.border_highlight} - } + return { + BufferCurrent = { bg = cpt.fg_gutter, fg = cpt.fg }, + BufferCurrentIndex = { bg = cpt.fg_gutter, fg = cpt.info }, + BufferCurrentMod = { bg = cpt.fg_gutter, fg = cpt.warning }, + BufferCurrentSign = { bg = cpt.fg_gutter, fg = cpt.info }, + BufferCurrentTarget = { bg = cpt.fg_gutter, fg = cpt.red }, + BufferVisible = { bg = cpt.bg_statusline, fg = cpt.fg }, + BufferVisibleIndex = { bg = cpt.bg_statusline, fg = cpt.info }, + BufferVisibleMod = { bg = cpt.bg_statusline, fg = cpt.warning }, + BufferVisibleSign = { bg = cpt.bg_statusline, fg = cpt.info }, + BufferVisibleTarget = { bg = cpt.bg_statusline, fg = cpt.red }, + BufferInactive = { bg = cpt.bg_statusline, fg = cpt.comment }, + BufferInactiveIndex = { bg = cpt.bg_statusline, fg = cpt.comment }, + BufferInactiveMod = { bg = cpt.bg_statusline, fg = util.darken(cpt.warning, 0.7) }, + BufferInactiveSign = { bg = cpt.bg_statusline, fg = cpt.border_highlight }, + BufferInactiveTarget = { bg = cpt.bg_statusline, fg = cpt.red }, + BufferTabpages = { bg = cpt.bg_statusline, fg = cpt.none }, + BufferTabpage = { bg = cpt.bg_statusline, fg = cpt.border_highlight }, + } end return M diff --git a/lua/catppuccino/core/integrations/bufferline.lua b/lua/catppuccino/core/integrations/bufferline.lua index fd3b6c5..03d52e6 100644 --- a/lua/catppuccino/core/integrations/bufferline.lua +++ b/lua/catppuccino/core/integrations/bufferline.lua @@ -3,24 +3,24 @@ local util = require("catppuccino.utils.util") local M = {} function M.get(cpt) - return { - BufferLineFill = {bg = util.brighten(cpt.bg, 0.04)}, - BufferLineBackground = {fg = cpt.gray, bg = cpt.black}, - BufferLineBufferVisible = {fg = cpt.gray, bg = cpt.black}, - BufferLineBufferSelected = {fg = cpt.fg, bg = cpt.bg}, - BufferLineTab = {fg = cpt.gray, bg = cpt.bg}, - BufferLineTabSelected = {fg = cpt.red, bg = cpt.blue}, - BufferLineTabClose = {fg = cpt.red, bg = cpt.black}, - BufferLineIndicatorSelected = {fg = cpt.bg, bg = cpt.bg}, - -- separators - BufferLineSeparator = {fg = cpt.black, bg = cpt.black}, - BufferLineSeparatorVisible = {fg = cpt.black, bg = cpt.black}, - BufferLineSeparatorSelected = {fg = cpt.black, bg = cpt.black}, - -- close buttons - BufferLineCloseButton = {fg = cpt.gray, bg = cpt.black}, - BufferLineCloseButtonVisible = {fg = cpt.gray, bg = cpt.black}, - BufferLineCloseButtonSelected = {fg = cpt.red, bg = cpt.bg} - } + return { + BufferLineFill = { bg = util.brighten(cpt.bg, 0.04) }, + BufferLineBackground = { fg = cpt.gray, bg = cpt.black }, + BufferLineBufferVisible = { fg = cpt.gray, bg = cpt.black }, + BufferLineBufferSelected = { fg = cpt.fg, bg = cpt.bg }, + BufferLineTab = { fg = cpt.gray, bg = cpt.bg }, + BufferLineTabSelected = { fg = cpt.red, bg = cpt.blue }, + BufferLineTabClose = { fg = cpt.red, bg = cpt.black }, + BufferLineIndicatorSelected = { fg = cpt.bg, bg = cpt.bg }, + -- separators + BufferLineSeparator = { fg = cpt.black, bg = cpt.black }, + BufferLineSeparatorVisible = { fg = cpt.black, bg = cpt.black }, + BufferLineSeparatorSelected = { fg = cpt.black, bg = cpt.black }, + -- close buttons + BufferLineCloseButton = { fg = cpt.gray, bg = cpt.black }, + BufferLineCloseButtonVisible = { fg = cpt.gray, bg = cpt.black }, + BufferLineCloseButtonSelected = { fg = cpt.red, bg = cpt.bg }, + } end return M diff --git a/lua/catppuccino/core/integrations/dashboard.lua b/lua/catppuccino/core/integrations/dashboard.lua index f108d1a..097264c 100644 --- a/lua/catppuccino/core/integrations/dashboard.lua +++ b/lua/catppuccino/core/integrations/dashboard.lua @@ -1,12 +1,12 @@ local M = {} function M.get(cpt) - return { - DashboardShortCut = {fg = cpt.cyan}, - DashboardHeader = {fg = cpt.yellow}, - DashboardCenter = {fg = cpt.green}, - DashboardFooter = {fg = cpt.orange, style = "italic"} - } + return { + DashboardShortCut = { fg = cpt.cyan }, + DashboardHeader = { fg = cpt.yellow }, + DashboardCenter = { fg = cpt.green }, + DashboardFooter = { fg = cpt.orange, style = "italic" }, + } end return M diff --git a/lua/catppuccino/core/integrations/fern.lua b/lua/catppuccino/core/integrations/fern.lua index d68ad05..f0a5a6b 100644 --- a/lua/catppuccino/core/integrations/fern.lua +++ b/lua/catppuccino/core/integrations/fern.lua @@ -1,9 +1,9 @@ local M = {} function M.get(cpt) - return { - FernBranchText = {fg = cpt.blue} - } + return { + FernBranchText = { fg = cpt.blue }, + } end return M diff --git a/lua/catppuccino/core/integrations/gitgutter.lua b/lua/catppuccino/core/integrations/gitgutter.lua index be39b86..fed2940 100644 --- a/lua/catppuccino/core/integrations/gitgutter.lua +++ b/lua/catppuccino/core/integrations/gitgutter.lua @@ -1,10 +1,10 @@ local M = {} function M.get(cpt) - return { - GitGutterAdd = {fg = cpt.gitSigns.add}, -- diff mode: Added line |diff.txt| - GitGutterChange = {fg = cpt.gitSigns.change}, -- diff mode: Changed line |diff.txt| - GitGutterDelete = {fg = cpt.gitSigns.delete} -- diff mode: Deleted line |diff.txt| - } + return { + GitGutterAdd = { fg = cpt.gitSigns.add }, -- diff mode: Added line |diff.txt| + GitGutterChange = { fg = cpt.gitSigns.change }, -- diff mode: Changed line |diff.txt| + GitGutterDelete = { fg = cpt.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| + } end return M diff --git a/lua/catppuccino/core/integrations/gitsigns.lua b/lua/catppuccino/core/integrations/gitsigns.lua index 2d7bd11..929a825 100644 --- a/lua/catppuccino/core/integrations/gitsigns.lua +++ b/lua/catppuccino/core/integrations/gitsigns.lua @@ -1,11 +1,11 @@ local M = {} function M.get(cpt) - return { - GitSignsAdd = {fg = cpt.diff.add, bg = cpt.bg}, -- diff mode: Added line |diff.txt| - GitSignsChange = {fg = cpt.diff.change, bg = cpt.bg}, -- diff mode: Changed line |diff.txt| - GitSignsDelete = {fg = cpt.diff.delete, bg = cpt.bg} -- diff mode: Deleted line |diff.txt| - } + return { + GitSignsAdd = { fg = cpt.diff.add, bg = cpt.bg }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = cpt.diff.change, bg = cpt.bg }, -- diff mode: Changed line |diff.txt| + GitSignsDelete = { fg = cpt.diff.delete, bg = cpt.bg }, -- diff mode: Deleted line |diff.txt| + } end return M diff --git a/lua/catppuccino/core/integrations/indent_blankline.lua b/lua/catppuccino/core/integrations/indent_blankline.lua index 152db8d..6032d76 100644 --- a/lua/catppuccino/core/integrations/indent_blankline.lua +++ b/lua/catppuccino/core/integrations/indent_blankline.lua @@ -1,9 +1,9 @@ local M = {} function M.get(cpt) - return { - IndentBlanklineChar = {fg = cpt.gray} - } + return { + IndentBlanklineChar = { fg = cpt.gray }, + } end return M diff --git a/lua/catppuccino/core/integrations/lsp_saga.lua b/lua/catppuccino/core/integrations/lsp_saga.lua index 6c17953..3a65bee 100644 --- a/lua/catppuccino/core/integrations/lsp_saga.lua +++ b/lua/catppuccino/core/integrations/lsp_saga.lua @@ -1,27 +1,27 @@ local M = {} function M.get(cpt) - return { - DiagnosticError = {fg = cpt.error}, - DiagnosticWarning = {fg = cpt.warning}, - DiagnosticInformation = {fg = cpt.info}, - DiagnosticHint = {fg = cpt.hint}, - LspFloatWinNormal = {bg = cpt.bg_float}, - LspFloatWinBorder = {fg = cpt.border_highlight}, - LspSagaBorderTitle = {fg = cpt.cyan}, - LspSagaHoverBorder = {fg = cpt.blue}, - LspSagaRenameBorder = {fg = cpt.green}, - LspSagaDefPreviewBorder = {fg = cpt.green}, - LspSagaCodeActionBorder = {fg = cpt.blue}, - LspSagaFinderSelection = {fg = cpt.bg_visual}, - LspSagaCodeActionTitle = {fg = cpt.blue1}, - LspSagaCodeActionContent = {fg = cpt.purple}, - LspSagaSignatureHelpBorder = {fg = cpt.red}, - ReferencesCount = {fg = cpt.purple}, - DefinitionCount = {fg = cpt.purple}, - DefinitionIcon = {fg = cpt.blue}, - ReferencesIcon = {fg = cpt.blue}, - TargetWord = {fg = cpt.cyan} - } + return { + DiagnosticError = { fg = cpt.error }, + DiagnosticWarning = { fg = cpt.warning }, + DiagnosticInformation = { fg = cpt.info }, + DiagnosticHint = { fg = cpt.hint }, + LspFloatWinNormal = { bg = cpt.bg_float }, + LspFloatWinBorder = { fg = cpt.border_highlight }, + LspSagaBorderTitle = { fg = cpt.cyan }, + LspSagaHoverBorder = { fg = cpt.blue }, + LspSagaRenameBorder = { fg = cpt.green }, + LspSagaDefPreviewBorder = { fg = cpt.green }, + LspSagaCodeActionBorder = { fg = cpt.blue }, + LspSagaFinderSelection = { fg = cpt.bg_visual }, + LspSagaCodeActionTitle = { fg = cpt.blue1 }, + LspSagaCodeActionContent = { fg = cpt.purple }, + LspSagaSignatureHelpBorder = { fg = cpt.red }, + ReferencesCount = { fg = cpt.purple }, + DefinitionCount = { fg = cpt.purple }, + DefinitionIcon = { fg = cpt.blue }, + ReferencesIcon = { fg = cpt.blue }, + TargetWord = { fg = cpt.cyan }, + } end return M diff --git a/lua/catppuccino/core/integrations/lsp_trouble.lua b/lua/catppuccino/core/integrations/lsp_trouble.lua index 8713d23..59d2860 100644 --- a/lua/catppuccino/core/integrations/lsp_trouble.lua +++ b/lua/catppuccino/core/integrations/lsp_trouble.lua @@ -1,11 +1,11 @@ local M = {} function M.get(cpt) - return { - LspTroubleText = {fg = cpt.fg_alt}, - LspTroubleCount = {fg = cpt.magenta, bg = cpt.fg_gutter}, - LspTroubleNormal = {fg = cpt.fg_sidebar, bg = cpt.bg_sidebar} - } + return { + LspTroubleText = { fg = cpt.fg_alt }, + LspTroubleCount = { fg = cpt.magenta, bg = cpt.fg_gutter }, + LspTroubleNormal = { fg = cpt.fg_sidebar, bg = cpt.bg_sidebar }, + } end return M diff --git a/lua/catppuccino/core/integrations/markdown.lua b/lua/catppuccino/core/integrations/markdown.lua index e4dcf75..0aee43b 100644 --- a/lua/catppuccino/core/integrations/markdown.lua +++ b/lua/catppuccino/core/integrations/markdown.lua @@ -1,14 +1,14 @@ local M = {} function M.get(cpt) - return { - markdownHeadingDelimiter = {fg = cpt.orange, style = "bold"}, - markdownCode = {fg = cpt.cyan}, - markdownCodeBlock = {fg = cpt.cyan}, - markdownH1 = {fg = cpt.magenta, style = "bold"}, - markdownH2 = {fg = cpt.blue, style = "bold"}, - markdownLinkText = {fg = cpt.blue, style = "underline"} - } + return { + markdownHeadingDelimiter = { fg = cpt.orange, style = "bold" }, + markdownCode = { fg = cpt.cyan }, + markdownCodeBlock = { fg = cpt.cyan }, + markdownH1 = { fg = cpt.magenta, style = "bold" }, + markdownH2 = { fg = cpt.blue, style = "bold" }, + markdownLinkText = { fg = cpt.blue, style = "underline" }, + } end return M diff --git a/lua/catppuccino/core/integrations/native_lsp.lua b/lua/catppuccino/core/integrations/native_lsp.lua index 29f60f4..a042fd0 100644 --- a/lua/catppuccino/core/integrations/native_lsp.lua +++ b/lua/catppuccino/core/integrations/native_lsp.lua @@ -1,38 +1,38 @@ local M = {} function M.get(cpt) - return { - -- These groups are for the native LSP cliencpt. Some other LSP clients may - -- use these groups, or use their own. Consult your LSP client's - -- documentation. - LspReferenceText = {bg = cpt.fg_gutter}, -- used for highlighting "text" references - LspReferenceRead = {bg = cpt.fg_gutter}, -- used for highlighting "read" references - LspReferenceWrite = {bg = cpt.fg_gutter}, -- used for highlighting "write" references - -- hightlight diagnostics in numberline - LspDiagnosticsDefaultError = {fg = cpt.error}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultWarning = {fg = cpt.warning}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultInformation = {fg = cpt.info}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspDiagnosticsDefaultHint = {fg = cpt.hint}, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) - LspSignatureActiveParameter = {fg = cpt.orange}, - -- LspDiagnosticsFloatingError = { }, -- Used to color "Error" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingWarning = { }, -- Used to color "Warning" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingInformation = { }, -- Used to color "Information" diagnostic messages in diagnostics float - -- LspDiagnosticsFloatingHint = { }, -- Used to color "Hint" diagnostic messages in diagnostics float + return { + -- These groups are for the native LSP cliencpt. Some other LSP clients may + -- use these groups, or use their own. Consult your LSP client's + -- documentation. + LspReferenceText = { bg = cpt.fg_gutter }, -- used for highlighting "text" references + LspReferenceRead = { bg = cpt.fg_gutter }, -- used for highlighting "read" references + LspReferenceWrite = { bg = cpt.fg_gutter }, -- used for highlighting "write" references + -- hightlight diagnostics in numberline + LspDiagnosticsDefaultError = { fg = cpt.error }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) + LspDiagnosticsDefaultWarning = { fg = cpt.warning }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) + LspDiagnosticsDefaultInformation = { fg = cpt.info }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) + LspDiagnosticsDefaultHint = { fg = cpt.hint }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) + LspSignatureActiveParameter = { fg = cpt.orange }, + -- LspDiagnosticsFloatingError = { }, -- Used to color "Error" diagnostic messages in diagnostics float + -- LspDiagnosticsFloatingWarning = { }, -- Used to color "Warning" diagnostic messages in diagnostics float + -- LspDiagnosticsFloatingInformation = { }, -- Used to color "Information" diagnostic messages in diagnostics float + -- LspDiagnosticsFloatingHint = { }, -- Used to color "Hint" diagnostic messages in diagnostics float - LspDiagnosticsError = {fg = cpt.error}, - LspDiagnosticsWarning = {fg = cpt.warning}, - LspDiagnosticsInformation = {fg = cpt.info}, - LspDiagnosticsHint = {fg = cpt.hint}, - LspDiagnosticsVirtualTextError = {fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors}, -- Used for "Error" diagnostic virtual text - LspDiagnosticsVirtualTextWarning = {fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings}, -- Used for "Warning" diagnostic virtual text - LspDiagnosticsVirtualTextInformation = {fg = cpt.info, style = cpc.integrations.native_lsp.styles.information}, -- Used for "Information" diagnostic virtual text - LspDiagnosticsVirtualTextHint = {fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints}, -- Used for "Hint" diagnostic virtual text - LspDiagnosticsUnderlineError = {style = "underline", sp = cpt.error}, -- Used to underline "Error" diagnostics - LspDiagnosticsUnderlineWarning = {style = "underline", sp = cpt.warning}, -- Used to underline "Warning" diagnostics - LspDiagnosticsUnderlineInformation = {style = "underline", sp = cpt.info}, -- Used to underline "Information" diagnostics - LspDiagnosticsUnderlineHint = {style = "underline", sp = cpt.hint}, -- Used to underline "Hint" diagnostics - LspCodeLens = {fg = cpt.comment} -- virtual text of the codelens - } + LspDiagnosticsError = { fg = cpt.error }, + LspDiagnosticsWarning = { fg = cpt.warning }, + LspDiagnosticsInformation = { fg = cpt.info }, + LspDiagnosticsHint = { fg = cpt.hint }, + LspDiagnosticsVirtualTextError = { fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors }, -- Used for "Error" diagnostic virtual text + LspDiagnosticsVirtualTextWarning = { fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings }, -- Used for "Warning" diagnostic virtual text + LspDiagnosticsVirtualTextInformation = { fg = cpt.info, style = cpc.integrations.native_lsp.styles.information }, -- Used for "Information" diagnostic virtual text + LspDiagnosticsVirtualTextHint = { fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints }, -- Used for "Hint" diagnostic virtual text + LspDiagnosticsUnderlineError = { style = "underline", sp = cpt.error }, -- Used to underline "Error" diagnostics + LspDiagnosticsUnderlineWarning = { style = "underline", sp = cpt.warning }, -- Used to underline "Warning" diagnostics + LspDiagnosticsUnderlineInformation = { style = "underline", sp = cpt.info }, -- Used to underline "Information" diagnostics + LspDiagnosticsUnderlineHint = { style = "underline", sp = cpt.hint }, -- Used to underline "Hint" diagnostics + LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens + } end return M diff --git a/lua/catppuccino/core/integrations/neogit.lua b/lua/catppuccino/core/integrations/neogit.lua index 5aff07e..9b2913c 100644 --- a/lua/catppuccino/core/integrations/neogit.lua +++ b/lua/catppuccino/core/integrations/neogit.lua @@ -2,15 +2,15 @@ local util = require("catppuccino.utils.util") local M = {} function M.get(cpt) - return { - NeogitBranch = {fg = cpt.magenta}, - NeogitRemote = {fg = cpt.pink}, - NeogitHunkHeader = {bg = cpt.bg_highlight, fg = cpt.fg}, - NeogitHunkHeaderHighlight = {bg = cpt.fg_gutter, fg = cpt.blue}, - NeogitDiffContextHighlight = {bg = util.darken(cpt.fg_gutter, 0.5), fg = cpt.fg_alt}, - NeogitDiffDeleteHighlight = {fg = cpt.git.delete, bg = cpt.diff.delete}, - NeogitDiffAddHighlight = {fg = cpt.git.add, bg = cpt.diff.add} - } + return { + NeogitBranch = { fg = cpt.magenta }, + NeogitRemote = { fg = cpt.pink }, + NeogitHunkHeader = { bg = cpt.bg_highlight, fg = cpt.fg }, + NeogitHunkHeaderHighlight = { bg = cpt.fg_gutter, fg = cpt.blue }, + NeogitDiffContextHighlight = { bg = util.darken(cpt.fg_gutter, 0.5), fg = cpt.fg_alt }, + NeogitDiffDeleteHighlight = { fg = cpt.git.delete, bg = cpt.diff.delete }, + NeogitDiffAddHighlight = { fg = cpt.git.add, bg = cpt.diff.add }, + } end return M diff --git a/lua/catppuccino/core/integrations/nvimtree.lua b/lua/catppuccino/core/integrations/nvimtree.lua index 06d8c0b..dd0610c 100644 --- a/lua/catppuccino/core/integrations/nvimtree.lua +++ b/lua/catppuccino/core/integrations/nvimtree.lua @@ -1,24 +1,32 @@ local M = {} function M.get(cpt) - return { - NvimTreeFolderName = {fg = cpt.blue}, - NvimTreeFolderIcon = {fg = cpt.blue}, - NvimTreeNormal = {fg = cpt.fg, bg = cpt.bg_sidebar}, - NvimTreeOpenedFolderName = {fg = cpt.blue}, - NvimTreeEmptyFolderName = {fg = cpt.blue_br}, - NvimTreeIndentMarker = {fg = cpt.comment}, - NvimTreeVertSplit = {fg = cpt.black, bg = cpt.black}, - NvimTreeRootFolder = {fg = cpt.black, style = "bold"}, - NvimTreeSymlink = {fg = cpt.magenta}, - NvimTreeStatuslineNc = {fg = cpt.black, bg = cpt.black}, - NvimTreeGitDirty = {fg = cpt.git.change}, - NvimTreeGitNew = {fg = cpt.git.add}, - NvimTreeGitDeleted = {fg = cpt.git.delete}, - NvimTreeSpecialFile = {fg = cpt.cyan}, - NvimTreeImageFile = {fg = cpt.fg_sidebar}, - NvimTreeOpenedFile = {fg = cpt.magenta} - } + local config = require("catppuccino.config").options + + local root_dir_color = cpt.bg_sidebar + + if config.integrations.nvimtree.show_root then + root_dir_color = cpt.blue + end + + return { + NvimTreeFolderName = { fg = cpt.blue }, + NvimTreeFolderIcon = { fg = cpt.blue }, + NvimTreeNormal = { fg = cpt.fg, bg = cpt.bg_sidebar }, + NvimTreeOpenedFolderName = { fg = cpt.blue }, + NvimTreeEmptyFolderName = { fg = cpt.blue_br }, + NvimTreeIndentMarker = { fg = cpt.comment }, + NvimTreeVertSplit = { fg = cpt.black, bg = cpt.black }, + NvimTreeRootFolder = { fg = root_dir_color, style = "bold" }, + NvimTreeSymlink = { fg = cpt.magenta }, + NvimTreeStatuslineNc = { fg = cpt.black, bg = cpt.black }, + NvimTreeGitDirty = { fg = cpt.git.change }, + NvimTreeGitNew = { fg = cpt.git.add }, + NvimTreeGitDeleted = { fg = cpt.git.delete }, + NvimTreeSpecialFile = { fg = cpt.cyan }, + NvimTreeImageFile = { fg = cpt.fg_sidebar }, + NvimTreeOpenedFile = { fg = cpt.magenta }, + } end return M diff --git a/lua/catppuccino/core/integrations/telescope.lua b/lua/catppuccino/core/integrations/telescope.lua index 18dad73..010b526 100644 --- a/lua/catppuccino/core/integrations/telescope.lua +++ b/lua/catppuccino/core/integrations/telescope.lua @@ -1,12 +1,12 @@ local M = {} function M.get(cpt) - return { - TelescopeBorder = {fg = cpt.border_highlight}, - TelescopeSelectionCaret = {fg = cpt.cyan}, - TelescopeSelection = {fg = cpt.cyan, bg = cpt.bg_highlight}, - TelescopeMatching = {fg = cpt.blue} - } + return { + TelescopeBorder = { fg = cpt.border_highlight }, + TelescopeSelectionCaret = { fg = cpt.cyan }, + TelescopeSelection = { fg = cpt.cyan, bg = cpt.bg_highlight }, + TelescopeMatching = { fg = cpt.blue }, + } end return M diff --git a/lua/catppuccino/core/integrations/treesitter.lua b/lua/catppuccino/core/integrations/treesitter.lua index 995b30d..83ffbd9 100644 --- a/lua/catppuccino/core/integrations/treesitter.lua +++ b/lua/catppuccino/core/integrations/treesitter.lua @@ -14,51 +14,51 @@ function M.get(cpt) -- TSBoolean = { }; -- For booleans. -- TSCharacter = { }; -- For characters. -- TSComment = { }; -- For comment blocks. - TSNote = {fg = cpt.bg, bg = cpt.info}, - TSWarning = {fg = cpt.bg, bg = cpt.warning}, - TSDanger = {fg = cpt.bg, bg = cpt.error}, - TSConstructor = {fg = cpt.magenta}, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. + TSNote = { fg = cpt.bg, bg = cpt.info }, + TSWarning = { fg = cpt.bg, bg = cpt.warning }, + TSDanger = { fg = cpt.bg, bg = cpt.error }, + TSConstructor = { fg = cpt.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. -- TSConditional = { }; -- For keywords related to conditionnals. - TSConstant = {fg = cpt.orange}, -- For constants - TSConstBuiltin = {fg = cpt.orange_br}, -- For constant that are built in the language: `nil` in Lua. + TSConstant = { fg = cpt.orange }, -- For constants + TSConstBuiltin = { fg = cpt.orange_br }, -- For constant that are built in the language: `nil` in Lua. -- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in cpt. -- TSError = { }; -- For syntax/parser errors. -- TSException = { }; -- For exception related keywords. - TSField = {fg = cpt.red}, -- For fields. - rustTSField = {fg = util.darken(cpt.white, 0.75)}, -- For fields. + TSField = { fg = cpt.red }, -- For fields. + rustTSField = { fg = util.darken(cpt.white, 0.75) }, -- For fields. -- TSFloat = { }; -- For floats. -- TSFunction = { fg = cpt.fg_gutter }, -- For function (calls and definitions). - TSFuncBuiltin = {fg = cpt.cyan}, -- For builtin functions: `table.insert` in Lua. - TSFuncMacro = {fg = cpt.red}, -- For macro defined functions (calls and definitions): each `macro_rules` in Ruscpt. + 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 = { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. - TSKeyword = {fg = cpt.magenta, style = cpc.styles.keywords}, -- For keywords that don't fall in previous categories. - TSKeywordFunction = {fg = cpt.magenta, style = cpc.styles.functions}, -- For keywords used to define a fuction. - TSLabel = {fg = cpt.blue}, -- For labels: `label:` in C and `:label:` in Lua. + TSKeyword = { fg = cpt.magenta, style = cpc.styles.keywords }, -- For keywords that don't fall in previous categories. + TSKeywordFunction = { fg = cpt.magenta, style = cpc.styles.functions }, -- For keywords used to define a fuction. + TSLabel = { fg = cpt.blue }, -- For labels: `label:` in C and `:label:` in Lua. -- TSMethod = { }; -- For method calls and definitions. - TSNamespace = {fg = cpt.cyan}, -- For identifiers referring to modules and namespaces. + TSNamespace = { fg = cpt.cyan }, -- For identifiers referring to modules and namespaces. -- TSNone = { }; -- TODO: docs -- TSNumber = { }; -- For all numbers - TSOperator = {fg = cpt.fg}, -- For any operator: `+`, but also `->` and `*` in cpt. - TSParameter = {fg = cpt.orange_br}, -- For parameters of a function. + TSOperator = { fg = cpt.fg }, -- For any operator: `+`, but also `->` and `*` in cpt. + TSParameter = { fg = cpt.orange_br }, -- For parameters of a function. -- TSParameterReference= { }; -- For references to parameters of a function. - TSProperty = {fg = cpt.red_br}, -- Same as `TSField`. - tomlTSProperty = {fg = cpt.blue}, -- Differentiates between string and properties - TSPunctDelimiter = {fg = util.string_to_color(cpt, "", cpt.fg_alt)}, -- For delimiters ie: `.` - TSPunctBracket = {fg = cpt.red}, -- For brackets and parenthesis. - TSPunctSpecial = {fg = cpt.white}, -- For special punctutation that does not fall in the catagories before. + TSProperty = { fg = cpt.red_br }, -- Same as `TSField`. + tomlTSProperty = { fg = cpt.blue }, -- Differentiates between string and properties + TSPunctDelimiter = { fg = util.string_to_color(cpt, "", cpt.fg_alt) }, -- For delimiters ie: `.` + TSPunctBracket = { fg = cpt.red }, -- For brackets and parenthesis. + TSPunctSpecial = { fg = cpt.white }, -- For special punctutation that does not fall in the catagories before. -- TSRepeat = { }; -- For keywords related to loops. -- TSString = { }; -- For strings. - TSStringRegex = {fg = cpt.blue, style = cpc.styles.strings}, -- For regexes. - TSStringEscape = {fg = cpt.magenta, style = cpc.styles.strings}, -- For escape characters within a string. + TSStringRegex = { fg = cpt.blue, style = cpc.styles.strings }, -- For regexes. + TSStringEscape = { fg = cpt.magenta, style = cpc.styles.strings }, -- For escape characters within a string. -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. -- TSType = { }; -- For types. - TSTypeBuiltin = {fg = cpt.cyan}, -- For builtin types. - TSVariable = {style = cpc.styles.variables}, -- Any variable name that does not have another highlighcpt. - TSVariableBuiltin = {fg = cpt.red}, -- Variable names that are defined by the languages, like `this` or `self`. + TSTypeBuiltin = { fg = cpt.cyan }, -- For builtin types. + TSVariable = { style = cpc.styles.variables }, -- Any variable name that does not have another highlighcpt. + TSVariableBuiltin = { fg = cpt.red }, -- Variable names that are defined by the languages, like `this` or `self`. -- TSTag = { }; -- Tags like html tag names. -- TSTagDelimiter = { }; -- Tag delimiter like `<` `>` `/` -- TSText = { }; -- For strings considered text in a markup language. - TSTextReference = {fg = cpt.cyan} + TSTextReference = { fg = cpt.cyan }, -- TSEmphasis = { }; -- For text to be represented with emphasis. -- TSUnderline = { }; -- For text to be represented with an underline. -- TSStrike = { }; -- For strikethrough texcpt. @@ -69,4 +69,3 @@ function M.get(cpt) end return M - diff --git a/lua/catppuccino/core/integrations/vim_sneak.lua b/lua/catppuccino/core/integrations/vim_sneak.lua index 4763955..457ff5e 100644 --- a/lua/catppuccino/core/integrations/vim_sneak.lua +++ b/lua/catppuccino/core/integrations/vim_sneak.lua @@ -1,10 +1,10 @@ local M = {} function M.get(cpt) - return { - Sneak = {fg = cpt.bg_highlight, bg = cpt.magenta}, - SneakScope = {bg = cpt.bg_visual} - } + return { + Sneak = { fg = cpt.bg_highlight, bg = cpt.magenta }, + SneakScope = { bg = cpt.bg_visual }, + } end return M diff --git a/lua/catppuccino/core/integrations/which_key.lua b/lua/catppuccino/core/integrations/which_key.lua index 36f8484..acbe7d2 100644 --- a/lua/catppuccino/core/integrations/which_key.lua +++ b/lua/catppuccino/core/integrations/which_key.lua @@ -1,15 +1,15 @@ local M = {} function M.get(cpt) - return { - WhichKey = {fg = cpt.cyan}, - WhichKeyGroup = {fg = cpt.blue}, - WhichKeyDesc = {fg = cpt.magenta}, - WhichKeySeperator = {fg = cpt.comment}, - WhichKeySeparator = {fg = cpt.comment}, - WhichKeyFloat = {bg = cpt.bg_sidebar}, - WhichKeyValue = {fg = cpt.comment} - } + return { + WhichKey = { fg = cpt.cyan }, + WhichKeyGroup = { fg = cpt.blue }, + WhichKeyDesc = { fg = cpt.magenta }, + WhichKeySeperator = { fg = cpt.comment }, + WhichKeySeparator = { fg = cpt.comment }, + WhichKeyFloat = { bg = cpt.bg_sidebar }, + WhichKeyValue = { fg = cpt.comment }, + } end return M diff --git a/lua/catppuccino/core/mapper.lua b/lua/catppuccino/core/mapper.lua index 8ef861e..55c657b 100644 --- a/lua/catppuccino/core/mapper.lua +++ b/lua/catppuccino/core/mapper.lua @@ -6,227 +6,227 @@ local M = {} local _cs local function get_cs() -- return a cleaned and parsed colorscheme - return _cs + return _cs end local function set_cs(val) - _cs = val + _cs = val end local function get_base() - local cpt = get_cs() - - 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 - 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.black}, -- 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 - -- 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 - -- default, - -- Uncomment and edit if you want more specific syntax highlighting. - - -- 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 - -- Exception = { }, -- try, catch, throw - - PreProc = {fg = cpt.pink}, -- (preferred) generic Preprocessor - Include = {fg = cpt.pink}, -- preprocessor #include - -- Define = { }, -- preprocessor #define - -- Macro = { }, -- same as Define - -- PreCondit = { }, -- preprocessor #if, #else, #endif, etcpt. - - 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 - -- SpecialChar = { }, -- special character in a constant - -- Tag = { }, -- you can use CTRL-] on this - -- Delimiter = { }, -- character that needs attention - -- SpecialComment= { }, -- special things inside a comment - -- 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 = cpt.error}, -- (preferred) any erroneous construct - Todo = {bg = cpt.yellow, fg = cpt.bg}, -- (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" }, - - -- 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 - -- illuminate - illuminatedWord = {bg = cpt.fg_gutter}, - illuminatedCurWord = {bg = cpt.fg_gutter}, - -- diff - diffAdded = {fg = cpt.git.add}, - diffRemoved = {fg = cpt.git.delete}, - diffChanged = {fg = cpt.git.change}, - diffOldFile = {fg = cpt.yellow}, - diffNewFile = {fg = cpt.orange}, - diffFile = {fg = cpt.blue}, - diffLine = {fg = cpt.comment}, - diffIndexLine = {fg = cpt.magenta}, - -- git diff - 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| - -- NeoVim - healthError = {fg = cpt.error}, - healthSuccess = {fg = cpt.green_br}, - healthWarning = {fg = cpt.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} - } + local cpt = get_cs() + + 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 + 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.black }, -- 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 + -- 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 + -- default, + -- Uncomment and edit if you want more specific syntax highlighting. + + -- 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 + -- Exception = { }, -- try, catch, throw + + PreProc = { fg = cpt.pink }, -- (preferred) generic Preprocessor + Include = { fg = cpt.pink }, -- preprocessor #include + -- Define = { }, -- preprocessor #define + -- Macro = { }, -- same as Define + -- PreCondit = { }, -- preprocessor #if, #else, #endif, etcpt. + + 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 + -- SpecialChar = { }, -- special character in a constant + -- Tag = { }, -- you can use CTRL-] on this + -- Delimiter = { }, -- character that needs attention + -- SpecialComment= { }, -- special things inside a comment + -- 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 = cpt.error }, -- (preferred) any erroneous construct + Todo = { bg = cpt.yellow, fg = cpt.bg }, -- (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" }, + + -- 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 + -- illuminate + illuminatedWord = { bg = cpt.fg_gutter }, + illuminatedCurWord = { bg = cpt.fg_gutter }, + -- diff + diffAdded = { fg = cpt.git.add }, + diffRemoved = { fg = cpt.git.delete }, + diffChanged = { fg = cpt.git.change }, + diffOldFile = { fg = cpt.yellow }, + diffNewFile = { fg = cpt.orange }, + diffFile = { fg = cpt.blue }, + diffLine = { fg = cpt.comment }, + diffIndexLine = { fg = cpt.magenta }, + -- git diff + 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| + -- NeoVim + healthError = { fg = cpt.error }, + healthSuccess = { fg = cpt.green_br }, + healthWarning = { fg = cpt.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 }, + } end local function get_integrations() - local integrations = cpc["integrations"] - local final_integrations = {} - local cpt = get_cs() - - 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 - table.insert(final_integrations, require("catppuccino.core.integrations." .. integration).get(cpt)) - end - end - - return final_integrations + local integrations = cpc["integrations"] + local final_integrations = {} + local cpt = get_cs() + + 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 + table.insert(final_integrations, require("catppuccino.core.integrations." .. integration).get(cpt)) + end + end + + return final_integrations end local function get_properties() - local cpt = get_cs() - local props = { - termguicolors = true, - background = "dark" - } + local cpt = get_cs() + local props = { + termguicolors = true, + background = "dark", + } - if (colors_util.assert_brightness(cpt.bg)) then - props["background"] = "light" - end + if colors_util.assert_brightness(cpt.bg) then + props["background"] = "light" + end - return props + return props 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) + _G.cpc = require("catppuccino.config").options + cs = cs or cpc.colorscheme + local err, color_scheme = require("catppuccino.core.cs").get_color_scheme(cs) - if not err.status then - vim.api.nvim_err_writeln(err.msg) - end + if not err.status then + vim.api.nvim_err_writeln(err.msg) + end - set_cs(color_scheme) + set_cs(color_scheme) - local theme = {} - theme.base = get_base() - theme.integrations = get_integrations() - theme.properties = get_properties() + local theme = {} + theme.base = get_base() + theme.integrations = get_integrations() + theme.properties = get_properties() - -- uninstantiate to avoid poluting global scope and because they are not needed anymore - _G.cpc = nil + -- uninstantiate to avoid poluting global scope and because they are not needed anymore + _G.cpc = nil - return theme + return theme end return M diff --git a/lua/catppuccino/init.lua b/lua/catppuccino/init.lua index 443a956..aeb5d9c 100644 --- a/lua/catppuccino/init.lua +++ b/lua/catppuccino/init.lua @@ -1,12 +1,12 @@ local M = {} function M.load() - require("catppuccino.main").main("load") + require("catppuccino.main").main("load") end function M.setup(custom_opts, remaps) remaps = remaps or {} - require("catppuccino.config").set_options(custom_opts) + require("catppuccino.config").set_options(custom_opts) require("catppuccino.core.cs").set_remaps(remaps) end diff --git a/lua/catppuccino/main.lua b/lua/catppuccino/main.lua index a8396de..84749a8 100644 --- a/lua/catppuccino/main.lua +++ b/lua/catppuccino/main.lua @@ -5,26 +5,26 @@ local utils = require("catppuccino.utils.util") local function load(args) local catppuccino = require("catppuccino") - if (catppuccino.before_loading ~= nil) then - catppuccino.before_loading() - end + if catppuccino.before_loading ~= nil then + catppuccino.before_loading() + end local theme = require("catppuccino.core.mapper").apply(args) utils.load(theme) - if (catppuccino.after_loading ~= nil) then - catppuccino.after_loading() - end + if catppuccino.after_loading ~= nil then + catppuccino.after_loading() + end end function M.main(option, args) - option = option or "load" + option = option or "load" - if (option == "load") then + if option == "load" then load(args) - else - print("Catppuccino: command was not recognized") - end + else + print("Catppuccino: command was not recognized") + end end return M diff --git a/lua/catppuccino/utils/cli_completion.lua b/lua/catppuccino/utils/cli_completion.lua index 6e906dd..b98de0f 100644 --- a/lua/catppuccino/utils/cli_completion.lua +++ b/lua/catppuccino/utils/cli_completion.lua @@ -1,7 +1,7 @@ local M = {} function M.available_commands() - return vim.tbl_keys(require("catppuccino.core.list_cs")) + return vim.tbl_keys(require("catppuccino.core.list_cs")) end return M diff --git a/lua/catppuccino/utils/colors.lua b/lua/catppuccino/utils/colors.lua index fd55914..4e38058 100644 --- a/lua/catppuccino/utils/colors.lua +++ b/lua/catppuccino/utils/colors.lua @@ -1,28 +1,28 @@ local M = {} local function color_is_bright(r, g, b) - -- Counting the perceptive luminance - human eye favors green color - local luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255 - if luminance > 0.5 then - return true -- Bright colors, black font - else - return false -- Dark colors, white font - end + -- Counting the perceptive luminance - human eye favors green color + local luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255 + if luminance > 0.5 then + return true -- Bright colors, black font + else + return false -- Dark colors, white font + end end function M.hex2rgb(hex) - return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) + return tonumber("0x" .. hex:sub(1, 2)), tonumber("0x" .. hex:sub(3, 4)), tonumber("0x" .. hex:sub(5, 6)) end function M.assert_brightness(color) - local hex = color:gsub("#", "") - local r = M.hex2rgb(string.sub(hex, 1, 2)) - local g = M.hex2rgb(string.sub(hex, 3, 4)) - local b = M.hex2rgb(string.sub(hex, 5, 6)) + local hex = color:gsub("#", "") + local r = M.hex2rgb(string.sub(hex, 1, 2)) + local g = M.hex2rgb(string.sub(hex, 3, 4)) + local b = M.hex2rgb(string.sub(hex, 5, 6)) - if (color_is_bright(tonumber(r), tonumber(g), tonumber(b)) == true) then + if color_is_bright(tonumber(r), tonumber(g), tonumber(b)) == true then return true -- bright - end + end return false -- dull end diff --git a/lua/catppuccino/utils/hsluv.lua b/lua/catppuccino/utils/hsluv.lua index ce9507f..e557662 100644 --- a/lua/catppuccino/utils/hsluv.lua +++ b/lua/catppuccino/utils/hsluv.lua @@ -24,310 +24,310 @@ local hsluv = {} local hexChars = "0123456789abcdef" local distance_line_from_origin = function(line) - return math.abs(line.intercept) / math.sqrt((line.slope ^ 2) + 1) + return math.abs(line.intercept) / math.sqrt((line.slope ^ 2) + 1) end local length_of_ray_until_intersect = function(theta, line) - return line.intercept / (math.sin(theta) - line.slope * math.cos(theta)) + return line.intercept / (math.sin(theta) - line.slope * math.cos(theta)) end hsluv.get_bounds = function(l) - local result = {} - local sub2 - local sub1 = ((l + 16) ^ 3) / 1560896 - if sub1 > hsluv.epsilon then - sub2 = sub1 - else - sub2 = l / hsluv.kappa - end - - for i = 1, 3 do - local m1 = hsluv.m[i][1] - local m2 = hsluv.m[i][2] - local m3 = hsluv.m[i][3] - - for t = 0, 1 do - local top1 = (284517 * m1 - 94839 * m3) * sub2 - local top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - 769860 * t * l - local bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t - table.insert(result, {slope = top1 / bottom, intercept = top2 / bottom}) - end - end - return result + local result = {} + local sub2 + local sub1 = ((l + 16) ^ 3) / 1560896 + if sub1 > hsluv.epsilon then + sub2 = sub1 + else + sub2 = l / hsluv.kappa + end + + for i = 1, 3 do + local m1 = hsluv.m[i][1] + local m2 = hsluv.m[i][2] + local m3 = hsluv.m[i][3] + + for t = 0, 1 do + local top1 = (284517 * m1 - 94839 * m3) * sub2 + local top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - 769860 * t * l + local bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t + table.insert(result, { slope = top1 / bottom, intercept = top2 / bottom }) + end + end + return result end hsluv.max_safe_chroma_for_l = function(l) - local bounds = hsluv.get_bounds(l) - local min = 1.7976931348623157e+308 + local bounds = hsluv.get_bounds(l) + local min = 1.7976931348623157e+308 - for i = 1, 6 do - local length = distance_line_from_origin(bounds[i]) - if length >= 0 then - min = math.min(min, length) - end - end - return min + for i = 1, 6 do + local length = distance_line_from_origin(bounds[i]) + if length >= 0 then + min = math.min(min, length) + end + end + return min end hsluv.max_safe_chroma_for_lh = function(l, h) - local hrad = h / 360 * math.pi * 2 - local bounds = hsluv.get_bounds(l) - local min = 1.7976931348623157e+308 + local hrad = h / 360 * math.pi * 2 + local bounds = hsluv.get_bounds(l) + local min = 1.7976931348623157e+308 - for i = 1, 6 do - local bound = bounds[i] - local length = length_of_ray_until_intersect(hrad, bound) - if length >= 0 then - min = math.min(min, length) - end - end - return min + for i = 1, 6 do + local bound = bounds[i] + local length = length_of_ray_until_intersect(hrad, bound) + if length >= 0 then + min = math.min(min, length) + end + end + return min end hsluv.dot_product = function(a, b) - local sum = 0 - for i = 1, 3 do - sum = sum + a[i] * b[i] - end - return sum + local sum = 0 + for i = 1, 3 do + sum = sum + a[i] * b[i] + end + return sum end hsluv.from_linear = function(c) - if c <= 0.0031308 then - return 12.92 * c - else - return 1.055 * (c ^ 0.416666666666666685) - 0.055 - end + if c <= 0.0031308 then + return 12.92 * c + else + return 1.055 * (c ^ 0.416666666666666685) - 0.055 + end end hsluv.to_linear = function(c) - if c > 0.04045 then - return ((c + 0.055) / 1.055) ^ 2.4 - else - return c / 12.92 - end + if c > 0.04045 then + return ((c + 0.055) / 1.055) ^ 2.4 + else + return c / 12.92 + end end hsluv.xyz_to_rgb = function(tuple) - return { - hsluv.from_linear(hsluv.dot_product(hsluv.m[1], tuple)), - hsluv.from_linear(hsluv.dot_product(hsluv.m[2], tuple)), - hsluv.from_linear(hsluv.dot_product(hsluv.m[3], tuple)) - } + return { + hsluv.from_linear(hsluv.dot_product(hsluv.m[1], tuple)), + hsluv.from_linear(hsluv.dot_product(hsluv.m[2], tuple)), + hsluv.from_linear(hsluv.dot_product(hsluv.m[3], tuple)), + } end hsluv.rgb_to_xyz = function(tuple) - local rgbl = {hsluv.to_linear(tuple[1]), hsluv.to_linear(tuple[2]), hsluv.to_linear(tuple[3])} - return { - hsluv.dot_product(hsluv.minv[1], rgbl), - hsluv.dot_product(hsluv.minv[2], rgbl), - hsluv.dot_product(hsluv.minv[3], rgbl) - } + local rgbl = { hsluv.to_linear(tuple[1]), hsluv.to_linear(tuple[2]), hsluv.to_linear(tuple[3]) } + return { + hsluv.dot_product(hsluv.minv[1], rgbl), + hsluv.dot_product(hsluv.minv[2], rgbl), + hsluv.dot_product(hsluv.minv[3], rgbl), + } end hsluv.y_to_l = function(Y) - if Y <= hsluv.epsilon then - return Y / hsluv.refY * hsluv.kappa - else - return 116 * ((Y / hsluv.refY) ^ 0.333333333333333315) - 16 - end + if Y <= hsluv.epsilon then + return Y / hsluv.refY * hsluv.kappa + else + return 116 * ((Y / hsluv.refY) ^ 0.333333333333333315) - 16 + end end hsluv.l_to_y = function(L) - if L <= 8 then - return hsluv.refY * L / hsluv.kappa - else - return hsluv.refY * (((L + 16) / 116) ^ 3) - end + if L <= 8 then + return hsluv.refY * L / hsluv.kappa + else + return hsluv.refY * (((L + 16) / 116) ^ 3) + end end hsluv.xyz_to_luv = function(tuple) - local X = tuple[1] - local Y = tuple[2] - local divider = X + 15 * Y + 3 * tuple[3] - local varU = 4 * X - local varV = 9 * Y - if divider ~= 0 then - varU = varU / divider - varV = varV / divider - else - varU = 0 - varV = 0 - end - local L = hsluv.y_to_l(Y) - if L == 0 then - return {0, 0, 0} - end - return {L, 13 * L * (varU - hsluv.refU), 13 * L * (varV - hsluv.refV)} + local X = tuple[1] + local Y = tuple[2] + local divider = X + 15 * Y + 3 * tuple[3] + local varU = 4 * X + local varV = 9 * Y + if divider ~= 0 then + varU = varU / divider + varV = varV / divider + else + varU = 0 + varV = 0 + end + local L = hsluv.y_to_l(Y) + if L == 0 then + return { 0, 0, 0 } + end + return { L, 13 * L * (varU - hsluv.refU), 13 * L * (varV - hsluv.refV) } end hsluv.luv_to_xyz = function(tuple) - local L = tuple[1] - local U = tuple[2] - local V = tuple[3] - if L == 0 then - return {0, 0, 0} - end - local varU = U / (13 * L) + hsluv.refU - local varV = V / (13 * L) + hsluv.refV - local Y = hsluv.l_to_y(L) - local X = 0 - (9 * Y * varU) / (((varU - 4) * varV) - varU * varV) - return {X, Y, (9 * Y - 15 * varV * Y - varV * X) / (3 * varV)} + local L = tuple[1] + local U = tuple[2] + local V = tuple[3] + if L == 0 then + return { 0, 0, 0 } + end + local varU = U / (13 * L) + hsluv.refU + local varV = V / (13 * L) + hsluv.refV + local Y = hsluv.l_to_y(L) + local X = 0 - (9 * Y * varU) / (((varU - 4) * varV) - varU * varV) + return { X, Y, (9 * Y - 15 * varV * Y - varV * X) / (3 * varV) } end hsluv.luv_to_lch = function(tuple) - local L = tuple[1] - local U = tuple[2] - local V = tuple[3] - local C = math.sqrt(U * U + V * V) - local H - if C < 0.00000001 then - H = 0 - else - H = math.atan2(V, U) * 180.0 / 3.1415926535897932 - if H < 0 then - H = 360 + H - end - end - return {L, C, H} + local L = tuple[1] + local U = tuple[2] + local V = tuple[3] + local C = math.sqrt(U * U + V * V) + local H + if C < 0.00000001 then + H = 0 + else + H = math.atan2(V, U) * 180.0 / 3.1415926535897932 + if H < 0 then + H = 360 + H + end + end + return { L, C, H } end hsluv.lch_to_luv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local Hrad = tuple[3] / 360.0 * 2 * math.pi - return {L, math.cos(Hrad) * C, math.sin(Hrad) * C} + local L = tuple[1] + local C = tuple[2] + local Hrad = tuple[3] / 360.0 * 2 * math.pi + return { L, math.cos(Hrad) * C, math.sin(Hrad) * C } end hsluv.hsluv_to_lch = function(tuple) - local H = tuple[1] - local S = tuple[2] - local L = tuple[3] - if L > 99.9999999 then - return {100, 0, H} - end - if L < 0.00000001 then - return {0, 0, H} - end - return {L, hsluv.max_safe_chroma_for_lh(L, H) / 100 * S, H} + local H = tuple[1] + local S = tuple[2] + local L = tuple[3] + if L > 99.9999999 then + return { 100, 0, H } + end + if L < 0.00000001 then + return { 0, 0, H } + end + return { L, hsluv.max_safe_chroma_for_lh(L, H) / 100 * S, H } end hsluv.lch_to_hsluv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local H = tuple[3] - local max_chroma = hsluv.max_safe_chroma_for_lh(L, H) - if L > 99.9999999 then - return {H, 0, 100} - end - if L < 0.00000001 then - return {H, 0, 0} - end + local L = tuple[1] + local C = tuple[2] + local H = tuple[3] + local max_chroma = hsluv.max_safe_chroma_for_lh(L, H) + if L > 99.9999999 then + return { H, 0, 100 } + end + if L < 0.00000001 then + return { H, 0, 0 } + end - return {H, C / max_chroma * 100, L} + return { H, C / max_chroma * 100, L } end hsluv.hpluv_to_lch = function(tuple) - local H = tuple[1] - local S = tuple[2] - local L = tuple[3] - if L > 99.9999999 then - return {100, 0, H} - end - if L < 0.00000001 then - return {0, 0, H} - end - return {L, hsluv.max_safe_chroma_for_l(L) / 100 * S, H} + local H = tuple[1] + local S = tuple[2] + local L = tuple[3] + if L > 99.9999999 then + return { 100, 0, H } + end + if L < 0.00000001 then + return { 0, 0, H } + end + return { L, hsluv.max_safe_chroma_for_l(L) / 100 * S, H } end hsluv.lch_to_hpluv = function(tuple) - local L = tuple[1] - local C = tuple[2] - local H = tuple[3] - if L > 99.9999999 then - return {H, 0, 100} - end - if L < 0.00000001 then - return {H, 0, 0} - end - return {H, C / hsluv.max_safe_chroma_for_l(L) * 100, L} + local L = tuple[1] + local C = tuple[2] + local H = tuple[3] + if L > 99.9999999 then + return { H, 0, 100 } + end + if L < 0.00000001 then + return { H, 0, 0 } + end + return { H, C / hsluv.max_safe_chroma_for_l(L) * 100, L } end hsluv.rgb_to_hex = function(tuple) - local h = "#" - for i = 1, 3 do - local c = math.floor(tuple[i] * 255 + 0.5) - local digit2 = math.fmod(c, 16) - local x = (c - digit2) / 16 - local digit1 = math.floor(x) - h = h .. string.sub(hexChars, digit1 + 1, digit1 + 1) - h = h .. string.sub(hexChars, digit2 + 1, digit2 + 1) - end - return h + local h = "#" + for i = 1, 3 do + local c = math.floor(tuple[i] * 255 + 0.5) + local digit2 = math.fmod(c, 16) + local x = (c - digit2) / 16 + local digit1 = math.floor(x) + h = h .. string.sub(hexChars, digit1 + 1, digit1 + 1) + h = h .. string.sub(hexChars, digit2 + 1, digit2 + 1) + end + return h end hsluv.hex_to_rgb = function(hex) - hex = string.lower(hex) - local ret = {} - for i = 0, 2 do - local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2) - local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3) - local digit1 = string.find(hexChars, char1) - 1 - local digit2 = string.find(hexChars, char2) - 1 - ret[i + 1] = (digit1 * 16 + digit2) / 255.0 - end - return ret + hex = string.lower(hex) + local ret = {} + for i = 0, 2 do + local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2) + local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3) + local digit1 = string.find(hexChars, char1) - 1 + local digit2 = string.find(hexChars, char2) - 1 + ret[i + 1] = (digit1 * 16 + digit2) / 255.0 + end + return ret end hsluv.lch_to_rgb = function(tuple) - return hsluv.xyz_to_rgb(hsluv.luv_to_xyz(hsluv.lch_to_luv(tuple))) + return hsluv.xyz_to_rgb(hsluv.luv_to_xyz(hsluv.lch_to_luv(tuple))) end hsluv.rgb_to_lch = function(tuple) - return hsluv.luv_to_lch(hsluv.xyz_to_luv(hsluv.rgb_to_xyz(tuple))) + return hsluv.luv_to_lch(hsluv.xyz_to_luv(hsluv.rgb_to_xyz(tuple))) end hsluv.hsluv_to_rgb = function(tuple) - return hsluv.lch_to_rgb(hsluv.hsluv_to_lch(tuple)) + return hsluv.lch_to_rgb(hsluv.hsluv_to_lch(tuple)) end hsluv.rgb_to_hsluv = function(tuple) - return hsluv.lch_to_hsluv(hsluv.rgb_to_lch(tuple)) + return hsluv.lch_to_hsluv(hsluv.rgb_to_lch(tuple)) end hsluv.hpluv_to_rgb = function(tuple) - return hsluv.lch_to_rgb(hsluv.hpluv_to_lch(tuple)) + return hsluv.lch_to_rgb(hsluv.hpluv_to_lch(tuple)) end hsluv.rgb_to_hpluv = function(tuple) - return hsluv.lch_to_hpluv(hsluv.rgb_to_lch(tuple)) + return hsluv.lch_to_hpluv(hsluv.rgb_to_lch(tuple)) end hsluv.hsluv_to_hex = function(tuple) - return hsluv.rgb_to_hex(hsluv.hsluv_to_rgb(tuple)) + return hsluv.rgb_to_hex(hsluv.hsluv_to_rgb(tuple)) end hsluv.hpluv_to_hex = function(tuple) - return hsluv.rgb_to_hex(hsluv.hpluv_to_rgb(tuple)) + return hsluv.rgb_to_hex(hsluv.hpluv_to_rgb(tuple)) end hsluv.hex_to_hsluv = function(s) - return hsluv.rgb_to_hsluv(hsluv.hex_to_rgb(s)) + return hsluv.rgb_to_hsluv(hsluv.hex_to_rgb(s)) end hsluv.hex_to_hpluv = function(s) - return hsluv.rgb_to_hpluv(hsluv.hex_to_rgb(s)) + return hsluv.rgb_to_hpluv(hsluv.hex_to_rgb(s)) end hsluv.m = { - {3.240969941904521, -1.537383177570093, -0.498610760293}, - {-0.96924363628087, 1.87596750150772, 0.041555057407175}, - {0.055630079696993, -0.20397695888897, 1.056971514242878} + { 3.240969941904521, -1.537383177570093, -0.498610760293 }, + { -0.96924363628087, 1.87596750150772, 0.041555057407175 }, + { 0.055630079696993, -0.20397695888897, 1.056971514242878 }, } hsluv.minv = { - {0.41239079926595, 0.35758433938387, 0.18048078840183}, - {0.21263900587151, 0.71516867876775, 0.072192315360733}, - {0.019330818715591, 0.11919477979462, 0.95053215224966} + { 0.41239079926595, 0.35758433938387, 0.18048078840183 }, + { 0.21263900587151, 0.71516867876775, 0.072192315360733 }, + { 0.019330818715591, 0.11919477979462, 0.95053215224966 }, } hsluv.refY = 1.0 hsluv.refU = 0.19783000664283 diff --git a/lua/catppuccino/utils/util.lua b/lua/catppuccino/utils/util.lua index d3b7d08..8dca8ee 100644 --- a/lua/catppuccino/utils/util.lua +++ b/lua/catppuccino/utils/util.lua @@ -11,150 +11,150 @@ util.day_brightness = 0.3 ---@param hex_str string hexadecimal value of a color local hex_to_rgb = function(hex_str) - local hex = "[abcdef0-9][abcdef0-9]" - local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$" - hex_str = string.lower(hex_str) + local hex = "[abcdef0-9][abcdef0-9]" + local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$" + hex_str = string.lower(hex_str) - assert(string.find(hex_str, pat) ~= nil, "hex_to_rgb: invalid hex_str: " .. tostring(hex_str)) + assert(string.find(hex_str, pat) ~= nil, "hex_to_rgb: invalid hex_str: " .. tostring(hex_str)) - local red, green, blue = string.match(hex_str, pat) - return {tonumber(red, 16), tonumber(green, 16), tonumber(blue, 16)} + local red, green, blue = string.match(hex_str, pat) + return { tonumber(red, 16), tonumber(green, 16), tonumber(blue, 16) } end ---@param fg string foreground color ---@param bg string background color ---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg function util.blend(fg, bg, alpha) - bg = hex_to_rgb(bg) - fg = hex_to_rgb(fg) + bg = hex_to_rgb(bg) + fg = hex_to_rgb(fg) - local blendChannel = function(i) - local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) - return math.floor(math.min(math.max(0, ret), 255) + 0.5) - end + local blendChannel = function(i) + local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) + return math.floor(math.min(math.max(0, ret), 255) + 0.5) + end - return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3)) + return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3)) end function util.darken(hex, amount, bg) - return util.blend(hex, bg or util.bg, math.abs(amount)) + return util.blend(hex, bg or util.bg, math.abs(amount)) end function util.lighten(hex, amount, fg) - return util.blend(hex, fg or util.fg, math.abs(amount)) + return util.blend(hex, fg or util.fg, math.abs(amount)) end function util.brighten(color, percentage) - local hsl = hsluv.hex_to_hsluv(color) - local larpSpace = 100 - hsl[3] - if percentage < 0 then - larpSpace = hsl[3] - end - hsl[3] = hsl[3] + larpSpace * percentage - return hsluv.hsluv_to_hex(hsl) + local hsl = hsluv.hex_to_hsluv(color) + local larpSpace = 100 - hsl[3] + if percentage < 0 then + larpSpace = hsl[3] + end + hsl[3] = hsl[3] + larpSpace * percentage + return hsluv.hsluv_to_hex(hsl) end function util.invertColor(color) - if color ~= "NONE" then - local hsl = hsluv.hex_to_hsluv(color) - hsl[3] = 100 - hsl[3] - if hsl[3] < 40 then - hsl[3] = hsl[3] + (100 - hsl[3]) * util.day_brightness - end - return hsluv.hsluv_to_hex(hsl) - end - return color + if color ~= "NONE" then + local hsl = hsluv.hex_to_hsluv(color) + hsl[3] = 100 - hsl[3] + if hsl[3] < 40 then + hsl[3] = hsl[3] + (100 - hsl[3]) * util.day_brightness + end + return hsluv.hsluv_to_hex(hsl) + end + return color end function util.string_to_color(colors, value, default) - if not value or value == "" then - return default - end - - -- If the value is a hex color code then return it - local hex = "[abcdef0-9][abcdef0-9]" - local pat = "^#" .. hex .. hex .. hex .. "$" - if string.match(value, pat) then - return value - end - - local acceptable_colors = {"black", "red", "green", "blue", "magenta", "cyan", "white", "orange", "pink"} - for _, ac in ipairs(acceptable_colors) do - if string.match(value, ac) then - return colors[value] - end - end - - -- Did not match anything to return default - return default + if not value or value == "" then + return default + end + + -- If the value is a hex color code then return it + local hex = "[abcdef0-9][abcdef0-9]" + local pat = "^#" .. hex .. hex .. hex .. "$" + if string.match(value, pat) then + return value + end + + local acceptable_colors = { "black", "red", "green", "blue", "magenta", "cyan", "white", "orange", "pink" } + for _, ac in ipairs(acceptable_colors) do + if string.match(value, ac) then + return colors[value] + end + end + + -- Did not match anything to return default + return default end function util.highlight(group, color) - local style = 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 "" - local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp - - vim.cmd(hl) - if color.link then - vim.cmd("highlight! link " .. group .. " " .. color.link) - end + local style = 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 "" + local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp + + vim.cmd(hl) + if color.link then + vim.cmd("highlight! link " .. group .. " " .. color.link) + end end function util.syntax(tbl) - for group, colors in pairs(tbl) do - if (type(group) == "number") then - for inner_group, clrs in pairs(colors) do - util.highlight(inner_group, clrs) - end - else - util.highlight(group, colors) - end - end + for group, colors in pairs(tbl) do + if type(group) == "number" then + for inner_group, clrs in pairs(colors) do + util.highlight(inner_group, clrs) + end + else + util.highlight(group, colors) + end + end end function util.properties(tbl) - for property, value in pairs(tbl) do - vim.o[property] = value - end + for property, value in pairs(tbl) do + vim.o[property] = value + end end function util.terminal(theme) - g.terminal_color_0 = theme.colors.black - g.terminal_color_1 = theme.colors.red - g.terminal_color_2 = theme.colors.green - g.terminal_color_3 = theme.colors.yellow - g.terminal_color_4 = theme.colors.blue - g.terminal_color_5 = theme.colors.magenta - g.terminal_color_6 = theme.colors.cyan - g.terminal_color_7 = theme.colors.white - - g.terminal_color_8 = theme.colors.black_br - g.terminal_color_9 = theme.colors.red_br - g.terminal_color_10 = theme.colors.green_br - g.terminal_color_11 = theme.colors.yellow_br - g.terminal_color_12 = theme.colors.blue_br - g.terminal_color_13 = theme.colors.magenta_br - g.terminal_color_14 = theme.colors.cyan_br - g.terminal_color_15 = theme.colors.white_br + g.terminal_color_0 = theme.colors.black + g.terminal_color_1 = theme.colors.red + g.terminal_color_2 = theme.colors.green + g.terminal_color_3 = theme.colors.yellow + g.terminal_color_4 = theme.colors.blue + g.terminal_color_5 = theme.colors.magenta + g.terminal_color_6 = theme.colors.cyan + g.terminal_color_7 = theme.colors.white + + g.terminal_color_8 = theme.colors.black_br + g.terminal_color_9 = theme.colors.red_br + g.terminal_color_10 = theme.colors.green_br + g.terminal_color_11 = theme.colors.yellow_br + g.terminal_color_12 = theme.colors.blue_br + g.terminal_color_13 = theme.colors.magenta_br + g.terminal_color_14 = theme.colors.cyan_br + g.terminal_color_15 = theme.colors.white_br end function util.load(theme) - vim.cmd("hi clear") - if vim.fn.exists("syntax_on") then - vim.cmd("syntax reset") - end + vim.cmd("hi clear") + if vim.fn.exists("syntax_on") then + vim.cmd("syntax reset") + end - g.colors_name = "catppuccino" + g.colors_name = "catppuccino" util.properties(theme.properties) - util.syntax(theme.base) - util.syntax(theme.integrations) + util.syntax(theme.base) + util.syntax(theme.integrations) - -- if opts.ui.terminal then - -- util.terminal(theme) - -- end + -- if opts.ui.terminal then + -- util.terminal(theme) + -- end end return util diff --git a/lua/lightline/colorscheme/catppuccino.lua b/lua/lightline/colorscheme/catppuccino.lua index f95ada1..fb7ef0d 100644 --- a/lua/lightline/colorscheme/catppuccino.lua +++ b/lua/lightline/colorscheme/catppuccino.lua @@ -1,44 +1,46 @@ -local good, color_scheme = require("catppuccino.core.cs").get_color_scheme(require("catppuccino.config").options["cptcheme"]) +local good, color_scheme = require("catppuccino.core.cs").get_color_scheme( + require("catppuccino.config").options["cptcheme"] +) if not good then - print(color_scheme) -- error message - return + print(color_scheme) -- error message + return end local cpt = color_scheme local catppuccino = {} catppuccino.normal = { - left = {{cpt.black, cpt.blue}, {cpt.blue, cpt.bg}}, - middle = {{cpt.blue, cpt.fg_gutter}}, - right = {{cpt.fg_sidebar, cpt.bg_statusline}, {cpt.blue, cpt.bg}}, - error = {{cpt.black, cpt.error}}, - warning = {{cpt.black, cpt.warning}} + left = { { cpt.black, cpt.blue }, { cpt.blue, cpt.bg } }, + middle = { { cpt.blue, cpt.fg_gutter } }, + right = { { cpt.fg_sidebar, cpt.bg_statusline }, { cpt.blue, cpt.bg } }, + error = { { cpt.black, cpt.error } }, + warning = { { cpt.black, cpt.warning } }, } catppuccino.insert = { - left = {{cpt.black, cpt.green}, {cpt.blue, cpt.bg}} + left = { { cpt.black, cpt.green }, { cpt.blue, cpt.bg } }, } catppuccino.visual = { - left = {{cpt.black, cpt.magenta}, {cpt.blue, cpt.bg}} + left = { { cpt.black, cpt.magenta }, { cpt.blue, cpt.bg } }, } catppuccino.replace = { - left = {{cpt.black, cpt.red}, {cpt.blue, cpt.bg}} + left = { { cpt.black, cpt.red }, { cpt.blue, cpt.bg } }, } catppuccino.inactive = { - left = {{cpt.blue, cpt.bg_statusline}, {cpt.comment, cpt.bg}}, - middle = {{cpt.fg_gutter, cpt.bg_statusline}}, - right = {{cpt.fg_gutter, cpt.bg_statusline}, {cpt.comment, cpt.bg}} + left = { { cpt.blue, cpt.bg_statusline }, { cpt.comment, cpt.bg } }, + middle = { { cpt.fg_gutter, cpt.bg_statusline } }, + right = { { cpt.fg_gutter, cpt.bg_statusline }, { cpt.comment, cpt.bg } }, } catppuccino.tabline = { - left = {{cpt.comment, cpt.bg_highlight}, {cpt.comment, cpt.bg}}, - middle = {{cpt.fg_gutter, cpt.bg_statusline}}, - right = {{cpt.fg_gutter, cpt.bg_statusline}, {cpt.comment, cpt.bg}}, - tabsel = {{cpt.blue, cpt.fg_gutter}, {cpt.comment, cpt.bg}} + left = { { cpt.comment, cpt.bg_highlight }, { cpt.comment, cpt.bg } }, + middle = { { cpt.fg_gutter, cpt.bg_statusline } }, + right = { { cpt.fg_gutter, cpt.bg_statusline }, { cpt.comment, cpt.bg } }, + tabsel = { { cpt.blue, cpt.fg_gutter }, { cpt.comment, cpt.bg } }, } return catppuccino diff --git a/lua/lualine/themes/catppuccino.lua b/lua/lualine/themes/catppuccino.lua index c512927..d5e982b 100644 --- a/lua/lualine/themes/catppuccino.lua +++ b/lua/lualine/themes/catppuccino.lua @@ -1,4 +1,6 @@ -local err, color_scheme = require("catppuccino.core.cs").get_color_scheme(require("catppuccino.config").options["colorscheme"]) +local err, color_scheme = require("catppuccino.core.cs").get_color_scheme( + require("catppuccino.config").options["colorscheme"] +) if not err.status then vim.api.nvim_err_writeln(err.msg) @@ -8,35 +10,35 @@ local cpt = color_scheme local catppuccino = {} catppuccino.normal = { - a = {bg = cpt.blue, fg = cpt.black}, - b = {bg = cpt.fg_gutter, fg = cpt.blue}, - c = {bg = cpt.bg_statusline, fg = cpt.fg_sidebar} + a = { bg = cpt.blue, fg = cpt.black }, + b = { bg = cpt.fg_gutter, fg = cpt.blue }, + c = { bg = cpt.bg_statusline, fg = cpt.fg_sidebar }, } catppuccino.insert = { - a = {bg = cpt.green, fg = cpt.black}, - b = {bg = cpt.fg_gutter, fg = cpt.green} + a = { bg = cpt.green, fg = cpt.black }, + b = { bg = cpt.fg_gutter, fg = cpt.green }, } catppuccino.command = { - a = {bg = cpt.orange, fg = cpt.black}, - b = {bg = cpt.fg_gutter, fg = cpt.orange} + a = { bg = cpt.orange, fg = cpt.black }, + b = { bg = cpt.fg_gutter, fg = cpt.orange }, } catppuccino.visual = { - a = {bg = cpt.magenta, fg = cpt.black}, - b = {bg = cpt.fg_gutter, fg = cpt.magenta} + a = { bg = cpt.magenta, fg = cpt.black }, + b = { bg = cpt.fg_gutter, fg = cpt.magenta }, } catppuccino.replace = { - a = {bg = cpt.red_bg, fg = cpt.black}, - b = {bg = cpt.fg_gutter, fg = cpt.red_bg} + a = { bg = cpt.red_bg, fg = cpt.black }, + b = { bg = cpt.fg_gutter, fg = cpt.red_bg }, } catppuccino.inactive = { - a = {bg = cpt.bg_statusline, fg = cpt.blue}, - b = {bg = cpt.bg_statusline, fg = cpt.fg_gutter, gui = "bold"}, - c = {bg = cpt.bg_statusline, fg = cpt.fg_gutter} + a = { bg = cpt.bg_statusline, fg = cpt.blue }, + b = { bg = cpt.bg_statusline, fg = cpt.fg_gutter, gui = "bold" }, + c = { bg = cpt.bg_statusline, fg = cpt.fg_gutter }, } return catppuccino diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..ddc8c4b --- /dev/null +++ b/stylua.toml @@ -0,0 +1,5 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Tabs" +indent_width = 4 +quote_style = "AutoPreferDouble"