nordtheme / vim

An arctic, north-bluish clean and elegant Vim theme.
https://www.nordtheme.com/ports/vim
MIT License
2.52k stars 274 forks source link

Incorrect color contrast on vim with st #166

Closed lucassardois closed 5 years ago

lucassardois commented 5 years ago

I'm using vim 8.1 (with +termguicolors) inside st under dwm. I applied the nord theme to st. I installed nord trough Plug as recommended.

But for some reason some colors are incorrect inside vim... For instance as you can see on the screenshots line numbers and comments color are to close to the background color.

More, there is no visual selection color at all. Everything else looks ok trough...

1561487256

arcticicestudio commented 5 years ago

Hi @loustak :wave:, please note that the linked st theme is not an official theme but a contribution of a Nord user. I've not checked if the used colors are matching Nord's styles for syntax highlighting so your problem might be related to this. I've quickly checked the proposed theme and the adjustment of Nord's comment color is not included. This explains why comments and the line numbers using a darker color ( nord3) instead of the new #616e88 value ( nord3 brightness increased by 10%).

Also another problem might be that you Vim and terminal is not configured to use true colors. Can you please try to add the following config to your .vimrc and check if the problem still occurs:

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

Also please make sure you're running at least Nord Vim v0.10.0 or higher, otherwise the new comment color is also not supported.

lucassardois commented 5 years ago

Thanks for the answer @arcticicestudio. I tried changing the color inside my st configuration to the new nord3 color. No changes.

I checked my vim and tried set termguicolors it make all the text goes white: 1561628833

I checked the nord vim version inside nord.vim installed by plug, and I'm using v0.12.0:

let s:nord_vim_version="0.12.0"
lucassardois commented 5 years ago

I found a solution: https://github.com/vim/vim/issues/993#issuecomment-255651605

Adding the following lines to my .vimrc before setting the colorsheme solved all my colors problems:

" set Vim-specific sequences for RGB colors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

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

colorscheme nord
DictumMortuum commented 5 years ago

Did the same thing, however I still can't get the current line highlight to work. Maybe that requires a different sequence?

lucassardois commented 5 years ago

@DictumMortuum you are right. I didn't noticed it first but I have the exact same issue. So I reopen it.

arcticicestudio commented 5 years ago

Has someone found a solution to also enable highlight support for the current cursor line? I haven't installed and configured st so having some help here would be nice to resolve this ticket.

DictumMortuum commented 5 years ago

I'd be happy to help, but I'm not sure what I should do - do you want me to try anything?

arcticicestudio commented 5 years ago

Does it work if you're disabling italic font rendering in both st and the specific Nord theme configuration? Might be possible that there are conflicts with the terminal sequences. Also are you running Vim within tmux? If yes, it might be possible that there is a wrong configuration for tmux like a missing or invalid default-terminal value (set -g default-terminal "tmux-256color").

ghost commented 5 years ago

Hi !

St + vim works perfectly for me with this configuration. :wink:

St + Vim st_nord

St + Tmux + Vim st_nord_tmux

" ~/.vimrc

if exists('+termguicolors') && ($TERM == "st-256color" || $TERM == "tmux-256color")
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
    set termguicolors
endif

let g:nord_italic = 1
let g:nord_italic_comments = 1
let g:nord_underline = 1
let g:nord_uniform_status_lines = 1
let g:nord_uniform_diff_background = 1
let g:nord_cursor_line_number_background = 1
colorscheme nord
# ~/.tmux.conf

# $TERM, fix colors
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"

Source : https://github.com/tmux/tmux/issues/1246#issue-292083184

lucassardois commented 5 years ago

For my case, I'm not running vim inside tmux. @cyrilaugier can you provide the versions of st, vim and nord please? Because I have the same setup without tmux and I don't get the current line highlighted. 1564073697

arcticicestudio commented 5 years ago

@cyrilaugier Thanks, this helps a lot to encircle the root cause :+1:

@loustak I guess I've also misunderstood your actual problem: I thought you're having wrong styles for the current line highlighting (like e.g. too dark or totally wrong color), but I guess this is also just a Vim setup problem on your side. Have you enabled Vim's cursorline option? Otherwise the current line won't be highlighted at all :smile: You can add set cursorline to your vimrc to enable it by default or run the command from within Vim.

lucassardois commented 5 years ago

Okay, I'm stupid, I just forgot to add the cursorline option...

The issue seems close now.

arcticicestudio commented 5 years ago

@loustak Not stupid, human. I could tell you a lot of private or job-related development/coding situations where I was like "wow, the fix was a one-liner" after spending hours with debugging :upside_down_face: Glad to see it works for your now.

@DictumMortuum Could you please also check if you're just missing the cursorline option? Otherwise we need to check other settings that might conflict with the theme.

DictumMortuum commented 5 years ago

Currently on vacation, but I believe that I don't have the cursor line option enabled. Will check and update you as soon as possible !

On Fri, Jul 26, 2019, 8:56 AM Arctic Ice Studio notifications@github.com wrote:

@loustak https://github.com/loustak Not stupid, human. I could tell you a lot of private or job-related development/coding situations where I was like "wow, the fix was a one-liner" after spending hours with debugging 🙃 Glad to see it works for your now.

@DictumMortuum https://github.com/DictumMortuum Could you please also check if you're just missing the cursorline option? Otherwise we need to check other settings that might conflict with the theme.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arcticicestudio/nord-vim/issues/166?email_source=notifications&email_token=AAR7GLE7BY6XI4H74GKX6NLQBKGXFA5CNFSM4H3LCV6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD23SQNQ#issuecomment-515319862, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR7GLDQS6VAAOHTX7MM2ILQBKGXFANCNFSM4H3LCV6A .

DictumMortuum commented 5 years ago

Confirmed, I'd forgot to set the cursorline option. I think that we can close!