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

background color break after update #65

Closed
Saul-Mirone opened this issue Mar 29, 2018 · 63 comments
Closed

background color break after update #65

Saul-Mirone opened this issue Mar 29, 2018 · 63 comments

Comments

@Saul-Mirone
Copy link

Hi, I'm using vim in iTerm on macOS. My iterm theme is dracula as well. It works well for years.
I update dracula today and my iterm color is so werid,and the background image disappear, what happend?

BEFORE I UPDATE

that

AFTER I UPDATE

this

@Saul-Mirone
Copy link
Author

some hightlight break too, look at the arrows.

BEFORE

image

AFTER

image

@Saul-Mirone
Copy link
Author

visual mod breaks too

@Saul-Mirone
Copy link
Author

JSX is the worest.....
image

@ghost
Copy link

ghost commented Mar 29, 2018

This is happening to me too, but with the terminal app. Background is dark grey instead of the default Dracula background.

@dsifford
Copy link
Member

Fixes for @Saul-Mirone: Your terminal does not support italics. Or, if it does, your terminfo is not correct (which is why the italics are appearing inverted).

Try disabling the italics with let g:dracula_italic = 0 in your vimrc

Fixes for @braddielman: Add set termguicolors to your vimrc.

@dsifford
Copy link
Member

dsifford commented Mar 29, 2018

@Saul-Mirone -- Re: Background image. To get that back you'll need to add a reset to the Normal highlight group.

so, for example: highlight Normal cterm=NONE term=NONE

I'm not going to revert back to that because you and potentially a few others out there are in the minority when it comes to wanting a transparent background.

Edit: I may revert to a system that falls back to transparent based on t_Co and/or termguicolors -- Either a direct fallback or add an option flag. Let me think about the best way to approach this.

@dsifford
Copy link
Member

@braddielman: Terminal App might not suffice for the fix that I suggested above as I'm not sure that that terminal supports truecolor.

If that's the case, you're seeing the gray because that's the closest 256 color fallback. See #60

@ghost
Copy link

ghost commented Mar 29, 2018

@dsifford - Yeah, using set termguicolors sets the background to bright yellow. The theme was working prior to the update, however. It's cool though since I mainly use MacVim.

@richnotwealthy
Copy link

I'm on iTerm2 and my background color has also changed to match the airline gray. It was working until I did a vim-plug PlugUpdate a few minutes ago...

@richnotwealthy
Copy link

set termguicolors seems to fix the issue outside of tmux, but when in tmux it looks like it completely breaks syntax highlighting

@dsifford
Copy link
Member

@rivyx Haha, yeah I'm a tmux'er myself and there's a few things that you need to do to make it play nicely...

Can you confirm that you have the truecolor overrides in your tmux.conf and the correct terminfo file is being read by tmux?

@richnotwealthy
Copy link

richnotwealthy commented Mar 30, 2018

@dsifford the terminfo is the same for both my iTerm2 and my tmux (xterm-256color) and in an effort to keep my dotfiles portable I'd rather not implement truecolor overrides...just from a quick google it looks like a bit more overhead than I'm comfortable with

EDIT:
https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be

Actaully, it doesn't look too bad. I will try this out after work and report back later. Until then, is there a solution which does not require truecolor overrides?

Thanks again

@dsifford
Copy link
Member

Adding truecolor support with iterm should be no more than just adding a single line to your tmux.conf.

Adding a terminfo fix is only relevant if you want to make italics work correctly.

@dsifford
Copy link
Member

For example, here's the line from my tmux.conf.

The relevant portion of that line with respect to truecolor is the ,*:Tc.

@Saul-Mirone
Copy link
Author

Saul-Mirone commented Mar 30, 2018

