projekt0n / github-nvim-theme

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

Feature request: options for overriding on specific filetypes? yaml looks bad #213

Closed joshzcold closed 1 year ago

joshzcold commented 1 year ago

The treesitter parser for yaml sticks the yaml keys at TSField which is white on this color scheme https://github.com/ikatyang/tree-sitter-yaml/issues/28

image

using the autogroup recommended in the issue I was able to put it at the green used in github-nvim-theme which is closer to what is on the github website

  augroup github-yml-theme
      au!
      au BufEnter *.{yaml,yml} :hi TSField guifg=#3fb950
  augroup END
vim.api.nvim_create_autocmd("FileType", { pattern = { "yaml", "yaml.ansible" }, command = "hi TSField guifg=#3fb950" })

image

My question is if we can get something more built in to override on filetypes to fix issues like this?

Or maybe better I can make a pull request to add this auto group to fix the color scheme for yaml for this one issue?

Which do you think would be better?

joshzcold commented 1 year ago

I kind of like this option if we want to put it in the wiki

require("github-theme").setup({
  theme_style = "dark_default",
  overrides = function (c)
    -- fix the look of yaml in this color scheme
    vim.api.nvim_create_autocmd("FileType", { pattern = { "yaml", "yaml.ansible" }, command = "hi TSField guifg=".. c.green })
    return{ }
  end
})

since overrides is a function then c.green is available

olimorris commented 1 year ago

Can't you apply ["@field.yaml"] as an override?

Something I do in my own colorscheme.

ful1e5 commented 1 year ago

@olimorris Can you override the unassigned highlight by enabling dev mode? It's used to assign a new highlight that is not overridden by the colorscheme.

require('github-theme').setup({
  -- ...
  overrides = function(c)
    return {
      -- ...
      ['@field.yaml'] = { fg = c.red },
    }
  end,
  dev = true,
})
joshzcold commented 1 year ago

@ful1e5 that works well. Thank you 👍