From 863500ba19d49e30a399f8bf99d19871b46f3b09 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Thu, 7 Jul 2022 23:40:38 -0600 Subject: [PATCH] Support dim_inactive with existing integrations --- .../core/integrations/bufferline.lua | 47 ++++++++++--------- lua/catppuccin/core/integrations/gitsigns.lua | 11 +++-- .../core/integrations/ts_rainbow.lua | 23 +++++---- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/lua/catppuccin/core/integrations/bufferline.lua b/lua/catppuccin/core/integrations/bufferline.lua index a2c4a0a..1667ce6 100644 --- a/lua/catppuccin/core/integrations/bufferline.lua +++ b/lua/catppuccin/core/integrations/bufferline.lua @@ -1,29 +1,34 @@ local M = {} function M.get(cp) - local transparent_background = require("catppuccin.config").options.transparent_background - local bg_highlight = transparent_background and "NONE" or cp.base + local cnf = require("catppuccin.config").options + local transparent_background = cnf.transparent_background + local dim_inactive = cnf.dim_inactive + local bg_highlight = (transparent_background and dim_inactive and cp.dim) + or (transparent_background and "NONE") + or (dim_inactive and cp.dim) + or cp.base - local inactive_bg = transparent_background and "NONE" or cp.mantle + local inactive_bg = transparent_background and "NONE" or cp.mantle - return { - BufferLineFill = { bg = bg_highlight }, - BufferLineBackcrust = { fg = cp.text, bg = inactive_bg }, -- others - BufferLineBufferVisible = { fg = cp.surface1, bg = inactive_bg }, - BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = "bold,italic" }, -- current - BufferLineTab = { fg = cp.surface1, bg = cp.base }, - BufferLineTabSelected = { fg = cp.red, bg = cp.blue }, - BufferLineTabClose = { fg = cp.red, bg = inactive_bg }, - BufferLineIndicatorSelected = { fg = cp.peach, bg = cp.base }, - -- separators - BufferLineSeparator = { fg = inactive_bg, bg = inactive_bg }, - BufferLineSeparatorVisible = { fg = inactive_bg, bg = inactive_bg }, - BufferLineSeparatorSelected = { fg = inactive_bg, bg = inactive_bg }, - -- close buttons - BufferLineCloseButton = { fg = cp.surface1, bg = inactive_bg }, - BufferLineCloseButtonVisible = { fg = cp.surface1, bg = inactive_bg }, - BufferLineCloseButtonSelected = { fg = cp.red, bg = cp.base }, - } + return { + BufferLineFill = { bg = bg_highlight }, + BufferLineBackcrust = { fg = cp.text, bg = inactive_bg }, -- others + BufferLineBufferVisible = { fg = cp.surface1, bg = inactive_bg }, + BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = "bold,italic" }, -- current + BufferLineTab = { fg = cp.surface1, bg = cp.base }, + BufferLineTabSelected = { fg = cp.red, bg = cp.blue }, + BufferLineTabClose = { fg = cp.red, bg = inactive_bg }, + BufferLineIndicatorSelected = { fg = cp.peach, bg = cp.base }, + -- separators + BufferLineSeparator = { fg = inactive_bg, bg = inactive_bg }, + BufferLineSeparatorVisible = { fg = inactive_bg, bg = inactive_bg }, + BufferLineSeparatorSelected = { fg = inactive_bg, bg = inactive_bg }, + -- close buttons + BufferLineCloseButton = { fg = cp.surface1, bg = inactive_bg }, + BufferLineCloseButtonVisible = { fg = cp.surface1, bg = inactive_bg }, + BufferLineCloseButtonSelected = { fg = cp.red, bg = cp.base }, + } end return M diff --git a/lua/catppuccin/core/integrations/gitsigns.lua b/lua/catppuccin/core/integrations/gitsigns.lua index 19b0130..6110a76 100644 --- a/lua/catppuccin/core/integrations/gitsigns.lua +++ b/lua/catppuccin/core/integrations/gitsigns.lua @@ -1,10 +1,15 @@ local M = {} function M.get(cp) + local cnf = require("catppuccin.config").options + local bg_highlight = (cnf.transparent_background and cnf.dim_inactive and cp.dim) + or (cnf.transparent_background and "NONE") + or (cnf.dim_inactive and cp.dim) + or cp.base return { - GitSignsAdd = { fg = cp.green, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = cp.yellow, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = cp.red, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Deleted line |diff.txt| + GitSignsAdd = { fg = cp.green, bg = bg_highlight }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = cp.yellow, bg = bg_highlight }, -- diff mode: Changed line |diff.txt| + GitSignsDelete = { fg = cp.red, bg = bg_highlight }, -- diff mode: Deleted line |diff.txt| } end diff --git a/lua/catppuccin/core/integrations/ts_rainbow.lua b/lua/catppuccin/core/integrations/ts_rainbow.lua index 1197c36..7b505a9 100644 --- a/lua/catppuccin/core/integrations/ts_rainbow.lua +++ b/lua/catppuccin/core/integrations/ts_rainbow.lua @@ -1,16 +1,21 @@ local M = {} function M.get(cp) - local transparent_background = require("catppuccin.config").options.transparent_background - local bg_highlight = transparent_background and "NONE" or cp.base + local cnf = require("catppuccin.config").options + local transparent_background = cnf.transparent_background + local dim_inactive = cnf.dim_inactive + local bg_highlight = (transparent_background and dim_inactive and cp.dim) + or (transparent_background and "NONE") + or (dim_inactive and cp.dim) + or cp.base return { - rainbowcol1 = {bg = bg_highlight, fg = cp.red}, - rainbowcol2 = {bg = bg_highlight, fg = cp.teal}, - rainbowcol3 = {bg = bg_highlight, fg = cp.yellow}, - rainbowcol4 = {bg = bg_highlight, fg = cp.blue}, - rainbowcol5 = {bg = bg_highlight, fg = cp.pink}, - rainbowcol6 = {bg = bg_highlight, fg = cp.flamingo}, - rainbowcol7 = {bg = bg_highlight, fg = cp.green}, + rainbowcol1 = { bg = bg_highlight, fg = cp.red }, + rainbowcol2 = { bg = bg_highlight, fg = cp.teal }, + rainbowcol3 = { bg = bg_highlight, fg = cp.yellow }, + rainbowcol4 = { bg = bg_highlight, fg = cp.blue }, + rainbowcol5 = { bg = bg_highlight, fg = cp.pink }, + rainbowcol6 = { bg = bg_highlight, fg = cp.flamingo }, + rainbowcol7 = { bg = bg_highlight, fg = cp.green }, } end