feat: reduces the impact of the shade function when in light mode (#1177)

This commit is contained in:
Oliver Lorton 2025-02-04 07:26:09 +00:00 committed by GitHub
parent a9ab429699
commit 5e1334f4e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)