From 5e1334f4e5c294b1c2cbdc4600a6b219da6cc8ea Mon Sep 17 00:00:00 2001 From: Oliver Lorton Date: Tue, 4 Feb 2025 07:26:09 +0000 Subject: [PATCH] feat: reduces the impact of the shade function when in light mode (#1177) --- lua/avante/highlights.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/avante/highlights.lua b/lua/avante/highlights.lua index 44a954a..621d932 100644 --- a/lua/avante/highlights.lua +++ b/lua/avante/highlights.lua @@ -124,11 +124,12 @@ H.alter = function(attr, percent) return math.floor(attr * (100 + percent) / 100 ---@source https://stackoverflow.com/q/5560248 ---@see https://stackoverflow.com/a/37797380 ----Darken a specified hex color +---Lighten a specified hex color ---@param color number ---@param percent number ---@return string H.shade_color = function(color, percent) + percent = vim.opt.background:get() == "light" and percent / 10 or percent local rgb = H.decode_24bit_rgb(color) if not rgb.r or not rgb.g or not rgb.b then return "NONE" end local r, g, b = H.alter(rgb.r, percent), H.alter(rgb.g, percent), H.alter(rgb.b, percent)