nvim: fix indent highlighting

This commit is contained in:
Mark Riedesel 2024-07-24 18:49:27 -05:00
parent c759257ead
commit b18beb9aca
4 changed files with 25 additions and 2 deletions

View file

@ -4,5 +4,6 @@ return {
main = "ibl", main = "ibl",
opts = { opts = {
indent = { char = "" }, indent = { char = "" },
scope = { char = "" },
}, },
} }

View file

@ -1,6 +1,28 @@
local function get_color(name, attr)
return vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(name)), attr):gsub('#','')
end
local function clamp(value)
return math.min(math.max(value, 0), 255)
end
local function brightness(color, amount)
local num = tonumber(color, 16)
local r = (math.floor(num / 0x10000)) + amount
local g = (math.floor(num / 0x100) % 0x100) + amount
local b = (math.floor(num % 0x100)) + amount
return string.format("#%x", clamp(r) * 0x10000 + clamp(g) * 0x100 + clamp(b))
end
local function add_tweaks()
-- always set IblIndent to a slightly brighter version of the background color
vim.cmd('hi IblIndent guifg=' .. brightness(get_color('Normal', 'bg'), 20))
end
return { return {
'AlphaTechnolog/pywal.nvim', 'AlphaTechnolog/pywal.nvim',
config = function () config = function ()
vim.cmd('colorscheme pywal') vim.cmd('colorscheme pywal')
add_tweaks()
end, end,
} }