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

Color Scheme cannot be enabled twice #39

Open
chrisgrieser opened this issue Jan 15, 2023 · 1 comment
Open

Color Scheme cannot be enabled twice #39

chrisgrieser opened this issue Jan 15, 2023 · 1 comment

Comments

@chrisgrieser
Copy link

Basically the same as #37, which for whatever reason got closed by the op without the issue being fixed.

The color scheme can only be changed once. changing to a different colorscheme and back does work.

This is also relevant when using plugins like styler or autodarkmode.

I had the same issue with oxocarbon, maybe their solution can be used here as well? nyoom-engineering/oxocarbon.nvim#38

@unphased
Copy link

unphased commented Feb 22, 2023

The problem I have with this colorscheme-plugin is that it does not work like it should in that when I define overrides to various highlight styles, the colorscheme clobbers them still even when i set these overrides to happen in autocmds.

I'm pretty sure it's because of this code (the only real code in here anyway):

local async_load_plugin

local set_hl = function(tbl)
  for group, conf in pairs(tbl) do
    vim.api.nvim_set_hl(0, group, conf)
  end
end

async_load_plugin = vim.loop.new_async(vim.schedule_wrap(function()
  z.terminal_color()
  set_hl(plugin_syntax)
  async_load_plugin:close()
end))

function z.colorscheme()
  vim.api.nvim_command("hi clear")

  vim.o.background = "dark"
  vim.o.termguicolors = true
  vim.g.colors_name = "zephyr"
  set_hl(syntax)
  async_load_plugin:send()
end

z.colorscheme()

return z

It would be wonderful if author could grace us with an explanation of why this is but I would imagine that we could easily turn this into a more well behaved colorscheme by simply synchronously making the calls in here.

I think I know what the reason is though actually. It's that some of these hl's are intended to get set after the other ones are because there are probably subtle interactions going on. I'm going to just go ahead fork the colorscheme instead of trying to add code to set override highlight groups, because that aint working.

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

2 participants