isakbm / gitgraph.nvim

Git Graph plugin for neovim
MIT License
314 stars 8 forks source link

Setting a color scheme breaks colors. #20

Open ionarevamp opened 3 months ago

ionarevamp commented 3 months ago

Normally, opening a gitgraph will visualize the commit history with the lines and text as different colors.

Problem: if the colorscheme is set at all in the same buffer as the gitgraph, either manually via :colorscheme [color scheme] or via a script, the color differentiation breaks and it all shows as normal text as specified via the color scheme, I assume because there's no color scheme/syntax specification for the 'gitgraph' filetype.

Suggested fix: Perhaps define the syntax with the same data that is used to display it? Not really sure how it would work specifically, but maybe it could look at the file from the bottom up to find out which lines should be different colors, and use regular expressions for the normal text such as the commit numbers and commit messages and such.

Not really a big deal, but it would be nice to be able to have a custom set of colors for this.

ionarevamp commented 3 months ago

I also feel like I should mention that, for now, the script I have that automatically sets color schemes based on the time of day doesn't do anything if the filetype is 'gitgraph'

isakbm commented 3 months ago

Ah the reason this happens is that your color scheme when it is applied after gitgraph has populated the buffer, it overwrites gitgraph highlight groups.

I can have a fix for this soon inspired by other plugins. Typically one re adds any missing highlight groups after a highlight event.

If you want to customise the highlights that is quite easy btw. The groups are listed towards the end of README.md.

I will also most likely change the groups so they by default borrow or link to other typical color from existing themes like tokionight.

May I ask what color scheme you use?

ionarevamp commented 3 months ago

I use nightfox during the day (for high contrast), and nordfox at night (similar, but softer)

( I also have :highlight Normal ctermbg=black guibg=black always set because I like me some dark mode )

ionarevamp commented 3 months ago

Nightfox can be found here: https://github.com/EdenEast/nightfox.nvim

will-lynas commented 3 weeks ago

I have this problem too with tokyonight. Is there a workaround?