sainnhe / gruvbox-material

Gruvbox with Material Palette
MIT License
1.96k stars 166 forks source link

Improve highlights of LaTeX delimiters #185

Closed aloispichler closed 8 months ago

aloispichler commented 1 year ago

I enjoy dimmed colors for Delimiters (cf. onedark), so brackets etc. distract less. This can be achieved by :hi Delimiter guifg=darkgray

Is there a way to load that directly, something like { 'sainnhe/gruvbox-material', opts={overrides={Delimiter= {link= "Comment"}}}}, ?

antoineco commented 1 year ago

Could you please elaborate with an example?

antoineco commented 1 year ago

Customizations can be achieved using an autocmd, like with any (Neo)vim colorscheme. There is an example in the docs, here is another one in Lua:

-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
vim.api.nvim_create_autocmd('ColorScheme', {
  group = vim.api.nvim_create_augroup('gruvbox-material', {}),
  pattern = 'gruvbox-material',
  callback = function()
    vim.api.nvim_set_hl(0, 'Delimiter', { link = 'Comment' })
  end
})
aloispichler commented 1 year ago

Thank you, this works indeed! This is my favorite colorscheme for writing LaTeX since years, btw. Let me know if you consider adding a dimmed color for Delimiter. Something between the color of Comment and Whitespace would be nice, I believe.

antoineco commented 1 year ago

If LaTeX highlights can be improved while remaining faithful to the semantics of the colorscheme we should definitely do that.

Adding new colors to gruvbox-material is a non-goal, but I'm sure that we can find a sensible defaults that use the existing palette. If not, users are free to customize things however they please. Every individual has different preferences, which is perfectly fine, especially in an editor like (Neo)vim which is designed with customization in mind.

aloispichler commented 1 year ago

You are right.

The default colors for Delimiter are:

d4be98 (dark) – 654735 (light),

which are fg0 from palette2.

This is what I think is good:

7c6f64 (dark) – a89984 (light), both are grey0 from palette3

This is a very minor, but significant change, as delimiters are very frequent in LaTex: for example in: … let $x=3$ and …. This improves reading a lot.

antoineco commented 8 months ago

I didn't have the occasion to open a tex file in Vim and just got back to this issue.

Here is a breakdown of the highlight groups involved:

image

We don't currently have any customization for texDelimiter in the colorscheme, and I agree that grey0 seems like a good candidate.