From 8689cd8ca262aa79fdde6c9ba2f6754f625075d8 Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Sat, 16 Jul 2022 20:03:05 +0700 Subject: [PATCH] readme(transparent): Add custom_highlights direction (#201) fix(transparent): Add FAQ --- README.md | 23 +++++++++++++++++-- .../groups/integrations/lsp_saga.lua | 1 + lua/catppuccin/lib/compiler.lua | 4 +--- lua/catppuccin/lib/highlighter.lua | 13 +++++++---- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 809ec1a..bac4db0 100644 --- a/README.md +++ b/README.md @@ -458,11 +458,30 @@ vim.api.nvim_create_autocmd("User", { ## FAQ -#### [Abnormal colors](https://github.com/catppuccin/nvim/issues/182)? +#### Transparenct background tweak? + +Add this to `custom_highlights` settings + +```lua +custom_highlights = { + Comment = { fg = colors.overlay1 }, + LineNr = { fg = colors.overlay1 }, + CursorLine = { bg = colors.none }, + CursorLineNr = { fg = colors.lavender }, + DiagnosticVirtualTextError = { bg = colors.none }, + DiagnosticVirtualTextWarn = { bg = colors.none }, + DiagnosticVirtualTextInfo = { bg = colors.none }, + DiagnosticVirtualTextHint = { bg = colors.none }, +}, +``` + +#### Abnormal colors? You need to enable [truecolor](https://wiki.archlinux.org/title/Color_output_in_console#True_color_support) -#### Toggle light/dark theme based on background value? +Related: [:h termguicolors](https://neovim.io/doc/user/options.html#'termguicolors'), [catppuccin/nvim#182](https://github.com/catppuccin/nvim/issues/182), + +#### Use catppuccin theme for :set background=light/dark? The following autocmd will change the flavour to latte when you `:set background=light` and to mocha after `:set background=dark` diff --git a/lua/catppuccin/groups/integrations/lsp_saga.lua b/lua/catppuccin/groups/integrations/lsp_saga.lua index 5580fa6..bdf6e11 100644 --- a/lua/catppuccin/groups/integrations/lsp_saga.lua +++ b/lua/catppuccin/groups/integrations/lsp_saga.lua @@ -24,4 +24,5 @@ function M.get() TargetWord = { fg = cp.flamingo }, } end + return M diff --git a/lua/catppuccin/lib/compiler.lua b/lua/catppuccin/lib/compiler.lua index 748dd5a..36b7a4b 100644 --- a/lua/catppuccin/lib/compiler.lua +++ b/lua/catppuccin/lib/compiler.lua @@ -42,9 +42,7 @@ vim.g.colors_name = "catppuccin"]], table.insert(lines, fmt("vim.o.%s = %s", property, inspect(value))) end end - local tbl = vim.tbl_deep_extend("keep", theme.integrations, theme.editor) - tbl = vim.tbl_deep_extend("keep", theme.syntax, tbl) - tbl = vim.tbl_deep_extend("keep", config.custom_highlights, tbl) + local tbl = vim.tbl_deep_extend("keep", config.custom_highlights, theme.integrations, theme.syntax, theme.editor) for group, color in pairs(tbl) do if color.link then diff --git a/lua/catppuccin/lib/highlighter.lua b/lua/catppuccin/lib/highlighter.lua index 2f1f2c5..d9ad6c0 100644 --- a/lua/catppuccin/lib/highlighter.lua +++ b/lua/catppuccin/lib/highlighter.lua @@ -38,10 +38,15 @@ function M.load(theme) g.colors_name = "catppuccin" M.properties(theme.properties, "o") - M.syntax(theme.editor) - M.syntax(theme.syntax) - M.syntax(theme.integrations) - M.syntax(require("catppuccin.config").options.custom_highlights) + M.syntax( + vim.tbl_deep_extend( + "keep", + require("catppuccin.config").options.custom_highlights, + theme.integrations, + theme.syntax, + theme.editor + ) + ) if require("catppuccin.config").options["term_colors"] then M.properties(theme.terminal, "g")