From 65bf0b16f57a3db70d6a93ac68882dd9a31d0565 Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:25:50 +0000 Subject: [PATCH] revert: fix(kitty): respect `transparent_background` option (#794) --- lua/catppuccin/palettes/init.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/catppuccin/palettes/init.lua b/lua/catppuccin/palettes/init.lua index d022f9fb..6c199a3c 100644 --- a/lua/catppuccin/palettes/init.lua +++ b/lua/catppuccin/palettes/init.lua @@ -5,7 +5,18 @@ function M.get_palette(flavour) local _, palette = pcall(require, "catppuccin.palettes." .. flvr) local O = require("catppuccin").options local ans = vim.tbl_deep_extend("keep", O.color_overrides.all or {}, O.color_overrides[flvr] or {}, palette or {}) - if O.kitty and O.transparent_background then -- https://github.com/kovidgoyal/kitty/issues/2917 + + --[[ + Kitty makes Neovim transparent if its own terminal background matches Neovim, + so we need to adjust the color channels to make sure people don't suddenly + have a transparent background if they haven't specified it. + + Unfortunately, this currently means all users on Kitty will have all their + palette colors slightly offset. + + ref: https://github.com/kovidgoyal/kitty/issues/2917 + --]] + if O.kitty then for accent, hex in pairs(ans) do local red_green_string = hex:sub(1, 5) local blue_value = tonumber(hex:sub(6, 7), 16) @@ -15,6 +26,7 @@ function M.get_palette(flavour) ans[accent] = string.format("%s%.2x", red_green_string, blue_value) end end + return ans end