local function int_lerp(a, b, c) return math.floor((1 - c) * a + c * b + 0.5) end local function rgb_lerp(a, b, c) return { int_lerp(a[1], b[1], c), int_lerp(a[2], b[2], c), int_lerp(a[3], b[3], c), } end local function hex_to_rgb(hex) local ret = {} for i = 2,6,2 do -- Skip '#' local s = hex:sub(i, i + 1) table.insert(ret, tonumber(s, 16)) end return ret end local function rgb_to_hex(rgb) return string.format("#%x%x%x", unpack(rgb)) end local function hex_lerp(a, b, c) a = hex_to_rgb(a); b = hex_to_rgb(b); return rgb_to_hex(rgb_lerp(a, b, c)) end return { { "AstroNvim/astrotheme", optional = true, opts = { style = { simple_syntax_colors = true, inactive = false, }, palettes = { astrobox = {}, }, highlights = { global = { modify_hl_groups = function(hl, c) hl.DiffAdd = { bg = hex_lerp(hl.DiffAdd.bg, c.ui.base, 0.8)} hl.DiffDelete = { bg = hex_lerp(hl.DiffDelete.bg, c.ui.base, 0.8)} hl.DiffChange = { bg = hex_lerp(c.ui.blue, c.ui.base, 0.8)} hl.DiffText = { bg = hex_lerp(hl.DiffText.bg, c.ui.base, 0.8)} end, }, astrobox = {}, }, }, }, { url = "https://git.niverton.tk/niverton/Astrobox.git" }, }