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

Different background color in vim vs terminal/tmux #34

Closed
codemang opened this issue May 19, 2016 · 20 comments
Closed

Different background color in vim vs terminal/tmux #34

codemang opened this issue May 19, 2016 · 20 comments

Comments

@codemang
Copy link

In vim the background is a nice dark gray, but in my terminal it looks like a very dark navy. Have you encountered this issue before?

@simonsmith
Copy link
Collaborator

I've had this. It's usually around having Vim setup correctly with 256 colors. See if the 16 setting helps:

https://github.com/joshdick/onedark.vim#16-color-mode

@simonsmith
Copy link
Collaborator

Note that it's supposed to be navy in Vim

@domingusj
Copy link

I've noticed a similar thing. If I set let g:onedark_termcolors=16 the colors look correct, but comments and syntax highlighting don't look quite right. let g:onedark_termcolors=256 has correct syntax and comment highlighting, but the background is slightly off and the font colors seem a little neon. 256 looks great in MacVim so I assume it's something between my vim and my iTerm2 (beta Build 2.9.20160510). I did download and use the OneDark.itermcolors files in this repo for my iTerm color profiles. I'd love to figure it out.

@simonsmith
Copy link
Collaborator

Have you tried using neovim?

@domingusj
Copy link

That was actually my next move... I will post back if it's better.

@domingusj
Copy link

Indeed, it looks correct with nvim. Thanks for the suggestion 👍

@joshdick
Copy link
Owner

There are a few things that seem to need clarifying here.

If I set let g:onedark_termcolors=16 the colors look correct, but comments and syntax highlighting don't look quite right.

@domingusj Can you elaborate? If the colors look correct, comments and syntax highlighting should, too. g:onedark_termcolors=16 will only look correct in iTerm2 when using One Dark.itermcolors, which you did say you've done.

256 looks great in MacVim

That's because MacVim is using GUI colors and ignores the g:onedark_termcolors setting (the setting is called g:onedark_termcolors after all!)

You can get NeoVim to use the (correct, good-looking) GUI colors inside the terminal, regardless of the g:onedark_termcolors setting, by following the instructions in the Neovim section of the README.

I'm closing this issue since there doesn't appear to be an actual problem, but feel free to keep the dialog going. :)

@joshdick
Copy link
Owner

@codemang What you're seeing is almost certainly because you're using the theme in 256-color mode. Please either use 16 color-mode or NeoVim, as described in the README.

@domingusj
Copy link

Sure, thanks for all your work on this btw! I really love the scheme!

Here is 16 in iTerm in regular vim (not nvim):

image

And here is 256:

image

You can see the color difference especially on the comments and the slight difference in background color.

@joshdick
Copy link
Owner

joshdick commented May 19, 2016

@domingusj To me that indicates that something is wrong with the 16-color iTerm preset (or the import of it.) When's the last time you downloaded a fresh copy of it and re-imported it? It has changed a few times during the past couple of weeks.

I'm glad you like the colorscheme! :)

@domingusj
Copy link

I'm pretty sure that I re-imported it fairly recently, but I'm not 100% sure. nvim is working great though and I've started moving my stuff over. Thanks again for all your work!

@joshdick
Copy link
Owner

joshdick commented May 19, 2016

@domingusj Okay! You're welcome!

@yarhtut
Copy link

yarhtut commented Nov 18, 2017

@joshdick
I have a different background colour in iTerm even I set it to 16.
screen shot 2017-11-19 at 12 51 48 am

Thanks

@yarhtut
Copy link

yarhtut commented Nov 18, 2017

@joshdick
Ignore my question. I got it working. Great job on the theme.
screen shot 2017-11-19 at 1 41 43 am

@yuhuanq
Copy link

yuhuanq commented Dec 9, 2017

@yarhtut Have this same dark grayish bg. What did you change to get it working? Specifically the dark gray bg appears in tmux (v2.2 which should have 24 bit support) nvim only.

edit: fixed by adding set-option -ga terminal-overrides ",tmux-256color:Tc to tmux.conf

@hereisfun
Copy link

same issue like @joshdick
here is my solution, maybe useful for somebody(MacOS, iterm2)

after setting tmux -2, xterm-256color, and $TERM, things doesn't get better.

and if I use let g:onedark_termcolors=16, my comments turn white like this:
image

At last I found the reason is, I used an onedark theme for iterm from nathanbuchar/atom-one-dark-terminal, with doesn't work well with 16bit onedark.vim!

So I switch to term/One Dark.itermcolors from this project, setting let g:onedark_termcolors=16, and finally everything is perfect❤️

@reidcooper
Copy link

How can i determine the color scheme definition for colors when it looks like this? I actually like it...

ad6e6bd2-1dd2-11e6-9979-bb4230c9af1d

@joshdick
Copy link
Owner

@reidcooper That is the 8-bit/256 color palette, whose colors are defined as the cterm values in autoload/onedark.vim.

To get hex equivalents to those colors, you'll have to look up the aforementioned cterm color values in a table like this one.

I hope that helps!

@reidcooper
Copy link

@joshdick Thanks! That makes sense. As for the attributes gui, cterm, and cterm16, are those the 3 different possible color values that can be displayed for that one override?

When are any of the 3 chosen? New to vim.

@joshdick
Copy link
Owner

@reidcooper You’re welcome!

For any given color definition, gui is what is used in true (24-bit) color mode, cterm is what is used in 256-color mode, and cterm16 is used in 16-color mode, except in this case, the actual 16 colors are defined by your terminal emulator configuration and nubmered 0-15, and the theme can only pick from those predefined colors.

So, every color definition is actually three definitions since each color needs to work in three modes.

Your configuration is what determines which mode is used. The README goes into a lot of detail about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants