feat: reduces the impact of the shade function when in light mode (#1177)
This commit is contained in:
parent
a9ab429699
commit
5e1334f4e5
@ -124,11 +124,12 @@ H.alter = function(attr, percent) return math.floor(attr * (100 + percent) / 100
|
|||||||
|
|
||||||
---@source https://stackoverflow.com/q/5560248
|
---@source https://stackoverflow.com/q/5560248
|
||||||
---@see https://stackoverflow.com/a/37797380
|
---@see https://stackoverflow.com/a/37797380
|
||||||
---Darken a specified hex color
|
---Lighten a specified hex color
|
||||||
---@param color number
|
---@param color number
|
||||||
---@param percent number
|
---@param percent number
|
||||||
---@return string
|
---@return string
|
||||||
H.shade_color = function(color, percent)
|
H.shade_color = function(color, percent)
|
||||||
|
percent = vim.opt.background:get() == "light" and percent / 10 or percent
|
||||||
local rgb = H.decode_24bit_rgb(color)
|
local rgb = H.decode_24bit_rgb(color)
|
||||||
if not rgb.r or not rgb.g or not rgb.b then return "NONE" end
|
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)
|
local r, g, b = H.alter(rgb.r, percent), H.alter(rgb.g, percent), H.alter(rgb.b, percent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user