๐ Bug: highlight_groups custom groups stopped working
Closed this issue ยท 1 comments
Before reporting:
- Ensure that the issue is reproducable on the main branch.
- Ensure that there isn't an issue on this(either open or closed).
Problem:
very recently the highlight_groups section, or more specifically the groups I added to it has stopped working.
I know before it worked just fine but I don't know which update might have broken that.
As you can see in the corner of the headers. it should have highlight same to the background
Steps to reproduce the issue:
{
"OXY2DEV/markview.nvim",
lazy = true, -- Recommended
ft = "markdown", -- If you decide to lazy-load anyway
config = function ()
local colors = require("markview.colors");
require("markview").setup({
modes = { "n", "i", "no", "c" },
hybrid_modes = { "i", "n" },
-- This is nice to have
callbacks = {
on_enable = function (_, win)
vim.wo[win].conceallevel = 2;
vim.wo[win].concealcursor = "nc";
end
},
checkboxes = {
enable = true,
checked = {
text = "๓ฐก", hl = "MarkviewCheckboxChecked"
},
unchecked = {
text = "๎", hl = "MarkviewCheckboxUnchecked"
}
},
links = {
enable = true,
images = {
icon = "๏พ ",
hl = "MarkviewImageLink",
}
},
highlight_groups = {
{
group_name = "MarkviewHeading1Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading1", "bg") };
end
},
{
group_name = "MarkviewHeading2Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading2", "bg") };
end
},
{
group_name = "MarkviewHeading3Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading3", "bg") };
end
},
{
group_name = "MarkviewHeading4Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading4", "bg") };
end
},
{
group_name = "MarkviewHeading5Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading5", "bg") };
end
},
{
group_name = "MarkviewHeading6Corner",
value = function ()
return { fg = colors.get_hl_value(0, "MarkviewHeading6", "bg") };
end
},
},
headings = {
enable = true,
shift_width = 0,
heading_1 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading1Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading1Corner",
hl = "MarkviewHeading1"
},
heading_2 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading2Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading2Corner",
hl = "MarkviewHeading2"
},
heading_3 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading3Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading3Corner",
hl = "MarkviewHeading3"
},
heading_4 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading4Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading4Corner",
hl = "MarkviewHeading4"
},
heading_5 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading5Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading5Corner",
hl = "MarkviewHeading5"
},
heading_6 = {
style = "label",
padding_left = " ",
padding_right = " ",
corner_left = "๎ถ",
corner_left_hl = "MarkviewHeading6Corner",
corner_right = "๎ด",
corner_right_hl = "MarkviewHeading6Corner",
hl = "MarkviewHeading6"
},
}
})
end
},
Expected behavior:
The corner of the headers should match the headers background
Neovim version:
NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382
This is due to changes to how highlights are applied.
markview.colors
was deprecated due to lack of interest & maintainability reasons. It will be removed later.
This is the new syntax.
highlight_groups = {
{
output = function (hl)
return {
group_name = "Heading1Corner",
value = {
fg = hl.hex(hl.color("bg", { "MarkviewHeading1" }, nil, nil))
}
}
end
}
}
Here's the function definitions.
---@param opt string Option to get, e.g. bg, fg
---@param colors string[] List of highlight groups to check into. Useful for groups that get inherited from multiple highlight groups.
---@param light any Value to return if the opt wasn't found and the background is "light".
---@param dark any Value to return if the opt wasn't found and the background is "dark".
---
---@return integer[] The R, G, B value
hl.color(opt, colors, light, dark)
---@param color integer[] The R, G, B values
---@return string The hexadecimal value of the color.
hl.hex(color)
markview.colors
was replaced with markview.highlights
to make maintaining it easier. markview.colors
will be removed in a future update.
Manually setting highlight groups is no longer recommended as it may overwrite the highlight groups provided by the colorscheme(assuming it supports this plugin). So, it will not be documented in the wiki.