@dsifford Thanks for response. I tried disabling the italics, but the highlight and visual mod still not works correctly
image
(I select the "$ char '0'" using the visual mod but it seems still can't work, and the Integer highlight seems wrong)

Then I tried add italics for my terminal by followying [this].(https://apple.stackexchange.com/questions/266333/how-to-show-italic-in-vim-in-iterm2)
I succeed but nothing seems changed.

@Saul-Mirone
Copy link
Author

I forked and checkout to the commit 1f44625
Everything works fine now.

For Dracula, What important to me is that it can be used together with it's iterm and zsh themes. So I can do every thing in terminal. (I use solarized in gui vim).
Thanks for the guys who contribute to this awesome theme, but these day's update seems break the most important advantage for some guys like me, so I have to use an old version managed by myself.
I write this because I think it maybe useful for you guys to maintain this project.

@dexrualo
Copy link

dexrualo commented Mar 30, 2018

I'm having @Saul-Mirone's issue too. Some keywords have cyan highlighting. And when I source my .vimrc from within vim, I get this output:
screen shot 2018-03-30 at 12 35 00 pm

@larshisken
Copy link

I'm using Vim8 in iTerm2 3.1.5 (also with dracula theme), using the following settings in this exact order fixed both issues for me:

let g:dracula_italic = 0
colorscheme dracula
highlight Normal ctermbg=None

@dsifford
Copy link
Member

@larshisken Bingo!

Thanks for centralizing everything for people who are reading this thread.

Again, I'll likely add in a flag to disable the ctermbg in the Normal group when I get some free time.

@Saul-Mirone You're more than welcome to maintain a fork, but again the entirety of your issue boils down to having ctermbg set. So you're sort of creating more work for yourself.

If you can hold off for now, just add in the fix that @larshisken has above and I'll add in that flag soon.

@richnotwealthy
Copy link

@dsifford So I got it working fine on my local instance of tmux inside of iTerm2 now that truecolors has been enabled and I've changed my terminfo to support italics and truecolors. However, I am now getting a seemingly related issue on Konsole (Kubuntu 16.04) inside of tmux (with terminfo and truecolors properly set).

image

Also, I like using this theme on remote servers and I definitely don't always have the option of setting up truecolor overrides on there.

Honestly, this update has really made working with this package a lot more difficult. I don't know what was wrong with the previous background color configuration, but until this issue is fixed/truecolors are optional, I am going to fork the project from a previous version...

@dsifford
Copy link
Member

What's the unrelated issue you're getting?

Also, re: remote servers -- I adopted the same fallback mechanism for that that gruvbox uses: https://github.com/dracula/vim/blob/master/colors/dracula.vim#L28

If in the case that the remote server passes the fallback, setting the flag to disable ctermbg should make the theme work fine on remote servers.


Side note: I'm receiving a lot of flack here because of the update. I'll say this again: Nobody is stopping you from forking this and maintaining your own implementation that satisfies whatever look you're going for. The update was done for two reasons:

  1. The colors were out of specification.
  2. The theme was difficult to maintain and difficult to extend with additional highlight groups.

I can't make everybody happy, so as a second best, I'm forced to make changes based on what a majority of users would agree upon.

Thanks for understanding.

@richnotwealthy
Copy link

richnotwealthy commented Mar 30, 2018

Now getting the same issue inside of tmux on local Konsole (Kubuntu 16.04) and while inside of tmux on a remote server. This screenshot is from vim running in tmux on a remote server inside of iTerm2. It is the same problem from my previous comment (that screenshot was from my Kubuntu machine). It looks like the background color is being set correctly everywhere except the text characters (they have a gray highlight).

For Konsole, this problem persists even with truecolors set. For the remote server, I have ctermbg disabled and am getting the same problem.

image

EDIT:
I reverted a lot of settings that I've been messing with and it looks like termguicolors was the problem there. Everything seems to be working now. Thanks for the help.

@dsifford
Copy link
Member

@rivyx The issue you're describing above is likely related to the ostensible fact that you have termguicolors indiscriminately enabled.

To get it to play well for all situations, you need to add a check in your vimrc that checks the environment you're in and then enables termguicolors based on that. If termguicolors is not enabled, then you should also (for now, until I get a chance to add the flag), add in a downgrade of the Normal highlight group so that ctermbg=NONE

Hope that makes sense.

@richnotwealthy
Copy link

richnotwealthy commented Mar 30, 2018

@dsifford Yes, it looks like I realized that just as you were commenting. Also, sorry if I sound ungrateful, I do appreciate the work you've been putting in as well as all the help you've been providing for everyone. It was just very frustrating for a little while which I'm sure you get.

That being said, if it is possible to somehow tell dracula to set these settings automatically based on the current environment, that would be great! Thanks again...I luckily did not have to fork haha.

EDIT:
Updating the instructions at https://draculatheme.com/vim/ would also be helpful for future users :).

@Saul-Mirone
Copy link
Author

@dsifford I tried @larshisken 's solution but it didn't work for me.

@dsifford
Copy link
Member

Sorry for the delayed response.

@rivyx Re: "if it is possible to somehow tell dracula to set these settings automatically based on the current environment" --- I agree that would be ideal, but there's just too many variables in play to be able to do that effectively (terminal, os, kernel version, unpredictable terminfo across similar machines, etc). No way that I'm aware of to be able to reliably catch all of that.

Re: "Updating the instructions at https://draculatheme.com/vim/" -- @benknoble did a pretty amazing job with the help docs which are now available with :h dracula -- I think that might be something that we could potentially put in there. PRs accepted.

Glad to hear you were able to get everything sorted without having to fork!

@Saul-Mirone Refresh me again on what issues you have that are still unresolved? The same as your original comment or just a portion of that?

Can you link me to your vimrc? Also, can you provide some info related to your environment that you're on (terminal, os, vim/neovim/gvim, etc).. I understand you're using tmux. Have you tried terminal-override fixes?

@benknoble
Copy link
Member

Hi all, sorry for leaping into the thread really late, just want to add a couple of things I saw.

  1. I use Terminal.App on macos. It does not, I repeat, not, have truecolor support at this time
  2. I have had 0 issues using the colorscheme since the update
  • I did set g:dracula_italic=0 before setting the colorscheme!
  • I might turn off the background highlighting for Normal, since my term's background is setup to use Dracula colors (I maintain the Terminal.app theme) and the grey is kind of weird (but not impossible)
  • I guard against colorscheming twice in my vimrc, since that doesn't usually make sense and can ruin things like markology highlighting groups.
  1. The entirety of my tmux/vim play-nice setup is using screen-256color in tmux and xterm-256color elsewhere; vim takes care of the rest automagically.
  2. Truecolors has so far been optional ? That is, I do not (and should not) set termguicolors, and I experience no issues.

P.S. @dsifford , I haven't gone through the Terminal theme yet to see if it needs to be updated re: the spec.

When the new ctermbg flag gets added, let me know if you need help editing the doc file. It sounds like it could use an a explanation of what to with termguicolors, but I'm not in a position to author that sort of explanation.

@Saul-Mirone
Copy link
Author

Saul-Mirone commented Apr 2, 2018

@dsifford
sorry for late, I tried everyone's solution and the only problem is the background color.(left is dracula in iterm2 and right is vim).
image
I use vim in tmux.
my .vimrc is here and .tmux.conf is here

@hacker1db
Copy link

I have same issue as above ^ @Saul-Mirone

andrepoleza pushed a commit to andrepoleza/dotfiles that referenced this issue Apr 5, 2018
@hacker1db
Copy link

@dsifford the colorscheme does not apply fully when not running tmux

@dsifford
Copy link
Member

dsifford commented Apr 6, 2018

@hacker1db Right, but specifically, where is it not applying?

From your screenshot, it appears that the only issue is with the ~ in the gutter? Is that correct?

@hacker1db
Copy link

hacker1db commented Apr 6, 2018

Correct, I can't tell for sure if its affecting anything else but thats the most obvious issue. @dsifford you are correct its not fully applying to ~ which intern looks like it doesn't fully apply to comments.

@dsifford
Copy link
Member

dsifford commented Apr 6, 2018

Would you mind reporting back with the output of :verbose hi NonText in the affected terminal?

@dsifford
Copy link
Member

dsifford commented Apr 6, 2018

Also, can you run :set foldcolumn=3 and let me know if that is affected as well?

@hacker1db
Copy link

screen shot 2018-04-06 at 2 56 20 pm

screen shot 2018-04-06 at 2 56 52 pm

@dsifford here is the info you asked for let me know how else I can help is anyone else besides me having this issue? I wonder if its something I did in my config that is causing this issue...

@dsifford
Copy link
Member

dsifford commented Apr 7, 2018

@hacker1db Thanks for that.

On my machine, the output is

:verbose hi NonText
NonText        xxx ctermfg=12 gui=bold guifg=Blue
                   links to DraculaSubtle
        Last set from ~/.dotfiles/vim/_plugins/dracula/colors/dracula.vim

So yeah, it looks like NonText is either getting unset or the pre-check condition in the theme is being satisfied, so nothing gets set.

I snagged that little escape hatch from the gruvbox theme because it is extremely popular and has been actively maintained for 10+ years. Figured because they've been around so long, there was a reason why that check was there so I opted to keep it.

(I'm fairly certain we can just scrap that escape hatch though if that's what it turns out being -- I really don't understand the point of it to be completely honest)

To confirm my suspicion, can you just enter :hi and scroll the list to see if you can locate one or more groups with the name Dracula* in existence. If you can't, it's the escape hatch. If you can, it's something else.

Thanks for your patience 🙏

gish added a commit to gish/dotfiles that referenced this issue Apr 9, 2018
@hacker1db
Copy link

screen shot 2018-04-09 at 9 25 46 am Sadly, I think its something else.. Thanks for all the help.

@benknoble
Copy link
Member

benknoble commented Apr 9, 2018

What about these lines ? (I think it's 73-ish)

" make the highlighting of tabs and other non-text less annoying
highlight SpecialKey ctermbg=none ctermfg=8
highlight NonText ctermbg=none ctermfg=8
" make comments and HTML attributes italic
highlight Comment cterm=italic
highlight htmlArg cterm=italic

@dsifford
Copy link
Member

dsifford commented Apr 9, 2018

@benknoble found it.. That's the issue for sure. Remove all those 👍 👏

@nineKnight
Copy link

nineKnight commented Apr 11, 2018

Setting let g:dracula_colorterm=0 before calling colorscheme dracula solves the issue for me.

"And I really don't want to see these garbage patches just mindlessly sent around." ---- Linus Torvalds

I think this feature is one of them.

@dsifford
Copy link
Member

dsifford commented Apr 11, 2018

@nineKnight Here's a reminder if you forgot how git works:

git clone https://github.com/dracula/vim.git
cd vim
git checkout 3eaed4ff9fe8441bee02a00fbe80ac12cffd9b1c

Feel free to stay detached in the past if the updates don't suit your needs. We're using "garbage" patches because the terminal combination of every conceivable user is not something we can control. So the argument doesn't really apply here, but thanks.

@nineKnight
Copy link

@dsifford I don't even know the feature exists before I find this issue and your commit 52d955a. You maintainers never change vim bg these years, but these days. Do you know how we feel when our vim suddenly changed by unknown who, what or where? Do you want everyone who suffers this feature get into the source code, even its history? Come on, ridiculous.

Agressive changes should be tested completely.
New features should be declared.
New unnecessary features should be disabled by default.

I'm sorry if words hurt you. Except this one, I appreciate your works.

@hacker1db
Copy link

@dsifford and @benknoble sorry for delayed response, that commented out those lines and it fixed the issue! 👍
Thank you for all of your help!

@dsifford
Copy link
Member

Glad to hear @hacker1db

Marking this as resolved as it seems like everybody who had issues is now back and operational as they were before.

@dmitriyK1
Copy link

What helped me is setting these variables in .vimrc:

let &t_ZH="\e[3m"
let &t_ZR="\e[23m"

mmyoji added a commit to mmyoji/dotfiles that referenced this issue Jul 3, 2018
jackiekircher added a commit to jackiekircher/vim that referenced this issue Jul 28, 2018
this incuded some significant changes to terminal colors, which required
more configuration to fix in .vimrc. I remember not being able to solve
this problem with tmux becuause additional configuration is necessary -
see dracula/vim#65 for help
@bangarangler
Copy link

larshisken answer totally fixed my vim in tmux/iterm 2. I had almost given up and was just getting used to the gray. This gave me that beautiful black background in vim instantly! doubt anyone is still checking this old thread but fuck yes! much appreciated ; ))

@zkity
Copy link

zkity commented Nov 26, 2020

Setting let g:dracula_colorterm=0 before calling colorscheme dracula solves the issue for me.

"And I really don't want to see these garbage patches just mindlessly sent around." ---- Linus Torvalds

I think this feature is one of them.

You really should to try this, it's nice for me!

@mr-pmillz
Copy link

Yep! This was driving me bonkers for a minute!

After much time wasted going down too many rabbit holes trying to get the dracula theme to work as intended, (Amazing theme by the way, Much thanks and respect!) What also fixed it for me was declaring:
let dracula_colorterm = 0
and
let dracula_italic = 0

BEFORE calling colorscheme dracula

Here's my working config snippets in relevant order:
This is in ~/.vim_runtime/my_configs.vim using the https://github.com/amix/vimrc project for awesome customized vim.

try
    " vim-devicons set encoding utf-8
    set encoding=UTF-8
    syntax enable
    filetype plugin indent on

    " Set Dracula to the default Theme
    let g:dracula_colorterm = 0
    let g:dracula_italic = 0
    highlight Normal ctermbg=None
    colorscheme dracula
    " Show Line Numbers
    set nu
    " Set Background to dark mode
    " For Light mode, switch color to peaksea and set background=light
    " set background=light
    set background=dark
    " <Snippet>

    " vim-airline settings
    " DO NOT USE badwolf airline_theme!!! This seemed to break stuff
    " let g:airline_theme = 'badwolf'
    let g:airline_theme = 'dracula'
    " ....more airline customizations but not relevant to this post... </Snippet>
    
catch
endtry

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

No branches or pull requests