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

Built-in support for g:terminal_color_* variables #116

Open
musjj opened this issue Dec 16, 2022 · 1 comment
Open

Built-in support for g:terminal_color_* variables #116

musjj opened this issue Dec 16, 2022 · 1 comment

Comments

@musjj
Copy link
Contributor

musjj commented Dec 16, 2022

https://neovim.io/doc/user/nvim_terminal_emulator.html#terminal-config
Currently themes using lush.nvim have to implement a custom solution to set these variables. It would be cleaner if we can control these directly in the spec.
Maybe something like:

return lush(function()
  return {
    g.terminal_color_1 { colors.foo },
    g.terminal_color_2 { colors.bar },
  }
end)

An issue is that terminal colors aren't refreshable, so this doesn't work very well with :Lushify. But still, this would make applying and building colorschemes with terminal support easier.
What do you think?

@rktjmp
Copy link
Owner

rktjmp commented Dec 17, 2022

As given that syntax wont (shouldnt?) work in Lush as the g.terminal_color_1 is an invalid group name. I'm not sure there would be a compatible syntax as the term colors don't really fit into the same "group" idea and I don't want to have magic group names that automatically translate - at least not in userland.

Possibly another function could be injected, like sym is that generates special keys internally, term_c(1) { fg = some_color }.

This should be an already compatible way to do it though, which I think is preferable and not very burdensome?

local theme = lush(function()
  return {
   Normal { fg = some_color },
   -- ...
  }
end)

g.terminal_color_1 = theme.Normal.fg.hex -- or tostring(theme.Normal.fg) or tostring(hsl(...)) if not using a group
-- ...

return theme

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