Skip to content

Use blend = 0 option for DevIcon highlight groups #608

@asiryk

Description

@asiryk

Is your feature request related to a problem? Please describe.

Modern terminal emulators support feature for wide grapheme clusters: it means that icons are displayed a bit bigger than regular text characters. The problem is that when using neovim's vim.o.pumblend, the icons become mismatched in size (due to characters beneath). Here is a screenshot:

Image

Describe the solution you'd like

The fix is very simple - just add { blend = 0 } to nvim_set_hl like this

    nvim_set_hl(0, get_highlight_name(icon_data), {
      fg = icon_data.color,
      ctermfg = tonumber(icon_data.cterm_color),
      blend = 0,
    })

With this small change all icons are beautifully aligned:

Image

Describe alternatives you've considered

Currently I have this in my nvim config to bypass set_hl

  {
    "nvim-tree/nvim-web-devicons",
    config = function()
      local function opaque_icons()
        local devicons = require("nvim-web-devicons")
        devicons.setup({})

        local icons = devicons.get_icons()
        for _, opts in pairs(icons) do
          local hl = "DevIcon" .. opts.name
          vim.cmd(("highlight %s blend=0"):format(hl))
        end
      end

      vim.schedule(opaque_icons)
      vim.api.nvim_create_autocmd("ColorScheme", { callback = vim.schedule_wrap(opaque_icons) })
    end,
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions