From aa11fb8bd16c58f0cef355ac74de7e977fb8b9c3 Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 6 Aug 2024 13:57:54 +0530 Subject: [PATCH] update change_hex_hue function --- lua/base46/colors.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/base46/colors.lua b/lua/base46/colors.lua index 77061c95..92ed0251 100644 --- a/lua/base46/colors.lua +++ b/lua/base46/colors.lua @@ -170,12 +170,11 @@ end -- @return The hex color value M.change_hex_hue = function(hex, percent) local h, s, l = M.hex2hsl(hex) - h = h + (percent / 100) - if h > 360 then - h = 360 - end + -- Convert percentage to a degree shift + local shift = (percent / 100) * 360 + h = (h + shift) % 360 if h < 0 then - h = 0 + h = h + 360 end return M.hsl2hex(h, s, l) end