Improve Neovide Terminal Color Configuration
Is your feature related to a problem?
If the terminal colors are not configured, the appearance of the terminal inside Neovide is not very appealing. By default, it looks like this:
Describe the new feature
Add a way for users to customize Neovide's terminal colors . This would allow them to define specific colors for the terminal that will be used exclusively within Neovide , regardless of their overall terminal color settings.
Additional context
There are several approaches to implement this feature:
-
Create an external plugin similar to AstroCore that allows users to set Neovide-specific options as tables.
-
Integrate this feature directly into the Neovide recipe.
-
Incorporate this feature into AstroCore, enhancing the integration between AstroNvim and Neovide, and allowing us to proudly highlight this feature.
Given these options, what approach do you think we should take? I'm looking forward to your thoughts and any additional suggestions!
One solution to enhance this functionality is to modify Neovide's Recipe as follows:
Step 1: Modify Neovide's Recipe Options Table
You can modify the Neovide's Recipe Options Table to include an autocommand that adjusts the terminal colors when a new terminal window is opened.
Here's the proposed Lua code:
autocmds = {
-- Setup Neovide's terminal colors
neovidetermcolors = {
{
event = "TermOpen",
desc = "Setup the terminal colors when using neovide",
callback = function()
local astrocore = require "astrocore"
local features = astrocore.config.features
---@diagnostic disable-next-line: undefined-field, need-check-nil
local neovide_settings = features.neovide
if not neovide_settings then return end
local terminal_colors = neovide_settings.terminal_colors
for index, color in pairs(terminal_colors) do
vim.b["terminal_color_" .. index] = color
end
end,
},
},
}
Step 2: Configure the Terminal Colors
You may wonder where to configure these colors. Great question! You can set them in your Astrocore configuration file under the features section.
Here's how you can configure the terminal colors:
features = {
neovide = {
terminal_colors = {
[0] = "#45475a",
[1] = "#f38ba8",
[2] = "#a6e3a1",
[3] = "#f9e2af",
[4] = "#89b4fa",
[5] = "#f5c2e7",
[6] = "#94e2d5",
[7] = "#bac2de",
[8] = "#585b70",
[9] = "#f38ba8",
[10] = "#a6e3a1",
[11] = "#f9e2af",
[12] = "#89b4fa",
[13] = "#f5c2e7",
[14] = "#94e2d5",
[15] = "#a6adc8",
},
},
}
Final Result
Voilà! It’s like magic, right? 🎩✨
If you're using catppuccin nvim theme then try setting term_colors to true in its config.
https://github.com/catppuccin/nvim?tab=readme-ov-file#configuration
Is this related to the neovide pack?
If you're using catppuccin nvim theme then try setting
term_colorsto true in its config. https://github.com/catppuccin/nvim?tab=readme-ov-file#configuration
True but I use a lot of different themes this would be beneficial for all people no matter what colorscheme they are using
Is this related to the neovide pack?
No necessarily but It could be solved in the neovide's pack if we go with the approach above
Does vim.opt.termguicolors = true fix the issues?
No termguicolors option enables 24-bit colors only for the TUI. This is more of niche thing about neovide that terminal buffers don't use the correct colors
Have you tried things suggested here? https://github.com/neovide/neovide/discussions/2252
I'm not using Fish as my shell, but I want to propose an enhancement to Neovide's pack. This is not an issue for me since I already have a solution; rather, I believe it could benefit everyone. If you think this enhancement isn't necessary, I can close the issue.
I appreciate your work on the enhancement. I'm trying to figure out why this is an issue and whether it's something each user can solve independently, as each setup will be different.
It adds complexity to the recipe and may introduce potential edge cases and bugs due to different configurations. So, it would be nice to figure out if this is necessary.
I'm not using Fish as my shell, but I want to propose an enhancement to Neovide's pack. This is not an issue for me since I already have a solution; rather, I believe it could benefit everyone. If you think this enhancement isn't necessary, I can close the issue.
A PR would be helpful so that we can see this fix. I think adding it to astrocore is a nogo, so either a seperate plugin or adding it to the receipt. :)