From 8b3cc23130279b2e2e4bf3cc6cc991172c0a1962 Mon Sep 17 00:00:00 2001 From: gingkapls <73906888+gingkapls@users.noreply.github.com> Date: Sat, 12 Dec 2020 01:35:51 +0530 Subject: [PATCH 1/4] Set dim bg to 0 to allow transparency --- autoload/limelight.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/limelight.vim b/autoload/limelight.vim index 0a4cd86..185c2d8 100644 --- a/autoload/limelight.vim +++ b/autoload/limelight.vim @@ -137,8 +137,8 @@ endfunction function! s:dim(coeff) let synid = synIDtrans(hlID('Normal')) let fg = synIDattr(synid, 'fg#') - let bg = synIDattr(synid, 'bg#') - + let bg = 0 + if has('gui_running') || has('termguicolors') && &termguicolors || has('nvim') && $NVIM_TUI_ENABLE_TRUE_COLOR if a:coeff < 0 && exists('g:limelight_conceal_guifg') let dim = g:limelight_conceal_guifg From 70b1ad49dbe1985c41f5e80e2cafb4452ef9f0dc Mon Sep 17 00:00:00 2001 From: gingkapls <73906888+gingkapls@users.noreply.github.com> Date: Fri, 11 Jun 2021 12:05:44 +0530 Subject: [PATCH 2/4] Added checks for non-transparent themes Now both transparent and non-transparent themes work properly --- autoload/limelight.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/limelight.vim b/autoload/limelight.vim index 185c2d8..7388c49 100644 --- a/autoload/limelight.vim +++ b/autoload/limelight.vim @@ -137,7 +137,11 @@ endfunction function! s:dim(coeff) let synid = synIDtrans(hlID('Normal')) let fg = synIDattr(synid, 'fg#') - let bg = 0 + if synIDattr(synid, 'bg#') == 'none' + let bg = 0 + else + let bg = synIDattr(synid, 'bg#') + endif if has('gui_running') || has('termguicolors') && &termguicolors || has('nvim') && $NVIM_TUI_ENABLE_TRUE_COLOR if a:coeff < 0 && exists('g:limelight_conceal_guifg') From cebb72375345bf18df4e622bdac24991f9500665 Mon Sep 17 00:00:00 2001 From: gingkapls <73906888+gingkapls@users.noreply.github.com> Date: Wed, 16 Mar 2022 16:59:01 +0530 Subject: [PATCH 3/4] Remove redundant synIDattr calls Commits changes requested in https://github.com/junegunn/limelight.vim/pull/71#discussion_r826716708 --- autoload/limelight.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/autoload/limelight.vim b/autoload/limelight.vim index 7388c49..70ce19c 100644 --- a/autoload/limelight.vim +++ b/autoload/limelight.vim @@ -137,11 +137,8 @@ endfunction function! s:dim(coeff) let synid = synIDtrans(hlID('Normal')) let fg = synIDattr(synid, 'fg#') - if synIDattr(synid, 'bg#') == 'none' - let bg = 0 - else - let bg = synIDattr(synid, 'bg#') - endif + let bg = synIDattr(synid, 'bg#') + let bg = bg == 'none' ? 0 : bg if has('gui_running') || has('termguicolors') && &termguicolors || has('nvim') && $NVIM_TUI_ENABLE_TRUE_COLOR if a:coeff < 0 && exists('g:limelight_conceal_guifg') From 432fceabe5443a202917f73f4f67aa22d53808d5 Mon Sep 17 00:00:00 2001 From: gingkapls <73906888+gingkapls@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:49:32 +0530 Subject: [PATCH 4/4] Fix the logic Fixes calculating the bg for `Normal` highlight group depending on the ctermbg value --- autoload/limelight.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/limelight.vim b/autoload/limelight.vim index 70ce19c..3940770 100644 --- a/autoload/limelight.vim +++ b/autoload/limelight.vim @@ -138,7 +138,7 @@ function! s:dim(coeff) let synid = synIDtrans(hlID('Normal')) let fg = synIDattr(synid, 'fg#') let bg = synIDattr(synid, 'bg#') - let bg = bg == 'none' ? 0 : bg + let bg = bg == 'none' ? bg : 0 if has('gui_running') || has('termguicolors') && &termguicolors || has('nvim') && $NVIM_TUI_ENABLE_TRUE_COLOR if a:coeff < 0 && exists('g:limelight_conceal_guifg')