-
Notifications
You must be signed in to change notification settings - Fork 5
Tinted nvim rewrite #34
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
base: 1.x
Are you sure you want to change the base?
Conversation
|
Did you have a chance to look into this? |
|
Hi @tummetott Thank you for this! This is a massive PR. Please consider breaking it down into smaller ones so it's easier to review & discuss specifics. Overall I'm for refactoring the plugin post fork, but its tough to see how we can merge this as-is in a reasonable time: I think we'll have a much better time & make better progress if we can merge in improvements/refactors piecemeal. |
|
Hi @bezhermoso, thanks for taking the time to review and for the feedback. I understand the concern about the PR looking very large. One clarification that might help: the “1497 changed files” in the diff is mostly due to the colorscheme palette files. Those are templated and automatically generated from the tinted-schemes, and the actual change there is limited to a small template adjustment mainly line breaks for readability. There’s no expectation to review those files individually. If you exclude the generated palettes, the functional changes are concentrated in a relatively small number of Lua modules. Each module has a single, well-scoped responsibility and can be reviewed independently. The reason I kept this as a single PR is that the pieces rely on a shared set of assumptions and a unified architecture; splitting it up would likely make individual PRs harder to understand without the full context. That said, I definitely want to make this as easy to review as possible. I’m very happy to:
Another option, if it helps reduce risk, would be to simply try running it for a bit. The rewrite is intended to be drop-in usable, and using it day to day might be a quicker way to validate whether the new structure and API feel sane before going deep into line-by-line review. I’m also fine treating this as a high-level v1 direction discussion first (API shape, conventions, overall design) before going into details. Let me know what would work best for you. |
|
One additional bit of context I should have mentioned: the main goal of this PR was to fix the plugin’s internal architecture rather than introduce isolated features or refactors. That meant redefining some core invariants around module boundaries, responsibilities, and how schemes and highlights are loaded. Once those invariants change, most of the code necessarily moves together, which is why this ended up as an atomic change instead of a series of incremental PRs. The intent was to make the architecture “right” first, so future changes and fixes can be done incrementally again. Happy to explain or walk through any of those architectural decisions in more detail if that helps. |
|
Thanks for going through the effort of creating this. Since it's a large change it will take longer than other PRs to review and merge since it will probably be a more PR collaborative with @bezhermoso and I. I've been busy recently but I'll go through this properly when I can. I've quickly looked through the file structure and noticed you removed |
|
@tummetott @bezhermoso I went through this and pushed a bunch of changes to this PR. Comment on any changes for discussions. I separated the different changes by commit to make it easier to go through. |
|
@JamyGolden I dug into the lualine theme logic. Right now, lualine checks the active colorscheme name and, if it starts with That As a fallback, it also reads the In practice, this implementation feels brittle and incomplete. Instead of relying on name heuristics and env vars, lualine should ideally detect actual lua modules (plugin presence) and pick the right integration explicitly. The major issue today is that My suggestion is:
|
|
The actual theme definition itself is very simple: local colors = require('tinted-nvim').get_palette_aliases()
local theme = {
normal = {
a = { bg = colors.grey, fg = colors.background, gui = 'bold' },
b = { bg = colors.dark_grey, fg = colors.foreground },
c = { bg = colors.darkest_grey, fg = colors.bright_grey }
},
insert = {
a = { bg = colors.blue, fg = colors.background, gui = 'bold' },
b = { bg = colors.dark_grey, fg = colors.foreground },
c = { bg = colors.darkest_grey, fg = colors.foreground }
},
visual = {
a = { bg = colors.yellow, fg = colors.background, gui = 'bold' },
b = { bg = colors.dark_grey, fg = colors.foreground },
c = { bg = colors.darkest_grey, fg = colors.background }
},
replace = {
a = { bg = colors.red, fg = colors.background, gui = 'bold' },
b = { bg = colors.dark_grey, fg = colors.foreground },
c = { bg = colors.darkest_grey, fg = colors.foreground }
},
command = {
a = { bg = colors.green, fg = colors.background, gui = 'bold' },
b = { bg = colors.dark_grey, fg = colors.foreground },
c = { bg = colors.darkest_grey, fg = colors.background }
},
inactive = {
a = { bg = colors.darkest_grey, fg = colors.grey, gui = 'bold' },
b = { bg = colors.darkest_grey, fg = colors.grey },
c = { bg = colors.darkest_grey, fg = colors.grey }
}
}
return themeThe main limitation is that this does not support cterm colors for non truecolor terminals. This is not really a theme issue but a lualine design limitation. Instead of passing the dict directly to Ideally, something like this should work, but it does not: normal = {
a = {
bg = colors.grey,
fg = colors.background,
ctermbg = 8,
ctermfg = 0,
gui = 'bold',
},
}A clean workaround would be to switch to highlight group based definitions: normal = {
a = 'LualineNormalA',
b = 'LualineNormalB',
c = 'LualineNormalC',
}and then define those groups properly in That said, I still think the right next step is to merge this PR first. We can then build proper lualine support on top with a follow up PR later. |
|
@JamyGolden OK, never mind. I have already added lualine support. It is not applied automatically yet because the detection mechanism is missing in lualine upstream. Once this PR is merged, I will follow up with the corresponding PR to lualine. I also added a commit that guards truecolor support behind a config option. With this change, the plugin now works properly in non truecolor terminals as well. |
|
@tummetott it doesn't need to be in upstream lualine. You can read through a closed PR I added there a while ago: nvim-lualine/lualine.nvim#1409 |
|
@JamyGolden I know and it currently isn’t. Please look at the last commit in this PR. I added the lualine scheme here, and that scheme is not in lualine upstream. The real blocker is lualine’s upstream detection logic. Their auto theme detection only recognizes base16-* schemes, so base24-* schemes are not detected correctly. To have lualine pick this up automatically, we need a PR in lualine that fixes or restructures the detection. As the lualine maintainer noted in the commit you linked: “Also base16 theme here is getting overloaded a lot. Probably need a restructure if we are going to support so many different variants of base16 plugins.” That’s exactly what I’m planning to do: improve the detection logic upstream so base24 schemes and the newer plugin variants are handled properly. |
|
Ah I see I hadn't looked at |
|
Let me know if you need anything else from to merge the PR |
|
Would be good to get an approval from @bezhermoso since it's such a large change. |
|
If bez hasn't responded tuesday ping me and we can merge it (I'll probably remember but in case I don't) |
|
Hi, apologies for the delay in responding, will make sure I take a deep look this weekend. |
|
Fantastic! This is full of great ideas that I’m excited about. A couple of general feedback: (1) I think it’d also nice to provide Lua syntax to refer to colors in |
|
Also, we want to think strategize how to make this change as smooth as possible for existing users: (1) We should trigger the notification whenever someone lands an importable that used to exist. (2) We should park this on a |
Yep, I see your point. Currently the I agree that magic strings like function M.build(palette, aliases, cfg)
return {
-- Using aliases
DiagnosticError = { fg = aliases.red },
DiagnosticWarn = { fg = aliases.orange },
-- Using palette
DiagnosticInfo = { fg = palette.base0A },
DiagnosticHint = { fg = palette.base08 },
}
endWe could also merge On If you like this approach, let me know and i write the fix |
…nd map resolved hex colors directly to ANSI indices
…e magic color strings)
completed in 503cdfa
completed in 59522dc
I suggest we treat this as a major-version reset rather than trying to map old config to new config.
What i would suggest in addition:
what do you think? |
|
100% agree that we don't need to keep configs interop. But we need to at least honor |
Thats already done. Did you check the commits I did yesterday ? |
This PR is a complete rewrite of
tinted-nvim.While working with the existing codebase I ran into several architectural limitations that made it difficult to fix bugs and add new features cleanly. After reviewing the plugin in depth I concluded that a redesign was the most sustainable path forward.
What changed
This rewrite addresses long standing issues and introduces a more idiomatic Neovim plugin architecture.
Notable improvements include
tinty currentas a subprocessThe plugin now reads the Tinty artifact directly
syntax resetinsideset_highlights()re-sources colorscheme and causes double apply #32 vim.g.terminal_color_0 wrong base_color? #31 and ColorScheme autocmd not triggered when using custom colors. #25ColorSchemeautocommand instead of a custom eventvim.fn.has("nvim-<version>")lazy.nvimplugin specsrequire("tinted-nvim").setup(opts)colors/<scheme-name>.vim. Just call theload(<scheme-name>)tinty applywith custom schemes breaks README.md and colorscheme.txt with t #33 as well although this has not been fully tested yet.And much much more. Please see the README and the code for full details. I am also happy to answer questions or explain design decisions.
Breaking change
This is intentionally a breaking change.
The previous configuration format diverged significantly from common Neovim plugin conventions. Rather than incrementally patching around those differences I opted to realign the plugin with established patterns and provide a cleaner long term API.
To make this transition easier I suggest the following release strategy
v0.1.xv1.0.0Users who want to stay on the old behavior can pin their plugin manager to
Closing thoughts
I spent a considerable amount of time designing implementing and documenting this rewrite. I believe it provides a much stronger foundation for future features and maintenance.
Thank you for taking the time to review this PR.