projekt0n / github-nvim-theme

Github's Neovim themes
MIT License
2.02k stars 104 forks source link

How to get this to match the original theme? #288

Closed ghost closed 10 months ago

ghost commented 11 months ago

When viewed side-by-side, the same file looks different with this theme compared to GitHub or the VS Code theme (or Helix). Is there a way to fix this? I am not well versed on themes or colors so I cannot override myself.

tmillr commented 11 months ago

Are you using the latest version/release of this plugin? And are you using treesitter for highlighting (and have it setup properly)?

ghost commented 11 months ago

Yes I am on the latest release and treesitter works (default configuration). Although I just did a more thorough comparison and Helix doesn't seem to match GitHub either.

I guess this is caused by the subtle differences in parsing?

tmillr commented 11 months ago

The syntax highlights should be quite close (90%+ accurate) for most common langs. Getting them 100% accurate takes alot more work. Which lang are you having issues with? Can you post a screenshot?

ghost commented 10 months ago

hi, here's a comparison of a struct in rust between neovim using this theme (either dark default on v0.0.7 or dark high contrast on master, they look the same) vs. vscode using the original theme. (ignore the black background on neovim, it's tranparent).

neovim:

image

vscode:

image

tmillr commented 10 months ago

Thanks for sharing that. The neovim screenshot looks fine to me.

The goal of this theme should be to recreate Github's themes as closely and accurately as possible (while trying to make good decisions in edge-cases where Github's theme may be lacking). By "GitHub's theme", I'm referring to the current theme(s) used here on GitHub.com. The goal is not to follow the vscode version and inherit the inaccuracies of their own recreation. Please compare colors against GitHub's website directly.

According to your vscode screenshot, the vscode version has incorrect highlights for :, as well as struct fields and {} brackets. The highlighting of the derive attribute is a bit off and could be improved as well.

#[derive(Debug, Clone, Default)]
pub struct MyStruct {
    pub id: Option<usize>,
    hello: MyStruct,
}

If you'd prefer for rust fields to have the default fg color, this can be overridden via config.

ghost commented 10 months ago

Huh, you are right that its actually vscode that doesn't match with GH. That's surprising. Although I still think that vscode has a more natural look so I will look into configuring it myself. Thank you!

tmillr commented 10 months ago

The biggest difference on display here is essentially the color/highlights of (struct) fields. When it comes to the current "GitHub theme", fields/props are usually either unhighlighted, or highlighted with a blueish color (the exact color depends on the specific theme/variant), depending upon the language. Idk why a few langs don't have highlighted fields (maybe that's the actual intent of GitHub, or maybe it's simply an accident or due to shortcomings); but for rust, fields do get highlighted.

IMO, there's both pros and cons to having these sort of extra highlights. On one hand, it can make the distinction between syntax elements easier to discern, on the other, too many highlights (or different colors) can quickly become overwhelming or distracting. So it can be sort of a subjective question and catch 22 for what's best.