problem with background transparency
ghifarit53 opened this issue · comments
reported by u/kunzaatko on reddit
I can now see that you are not able to see whether the background is transparent or not, but it was, when I wrote so. My concern here is: Is this an issue in my config or is this on the colourscheme? I am not particularly informed about the workings of colours in vim. However I know why the background was transparent in the second case, but why was it not in the first? Also, I did not understand the help about termguicolors can someone explain please?
I want to know if this is an issue in order to determine if it is worth filing...
This is the step-by-step fix for the problem, I'll pin this issue and link it on the README
1. First make sure your terminal support transparency, Below are some terminals that supports it
- urxvt
- xfce4-terminal
- kitty
- alacritty
Set the opacity of your terminal to the value you prefer (I recommend 0.9
)
2. Set your terminal to use the same colorscheme
I've already ported daycula for kitty, alacritty, and Xresources. If it's not available yet (like iTerm2, xfce4-terminal, etc.), you can port it yourself and add a pull request to this repo.
3. Check if your compositor is already running
This might not be the case for macOS and Windows. But on Linux, you need to run compositor that supports transparency (such as compton, picom, etc.) if you're not using a DE with built-in compositor (such as KWin)
4. Set the g:daycula_background_transparency
to 1
This will make Vim not using any color for its background. Instead, your terminal colorscheme background will be used
Result
You can see there's some see through flower in the background
This is kitty
on Linux and the opacity is set to 0.9
with vanilla compton
running
For now I'll close this issue. But if you're still having some problem after following the steps or maybe having some questions, feel free to mention me and leave a comment
Hey there @ghifarit53! It is still not working for me. I tried both terminals that I have on my system. Namely st
and alacritty
. Both of them are set to support transparency (it works elsewhere). My compositor is picom
, but the problem is not in the compositor, since it works on other schemes and also in the screencast, where I set the custom highlight. Here are the examples:
Great work though! I love the colours. Am changing to them from previously using gruvbox. I will make some changes for rust probably. Should I issue a pull request then or are you reluctant to change the actual colours (which would be totally understandable)?
@kunzaatko hey thanks for the reply.
First, sorry for the inconvenience you got when using this colorscheme. I'll do my best to help you.
I haven't tested alacritty and st yet (maybe later). By the way, looks like you haven't set your terminal to use daycula. Alacritty port is available here. I dont really know how to add port for st since st hardcodes colors from its source code. I'll think about it later
Please send the screenshot here again after setting your terminal colors to daycula and termguicolors is set
Hi there! An update. I used it with the alacritty terminal with the daycula colours and it still does not work. It works unsurprisingly without termguicolours set. Here is the cast and screenshots in order. I use the patch to load colours from Xresources, so I am covered in using st, but thank you! :)
[](https://asciinema.org
Sorry for the other desktop. I didn't realise, that it was going to screen both of them... :)
Hey @kunzaatko, I been busy this few days, but looks like I've finally found a solution. Although I still need to check some things, this is what I got for now. I'll write the details soon.
Vim with Daycula colorscheme on alacritty with set termguicolors
and background opacity set to 0.85 with just plain compton
enabled (without any compton.conf
)
This is the relevant part of my vimrc file
call plug#begin('~/.vim/plugged')
Plug 'ghifarit53/daycula-vim', {'branch':'main'}
call plug#end()
set termguicolors
if exists('+termguicolors')
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
let g:daycula_transparent_background = 1
colorscheme daycula
At first, I thought it's alacritty issue with truecolor, so i googled it and found this: alacritty/alacritty#109
By adding the relevant line from elquimista, I can get it to working
Also, there's apparently some bad formatting in the yml colorscheme, I'll replace it with the working one after this
Unfortunately, this does not work for me either. I also tried launching picom with default configuration, which did not help. Thank you for the effort. If this works on your system, then it is probably an issue with my setup in particular, so you can close the issue if you want to.
@kunzaatko That's sad. I wanna know why it isn't working for you. Can you post your config (vimrc, alacritty.yml) in a gist? I'll play with them in my free time and see whether I can reproduce and fix it or not. And if you don't mind, try running it with compton instead of picom
I tried with compton and there is no change. Here is the gist. My vim configuration is in about 50 separate files so this is only the relevant part.
https://gist.github.com/kunzaatko/17c912393aee852468f567669392bb9e
Hi @kunzaatko! I'm really sorry for the very long wait because I've been busy these past months.
So today when I revisit this issue again, I've likely found the solution. Apparently it has something to do with the ordering of your config. You need to set all the configuration for daycula (e.g. g:daycula_transparent_background
) before setting your colorscheme to daycula. I've done some reordering to the relevant part of your config.
" This should be a fix for 24 byte colours on alacritty
" if exists('+termguicolors')
" let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
" let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
" set termguicolors
" endif
" Plugin: daycula {{{
" for transparent background
let g:daycula_transparent_background=1
let g:daycula_menu_selection_background='blue'
let g:daycula_enable_italic=1
let g:daycula_current_word='bold'
colorscheme daycula
"}}}
I've also removed custom higlighting that you've set because it's already being set by the colorscheme. I hope its working after updating your relevant config with my changes above
Thank you very much for the effort!
However, this did not solve the problem.
I would be very happy to solve this issue, as it is the issue, that prevents me from using this great colourscheme full time, but it has to have been a great effort from you, so if you wish, you can close the issue assuming that it is a problem on my system...