Skip to content

Modifiers "bold", "italic" not applied via base16_color_modifiers when termguicolors == false #6

@simchri

Description

@simchri

Hi,

I have encountered an issue where overrides or modifications to highlight groups for setting bold or cursive font were ignored. This happens only when falling back to terminal colors, i.e. vim.opt.termguicolors = false.

vim.g.base16_color_modifiers = {
    Keyword = "fg=red bold",
}

With these settings, keywords would be rendered in red* as expected, but not bold.
(*whatever the terminal's current interpretation of "red" is)

I traced it back to this section in base16.vim

https://github.com/Soares/base16.nvim/blob/340e9140e95a6e98d8a36b4a2e246cca1a2a3516/autoload/base16.vim#L45C1-L49C8

I would say a case is missing for termguicolors == false. The following fixed it for me:

  if len(l:attrs) > 0
    execute 'highlight' a:group 'gui='.join(l:attrs, ',')
      if !has('termguicolors') || !&termguicolors
        execute 'highlight' a:group 'cterm='.join(l:attrs, ',')
      endif
  elseif a:bang
    execute 'highlight' a:group 'gui=NONE'
      if !has('termguicolors') || !&termguicolors
        execute 'highlight' a:group 'cterm=NONE'
      endif
  endif

Would be glad if someone with knowledge on vimscript / highlighting could double-check this, since I am a total beginner here :)

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