Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "BG" color for cdeckInvisible highlight #2

Open
AndrewRadev opened this issue Dec 28, 2020 · 0 comments
Open

Missing "BG" color for cdeckInvisible highlight #2

AndrewRadev opened this issue Dec 28, 2020 · 0 comments

Comments

@AndrewRadev
Copy link
Contributor

AndrewRadev commented Dec 28, 2020

It seems like on my particular colorscheme, the syntax file errors out with:

E420: BG color unknown

It happens on this line:

hi cdeckInvisible guifg=bg guibg=bg ctermbg=bg ctermfg=bg

The problem, I think, is that the "bg" color only works if the Normal syntax group has a set background. In my case (a custom colorscheme), it looks like this:

hi Normal cterm=NONE ctermfg=White
hi Normal guifg=#dddddd guibg=Black

Even if I set ctermbg=NONE, it's the same issue -- it seems like it only works if there's a concrete color set, or I might be doing something wrong. The reason I'm not setting a specific color is because I'm using transparency in my terminal, so I'd like to keep this functionality.

Unfortunately, I'm not sure what a solution might look like. It would be nice if there was a way to check if "bg" was defined. This could work as a best-effort kind of thing, maybe:

try
  hi cdeckInvisible guifg=bg guibg=bg ctermbg=bg ctermfg=bg
catch /E420:/
  " No "bg" set, let's try our best to hide it:
  if &background == 'dark'
    hi cdeckInvisible guifg=Black guibg=Black ctermbg=Black ctermfg=Black
  elseif &background == 'light'
    hi cdeckInvisible guifg=White guibg=White ctermbg=White ctermfg=White
  endif
endtry

I've attached #3 as a PR that implements this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant