Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ require'nvim-web-devicons'.setup {
-- set the light or dark variant manually, instead of relying on `background`
-- (default to nil)
variant = "light|dark";
-- override blend value for all highlight groups :h highlight-blend.
-- setting this value to `0` will make all icons opaque. in practice this means
-- that icons width will not be affected by pumblend option (see issue #608)
-- (default to nil)
blend = 0;
Comment on lines +122 to +126
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really appreciate the detail.

-- same as `override` but specifically for overrides by filename
-- takes effect when `strict` is true
override_by_filename = {
Expand Down
15 changes: 13 additions & 2 deletions lua/nvim-web-devicons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ local global_opts = {
default = false,
color_icons = true,
variant = nil,
blend = nil,
}

---Change all keys in a table to lowercase
Expand Down Expand Up @@ -129,10 +130,16 @@ local function set_up_highlight(icon_data)

local hl_group = get_highlight_name(icon_data)
if hl_group and (icon_data.color or icon_data.cterm_color) then
nvim_set_hl(0, get_highlight_name(icon_data), {
local hl_def = {
fg = icon_data.color,
ctermfg = tonumber(icon_data.cterm_color),
})
}

if global_opts.blend then
hl_def.blend = global_opts.blend
end

nvim_set_hl(0, get_highlight_name(icon_data), hl_def)
end
end

Expand Down Expand Up @@ -292,6 +299,10 @@ function M.setup(opts)
refresh_icons()
end

if type(user_icons.blend) == "number" then
global_opts.blend = user_icons.blend
end

apply_user_icons()

M.set_up_highlights()
Expand Down
Loading