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: options for overriding on specific filetypes? yaml looks bad #213

Closed
joshzcold opened this issue Oct 11, 2022 · 4 comments

Comments

@joshzcold
Copy link

joshzcold commented Oct 11, 2022

The treesitter parser for yaml sticks the yaml keys at TSField which is white on this color scheme
ikatyang/tree-sitter-yaml#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
Copy link
Author

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
Copy link

olimorris commented Mar 13, 2023

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

Something I do in my own colorscheme.

@ful1e5
Copy link
Member

ful1e5 commented Mar 14, 2023

@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
Copy link
Author

@ful1e5 that works well. Thank you 👍

@ful1e5 ful1e5 closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants