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

Feature Request: add markdown headings background #212

Open
luigir-it opened this issue Jul 28, 2024 · 1 comment
Open

Feature Request: add markdown headings background #212

luigir-it opened this issue Jul 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@luigir-it
Copy link

Hi.
I'm using Neovim 0.10 with markdown.nvim

Right now, headers foreground look really nice (I guess thanks to #196), but we can't say the same thing for the background
The highlight groups for the background H{1..6} link respectively to:
DiffAdd
DiffChange
DiffDelete (3 to 6)
And look like this:
2024-07-28T14:59:04,409223905+02:00

I asked ChatGpt to make background colors that mix nicely with the foreground, and this is the result:
2024-07-28T15:49:41,404695863+02:00
Much nicer!

The lua functions I used to make this happen (I'm using LazyVim distribution):

  1. Define colors
{
    "sainnhe/gruvbox-material",
    init = function()
      vim.g.gruvbox_material_colors_override = {
        markbg1 = { "#2e1a1a", "52" }, -- Adjusted color code for #2e1a1a
        markbg2 = { "#332616", "94" }, -- Adjusted color code for #332616
        markbg3 = { "#3a3020", "100" }, -- Adjusted color code for #3a3020
        markbg4 = { "#243218", "22" }, -- Adjusted color code for #243218
        markbg5 = { "#1b2926", "23" }, -- Adjusted color code for #1b2926
        markbg6 = { "#2e1a20", "52" }, -- Adjusted color code for #2e1a20
      }
    end,
}
  1. Define highlight groups
vim.api.nvim_create_autocmd("ColorScheme", {
  group = vim.api.nvim_create_augroup("custom_highlights_gruvboxmaterial", {}),
  pattern = "gruvbox-material",
  callback = function()
    local config = vim.fn["gruvbox_material#get_configuration"]()
    local palette = vim.fn["gruvbox_material#get_palette"](config.background, config.foreground, config.colors_override)
    local set_hl = vim.fn["gruvbox_material#highlight"]
    set_hl("RenderMarkdownH1Bg", palette.none, palette.markbg1)
    set_hl("RenderMarkdownH2Bg", palette.none, palette.markbg2)
    set_hl("RenderMarkdownH3Bg", palette.none, palette.markbg3)
    set_hl("RenderMarkdownH4Bg", palette.none, palette.markbg4)
    set_hl("RenderMarkdownH5Bg", palette.none, palette.markbg5)
    set_hl("RenderMarkdownH6Bg", palette.none, palette.markbg6)
  end,
})
@antoineco
Copy link
Collaborator

This looks nice indeed 👌

The use case of markdown headings is very specific, and this one applies to a specific plugin as well, so I guess it would be fine to use a blend of Gruvbox Material's foreground colors with the dimmed background color to obtain a pleasant effect.

The only thing that bothers me with making that change is that the colorscheme has multiple color variations. This would require quite a lot of off-palette colors to be included.

@antoineco antoineco added the enhancement New feature or request label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants