rose-pine / neovim

Soho vibes for Neovim
MIT License
2.22k stars 144 forks source link

Colors are not applying for Terminal.app or other non true color terminal #160

Closed lhpaoletti closed 1 year ago

lhpaoletti commented 1 year ago

I'm having problems with setting the colorscheme on Neovim to rose-pine. I use the Terminal app from macOS running zsh, and I can't seem to find any helpful issues here or posts on any of the goto help websites. Maybe this could be because I don't understand Lua enough, and am doing something wrong, but what I'm doing is: make the use-statement in my packer.lua, which is in a subdirectory (which I'll call subdir) within the ~/.config/nvim/lua directory. Then, from the ~/.config/nvim/init.lua file I do require("subdir") at the top level. In the subdir/init.lua I have require("subdir.packer") written. Now, when I do :colorscheme rose-pine, I get this horrendous look:

Screenshot 2023-05-23 at 01 39 52

As the subject of this issue says, the $TERM env-variable is set to xterm-256color. I don't know if it's relevant, but I do also have a ~/.vimrc file.

lhpaoletti commented 1 year ago

I'm glad to share more information if needed. I'd be really grateful for any help, because I loved this color scheme!

mvllow commented 1 year ago

Hey there! Unfortunately Terminal.app has a limited set of colors it supports. I would recommend iTerm2 for something a little simpler to setup or Kitty terminal. Happy to answer any questions about either. Feel free to join our Discord with questions too :)

lhpaoletti commented 1 year ago

I think not.. I just tested it with this script from [https://www.commandlinefu.com/commands/view/6533/print-all-256-colors-for-testing-term-or-for-a-quick-reference](this website) and it has the expected output for a 256-color terminal:

Screenshot 2023-05-26 at 17 53 10

So I think that the problem might be something else here, right?

lhpaoletti commented 1 year ago

And I don't have an idea how to better name this issue, but maybe someone here does. I think that there should be a better, more general naming for this issue.

mvllow commented 1 year ago

Sorry, just to clarify is your latest screenshot in Terminal.app or another terminal? Our theme won't work in terminal.app but should in iterm2, kitty, etc. and if those are not working for you I'm happy to explore further

syncerax commented 1 year ago

TL;DR - Doesn't look like a bug in rose-pine. Same issue with other colorschemes. The macOS Terminal.app doesn't support 24-bit color. Switching to iTerm2 fixes the issue.


I ran into this as well on the macOS Terminal.app.

I first assumed that it was an issue with this colorscheme and tried out some other colorschemes. However, I saw the same problem using other colorschemes, which made me start to think that the issue was either in my configuration or in my Terminal. Messed around with my config a bit, but that didn't help either.

Also, several forums recommended switching to a different app like iTerm2, Kitty, etc. because macOS' Terminal.app doesn't have the required color support yet.

Switching to iTerm2 fixed the issue for me.

Here are some screenshots showing the rose-pine and onedark themes in iTerm2 (left) and Terminal.app (right).

Theme Screenshot
rose-pine rose-pine
onedark onedark

I think this is caused by the macOS Terminal.app not supporting 24-bit color, and not related to xterm-256color. The value of the $TERM env variable is xterm-256color in both iTerm2 and Terminal.app. However, running this script to test 24-bit color support shows that iTerm2 supports 24-bit color, whereas the macOS Terminal does not. Here's a screenshot showing this:

24-bit-color-support

Here's a StackOverflow question that mentions something similar: https://stackoverflow.com/questions/58674310/nvim-in-macos-terminal-breaks-on-displaying-termguicolors

It's a little annoying, but this seems to be a macOS Terminal.app problem, not a rose-pine problem.

Hope this helps!

mvllow commented 1 year ago

If this is an issue outside of Terminal.app let me know and we can reopen

mvllow commented 1 year ago

Although it doesn't fully match our theme, it is possible via mini.colors to infer cterm values (e.g. enable support for non true color terminals):

-- Requires `rose-pine/neovim` and `echasnovski/mini.colors`
vim.cmd.colorscheme("rose-pine")
require("mini.colors").get_colorscheme():add_cterm_attributes():apply()
vim.opt.termguicolors = false
lhpaoletti commented 1 year ago

@mvllow @syncerax Thank you so much for your help! I'll try iTerm2 out and if I encounter any problems I'll mention it here again. 👍

ernestchu commented 3 months ago

Actually, color will show correctly under tmux in Terminal.app

mvllow commented 3 months ago

That is not the case for my setup. Running the following in a fresh tmux instance doesn't apply my colorscheme.

tmux kill-server
tmux
nvim
ernestchu commented 3 months ago

@mvllow oh, forgot to mention. You should have this in your ~/.tmux.conf

set -g default-terminal "xterm-256color"