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

Change default built-in terminal colors #26857

Open
echasnovski opened this issue Jan 2, 2024 · 12 comments
Open

Change default built-in terminal colors #26857

echasnovski opened this issue Jan 2, 2024 · 12 comments
Labels
defaults issues or PRs involving changing the defaults enhancement feature request highlight needs:discussion issue needs attention from an expert, or PR proposes significant changes to architecture or API terminal built-in :terminal or :shell
Milestone

Comments

@echasnovski
Copy link
Member

Problem

After #26540, default color scheme uses custom palette when true colors are enabled. The exception is colors in :terminal, which use palette from terminal emulator.

Expected behavior

Use built-in palette by default.

Essentially, setting default terminal colors similar to the following Lua code:

local bg = vim.o.background == 'dark' and 'NvimDark' or 'NvimLight'
local fg = bg == 'NvimDark' and 'NvimLight' or 'NvimDark'

vim.g.terminal_color_0  = vim.g.terminal_color_0  or (bg .. 'Grey2')
vim.g.terminal_color_1  = vim.g.terminal_color_1  or (fg .. 'Red')
vim.g.terminal_color_2  = vim.g.terminal_color_2  or (fg .. 'Green')
vim.g.terminal_color_3  = vim.g.terminal_color_3  or (fg .. 'Yellow')
vim.g.terminal_color_4  = vim.g.terminal_color_4  or (fg .. 'Blue')
vim.g.terminal_color_5  = vim.g.terminal_color_5  or (fg .. 'Magenta')
vim.g.terminal_color_6  = vim.g.terminal_color_6  or (fg .. 'Cyan')
vim.g.terminal_color_7  = vim.g.terminal_color_7  or (fg .. 'Grey2')
vim.g.terminal_color_8  = vim.g.terminal_color_8  or (bg .. 'Grey2')
vim.g.terminal_color_9  = vim.g.terminal_color_9  or (fg .. 'Red')
vim.g.terminal_color_10 = vim.g.terminal_color_10 or (fg .. 'Green')
vim.g.terminal_color_11 = vim.g.terminal_color_11 or (fg .. 'Yellow')
vim.g.terminal_color_12 = vim.g.terminal_color_12 or (fg .. 'Blue')
vim.g.terminal_color_13 = vim.g.terminal_color_13 or (fg .. 'Magenta')
vim.g.terminal_color_14 = vim.g.terminal_color_14 or (fg .. 'Cyan')
vim.g.terminal_color_15 = vim.g.terminal_color_15 or (fg .. 'Grey2')
@echasnovski echasnovski added the enhancement feature request label Jan 2, 2024
@clason clason added defaults issues or PRs involving changing the defaults terminal built-in :terminal or :shell labels Jan 3, 2024
@clason clason added this to the 0.10 milestone Jan 6, 2024
@clason
Copy link
Member

clason commented Jan 6, 2024

I think I would prefer my :terminal to look the same as the host terminal, colors included.

@clason clason added the needs:discussion issue needs attention from an expert, or PR proposes significant changes to architecture or API label Jan 6, 2024
@echasnovski
Copy link
Member Author

I can see that this is debatable, hence an issue first without an actual PR.

My reasoning here is that :terminal uses background and foreground from Normal and not from terminal emulator. As default color scheme defines its own Normal (which might be different from that of terminal emulator), to me a more consistent behavior would be for :terminalto also use colors from Neovim's default color scheme.

@clason
Copy link
Member

clason commented Jan 6, 2024

As default color scheme defines its own Normal (which might be different from that of terminal emulator),

Not sufficiently so; that's the point of bg=dark or light.

@clason
Copy link
Member

clason commented Jan 6, 2024

I think this would make sense as an option (not in the literal sense, but a script users could source in their init.lua if the want full Neovim branding). My main argument for not doing this by default is that it's (much) less effort to opt-in than to opt-out.

@echasnovski
Copy link
Member Author

I see. Well, it won't be a default then. This is the same line of reasoning as in "Why change default color scheme if it is better to create 'runtime/colors/neovim.lua' and one can just :color neovim?".

Do you think more as a code snippet in documentation (for example in 'nvim_terminal_emulator.txt' or in 'syntax.txt' near *gui-colors*) or as some custom script (plus documentation)?

@clason
Copy link
Member

clason commented Jan 6, 2024

I was thinking custom script (placing tbd).

This is the same line of reasoning as in "Why change default color scheme if it is better to create 'runtime/colors/neovim.lua' and one can just :color neovim?".

Because some colors is better than no colors; and if you have to set some colors, they should be usable. This here is crossing into "personal preference" territory. So I don't think that's comparable at all.

@glacambre
Copy link
Member

Two cents from a GUI maintainer: at the moment, neovim sends 224 (that's #0000e0 I think) as foreground color for "terminal color 4" to GUIs. In my opinion, it doesn't mesh well with the default color scheme and would be nicer if a color from the default color scheme was used instead. I don't know if this falls under the scope of this issue though.

@echasnovski
Copy link
Member Author

@justinmk, do you mind me asking about the executive decision here? Basically, should colors for built-in terminal (:terminal) be inherited from default color scheme or left as current is as terminal emulator's colors?

If the latter, then should there be some kind of opt-in script for "enhancing" experience with default color scheme? It could define terminal colors and maybe some more. If yes, what is the place to put it? There is 'scripts' directory, but not sure if it is appropriate to expose for end users.

Another idea is that the terminal colors can be defined in 'runtime/colors/default.vim'. In this case nvim --clean would use terminal emulator's palette, but :colorscheme default would define a more aligned palette.

@dundargoc dundargoc modified the milestones: 0.10, backlog Mar 30, 2024
@justinmk
Copy link
Member

@echasnovski similar to the current upvotes/downvotes count, I'm on the fence about this. And when something is a coin-flip, we usually choose to "do nothing".

should there be some kind of opt-in script for "enhancing" experience with default color scheme?

We could start with that. It could live in runtime/pack/dist/opt/

@clason
Copy link
Member

clason commented May 19, 2024

Conversely, the new default colorscheme is now widely available as a terminal colorscheme.

@craigmac
Copy link
Contributor

The default terminal colors when using :terminal in Neovide (latest, 0.13) are barely useable. This is not just a personal preference but an accessibility concern, which was one of the goals of the new default colorscheme if I'm not mistaken. Can we support both cases presented here by only setting these when GUI is attached, by guarding it with a vim.fn.has('gui_running')? This way GUIs get the branded version out of the box, and non-gui users aren't affected.

@clason
Copy link
Member

clason commented May 21, 2024

Can you back that up with a screenshot? (Preferably in a new issue, with all relevant details about platform, shell, config, etc.) My colors are fine in Neovide, no matter how I try to break them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defaults issues or PRs involving changing the defaults enhancement feature request highlight needs:discussion issue needs attention from an expert, or PR proposes significant changes to architecture or API terminal built-in :terminal or :shell
Projects
None yet
Development

No branches or pull requests

6 participants