limelight.vim
limelight.vim copied to clipboard
Add a check to work with transparent themes
Right now limelight throws an error about not being able to calculate bg color because of ctermbg value of Normal highlight group being set to none to allow transparency in terminals. Setting the bg value for dim coefficient to 0 solves this.
This PR adds a check to see if ctermbg is set to none (used in themes with transparent backgrounds) and changes the bg value of dim coefficient to 0 as a fix, otherwise the plugin works as before.
approved
Which color scheme should I test this with?
I tested this with a modified base16-vim scheme where I had replaced the Normal
highlight bg with none.
You can use any color scheme, and run :hi Normal ctermbg=none guibg=none
before calling Limelight to test it.
You can use any color scheme, and run
:hi Normal ctermbg=none guibg=none
before calling Limelight to test it.
Getting this error:
E254: Cannot allocate color none
You can use any color scheme, and run
:hi Normal ctermbg=none guibg=none
before calling Limelight to test it.Getting this error:
E254: Cannot allocate color none
Oh, I'm so sorry!
I had been trying this plugin on neovim, and could not reproduce this error. Apparently they handle the command differently?
Tried it on vim again and the :hi Normal ctermbg=none guibg=none
gave me the same error you got.
This time I tried it on barebones vim, you can select the darkblue
preinstalled colors scheme, and after that only change :hi Normal ctermbg=none
and you'll be good to go!
Also, I noticed that that Limelight was not able to calculate the dim coefficient with the ternary operator patch. Tweaking the logic fixed that for me so I pushed that to master. Please try it again and let me know if it works now!
I don't think the patch is correct. After applying your patch, Limelight stops working with any of my color schemes. (e.g. seoul256, Tomorrow, etc.)
Unsupported color scheme. g:limelight_conceal_ctermfg required.
Note that I'm using &termguicolors
.
Hmm, &termguicolors
uses gui colors for highlights instead of cterm ones, probably that's what breaks it.
I'll see how to fix it and come back to this.