vim icon indicating copy to clipboard operation
vim copied to clipboard

Colors appear washed out and darker background

Open adelejjeh opened this issue 4 years ago • 11 comments

Screen Shot 2021-02-10 at 8 34 11 AM

adelejjeh avatar Feb 10 '21 14:02 adelejjeh

Hi @adelejjeh :wave:, that's pretty little information 😉

In order to ensure the problem is related to the Nord theme you need to reproduce it with a minimal and clean configuration. This can be done by creating new configuration file with any name (e.g. testrc) and run Vim with the following command: vim -u testrc For me as a theme author it is not possible to know if the theme is the root cause of the problem when there are other attributes set in the configuration because each one might break the theme.

Here's an minimal test configuration you can use to try to reproduce the problem (supposed you're using vim-plug):

call plug#begin(expand('~/.vim/plugged'))
Plug 'arcticicestudio/nord-vim'
call plug#end()

set nocompatible
if (has("termguicolors"))
  set termguicolors
endif

syntax enable
colorscheme nord

As you can see in the example configuration the termguicolors setting is enabled because the *_term attributes make use of the colors that are provided by the terminal color scheme which might be for example iTerm2 or Terminal.app in your case. The *_gui variables on the other side are used when Vim runs in GUI mode. So in order to run Vim in a terminal but use colors like in GUI mode the termguicolors variable must be set and your terminal emulator must support “true colors“ (24bit). → Did you install the corresponding Nord theme for your terminal, e.g. Nord iTerm2?

Unfortunately terminal colors are quite complex due to their long history, but modern terminal emulators should be all capable of rendering "True Colors". You should make sure to check out the great “Terminal Colors“ gist that provides many details about color rendering in terminal emulators, tracking of supported terminal emulator projects and answers to common confusions about terminal colors. The “Colours in terminal“ gist is also quite helpful to learn more about the actual rendering engines and standards used by these terminal emulators. There are also a lot of blog posts like this and this one that help to handle different use case with various terminal emulators in combination with different CLI and TUI applications.

→ Could you please try to either use the example configuration or set the termguicolors setting in your current configuration and check whether colors are then displayed correctly?

arcticicestudio avatar Feb 12 '21 19:02 arcticicestudio

I'm having a similar problem and I think I've isolated the issue to tmux. When I run NeoVim with the test configuration above outside of tmux (I'm using Alacritty v0.7.2), the colors are correct. When I start tmux and then open NeoVim with the same test config, the colors look similar to the ones in the original poster's screenshot.

I'm on Ubuntu 18.04, so the version of tmux is 2.6, which is from 2017. I think I have this working on my other computer which is a much more recent release of Ubuntu (pretty sure it's 20.10), so I'll double-check that it's working tonight and report back with the version of tmux I have. Could be that you just need to update tmux.

darthmall avatar Apr 15 '21 22:04 darthmall

I don't have the same problem with tmux 3.1b, so it's conceivable that this is a tmux bug that has been fixed in more recent versions.

darthmall avatar Apr 16 '21 02:04 darthmall

Same! I put the following sentences in the ~/.tmux.conf file and it solved.

set -g default-terminal screen-256color
set-option -ga terminal-overrides ",*256col*:tc"

chengleqi avatar Feb 28 '22 04:02 chengleqi

I'm having a similar issue, although I can't seem to figure out the cause.

Screenshot_20220622_103004

As far as my Vim config goes my color here are the color and color scheme settings I used

" Color Scheme stuff
if has('termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set t_Co=256
set termguicolors
endif

colorscheme nord
augroup nord-theme-overrides
let g:nord_italic = 1
let g:nord_italic_comments = 1
let g:nord_underline = 1
let g:nord_uniform_diff_background = 1
autocmd!
" Use 'nord6' as foreground color for all comments.
autocmd ColorScheme nord highlight Comment ctermfg=242 guifg=#ECEFF4
autocmd ColorScheme nord highlight LineNr ctermfg=242 guifg=#ECEFF4
augroup END

Note that without these lines, I have no color at all inside of tmux

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set t_Co=256

I did try setting the tmux settings suggested by @chengleqi without any luck.

I'm running Arch Linux, with tmux 3.3_a, and vim 8.2.5046

vendion avatar Jun 22 '22 13:06 vendion

I have this problem again now. lol. I'm running Ubuntu20.04, with tmux 3.0a and nvim v0.6.1

chengleqi avatar Jun 22 '22 13:06 chengleqi

It seems that using the following in $HOME/.tmux.conf mostly fixes it

set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color*:Tc"

Screenshot_20220623_111035

I should also have added in my other comment my terminal emulator is Konsole if that helps. Now it seems it is just the odd background color in the comments.

vendion avatar Jun 23 '22 14:06 vendion

it's weird. It worked on wezterm, but not on my alacritty. Maybe I should switch to Wezterm?😂

chengleqi avatar Jun 23 '22 14:06 chengleqi

it's weird. It worked on wezterm, but not on my alacritty. Maybe I should switch to Wezterm?😂

You can fix it by setting the term property in Alacritty config to:

env:
  TERM: xterm-256color

lafriakh avatar Jun 26 '22 17:06 lafriakh

it's weird. It worked on wezterm, but not on my alacritty. Maybe I should switch to Wezterm?joy

You can fix it by setting the term property in Alacritty config to:

env:
  TERM: xterm-256color

It Worked! thanks so much.

chengleqi avatar Jun 27 '22 05:06 chengleqi

it's weird. It worked on wezterm, but not on my alacritty. Maybe I should switch to Wezterm?joy

You can fix it by setting the term property in Alacritty config to:

env:
  TERM: xterm-256color

Setting that in $HOME/.tmux.conf also seems to fix it using Konsole + Tmux.

vendion avatar Jun 28 '22 12:06 vendion