junegunn / limelight.vim

:flashlight: All the world's indeed a stage and we are merely players
MIT License
2.36k stars 53 forks source link

Cannot calculate background color #39

Closed IlikePepsi closed 7 years ago

IlikePepsi commented 7 years ago

I'm really curious to use your plugin but the only message I get when calling :Limelight1 is Cannot calculate background color. What I've done so far is install your plugin via vim-plug and putting these settings in my nvim.init file.

" Color name (:help cterm-colors) or ANSI code
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240

" Color name (:help gui-colors) or RGB color
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'

" Default: 0.5
let g:limelight_default_coefficient = 0.7

" Number of preceding/following paragraphs to include (default: 0)
let g:limelight_paragraph_span = 1

" Beginning/end of paragraph
"   When there's no empty line between the paragraphs
"   and each paragraph starts with indentation
let g:limelight_bop = '^\s'
let g:limelight_eop = '\ze\n^\s'

" Highlighting priority (default: 10)
"   Set it to -1 not to overrule hlsearch
let g:limelight_priority = -1

So I'm using neovim (in case that is important). I even tried different terminal emulators. So far I got urxvt, guake and terminator. All show the same error message. If the Linux flavor is important, that's what I got.

LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:    16.10
Codename:   Fringilla

So any hint is appreciated.

junegunn commented 7 years ago

I don't understand why you put all those settings in your configuration. They're just examples of the existing options, and typically you don't need any of them. Remove them and see if the error message changes.

IlikePepsi commented 7 years ago

I added them since in the 'vanilla' setup it didn't work. I got the error message "Unsupported color scheme. g:limelight_conceal_ctermfg required". I'm using this colorscheme. At first of course I tried another colorscheme but even with :colorscheme default I get the same message. As a test I removed all those configurations except for the required g:limelight_conceal_ctermfg and again when I call :Limelight0.5 or anything I get "Cannot calculate background color."

I also used that configuration with vim instead of nvim but the result is the same. Which terminal do you normally use?

junegunn commented 7 years ago

The color scheme you use does not set foreground and background colors for "Normal" highlight group, so Limelight has no information to calculate the color to use.

As suggested in the error message, you can set g:limelight_conceal_ctermfg, so Limelight can use the color, but in that case the color is fixed. :Limelight will work using the color, but :Limelight with any number argument (e.g. :Limelight0.5, :Limelight1, etc) will not work, because Limelight still has no information to calculate the color corresponds to the argument. I guess the error message can be improved. But anyway that's what's happening here.

Two options:

bzub commented 5 years ago

I was running into this situation. It was not the colorscheme, but rather another setting in my vimrc/init.vim intended to make transparent terminals work:

" Fix to allow transparent background
hi Normal ctermbg=NONE guibg=NONE

The solution was to find ctermfg and guifg as set by my colorscheme using the hi command, then setting the limelight settings (gruvbox for example):

" Color name (:help cterm-colors) or ANSI code
let g:limelight_conceal_ctermfg = 100

" Color name (:help gui-colors) or RGB color
let g:limelight_conceal_guifg = '#83a598'
juanmaia commented 2 years ago

@junegunn when I have my color scheme using a transparent background color, is there an option to tell Limelight which is my background color instead (the one set by my terminal in this case)? So then it can calculate which fg color to use when activating the plugin with params (0.9, 0.1, etc)?

TonyBarganski commented 1 year ago

If I do NOT have the g;Limelight_conceal_ctermfg = set then I receive the error:

Unsupported color scheme. g:limelight_conceal_ctermfg required.

When I do set it, let g:limelight_conceal_ctermfg = 240

I don't get the error from this post but Limelight works with my 'seoul256' colorscheme:

Cannot calculate background color

@junegunn Is there a way to suppress this error message?

TonyBarganski commented 1 year ago

@junegunn Is this project still maintained?

junegunn commented 1 year ago

Yes, but I don't always have time and interest to look into problems that don't affect me. This is a free, open-source project, you can contribute to it.

TonyBarganski commented 1 year ago

@junegunn I really appreciate what you say.

Unfortunately, my vim script skills are limited as I am not a developer but a hands-on enterprise architect who uses vim a great deal for 'distraction free' and fast productivity. I've used 'iA writer' & Typora for years and wanted to combine my command line experience.

It was all working for the past 3 years until I changed laptops. Perhaps someone with a bit more time may be my night in shining armour :)