projekt0n / github-nvim-theme

GitHub's Neovim themes
MIT License
2.11k stars 106 forks source link

`punctuation.delimiter` treesitter group nearly invisible #329

Closed jaywonchung closed 3 months ago

jaywonchung commented 3 months ago
Screenshot 2024-06-20 at 11 04 15 PM Screenshot 2024-06-20 at 11 06 28 PM

Somehow delimiters (e.g., :, ;, ,, .) are nearly invisible. I'm on Neovim 0.10.0 with the latest github-nvim-theme commit.

I checked :hi @punctuation.delimiter and nothing shows up, so it seems like no highlighting is defined for that group. Am I missing something?

Thanks.

tmillr commented 3 months ago

Hi, thanks for reporting this. Which theme are you using?

The issue seems to have to do with the Delimiter hl group, which (currently) is supposed to be unhighlighted (and as a result take on the default fg color), but instead it seems that nvim is highlighting it with a default now. So this should be an easy fix.

jaywonchung commented 3 months ago

Hey @tmillr, thanks for the response. I'm using colorscheme github_light.

jaywonchung commented 3 months ago

Ah, I think this is related: https://github.com/neovim/neovim/issues/26378

Similar thing happened in another repo: https://github.com/whatyouhide/vim-gotham/issues/68 As reported above, I do see that my Delimiter group has guifg=NvimLightGrey2 after updating to 0.10.0

jaywonchung commented 3 months ago

Without knowing what I'm doing, hi Delimiter guifg=NvimDarkGrey2 fixes the visibility issue at least. Could be a useful workaround until the issue is resolved.

tmillr commented 3 months ago

Without knowing what I'm doing, hi Delimiter guifg=NvimDarkGrey2 fixes the visibility issue at least. Could be a useful workaround until the issue is resolved.

Yeah that's the hl group causing issues. It's part of nvim's (new?) defaults apparently (see :h gui-colors). For now, you can also set groups.all.Delimiter to {} in the setup() call. Running hi clear Delimiter after setting the colorscheme with :colorscheme also works. Strangely, just setting the colorscheme twice also appears to work, although that's probably not an ideal workaround.

I suppose what we need to do (one idea) going forward is to make sure to set/clear basically all highlight groups, including those which should just inherit the default fg:

https://github.com/projekt0n/github-nvim-theme/blob/d832925e77cef27b16011a8dfd8835f49bdcd055/lua/github-theme/group/syntax.lua#L70

~Idk if this needs to be done for all (e.g. linked) groups, but at least for base groups like Delimiter.~ Delimiter used to be considered a "minor" hl group which was linked to Special by default (:h group-name), but I guess this is no longer the case (i.e. all the asterisks have been removed–see below):

The names marked with * are the preferred groups; the others are minor groups.                                                                                                  
For the preferred groups, the "syntax.vim" file contains default highlighting.                                                                                                  
The minor groups are linked to the preferred groups, so they get the same                                                                                                       
highlighting.  You can override these defaults by using ":highlight" commands                                                                                                   
after sourcing the "syntax.vim" file.
From :h group-name